Normal Topic CloseCommandArea() on menu bar? (Read 736 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
CloseCommandArea() on menu bar?
Sep 7th, 2007 at 11:37am
Print Post Print Post  
I know I can program a command button on my form to use CloseCommandArea(), but is it possible to put it on the menu bar?
  

**
Captain Infinity
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: CloseCommandArea() on menu bar?
Reply #1 - Sep 7th, 2007 at 12:21pm
Print Post Print Post  
Put this in the On Application Open event:
CloseCommandArea(1)
AddCommandToMenuBar("Command Area/Open", "", "CloseCommandArea(0)")
AddCommandToMenuBar("Command Area/Close", "", "CloseCommandArea(1)")


This will start the application with the command area closed. If you want to start it with the command area open, just remove the 1st line.

BTW, don't forget that if you start it open, the View menu already has controls for this.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: CloseCommandArea() on menu bar?
Reply #2 - Sep 7th, 2007 at 12:30pm
Print Post Print Post  
Thanks Carl, that's great!  I'll give it a try.
  

**
Captain Infinity
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: CloseCommandArea() on menu bar?
Reply #3 - Sep 7th, 2007 at 12:46pm
Print Post Print Post  
Quote:
AddCommandToMenuBar("Command Area/Open", "", "CloseCommandArea(0)")

Could one of the Lanticans show an example of the shortcut parameter, other than simply a one letter entry like "O" or "C"?

In other words, how could I allow for things like "Alt+O" and "Alt+C"?
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: CloseCommandArea() on menu bar?
Reply #4 - Sep 7th, 2007 at 1:55pm
Print Post Print Post  
Hello Carl,

Code
Select All
 AddCommandToMenuBar("&Command Area/&Open", "", "CloseCommandArea(0)")  



Will have a shortcut of Alt+C+O

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: CloseCommandArea() on menu bar?
Reply #5 - Sep 7th, 2007 at 2:01pm
Print Post Print Post  
Just add "&" in front of the char you want to be the hot key.. Does not need to be the first character.  Can do something like "Pri&nt Label" to get ALT-n as the hot key.


Edited:  Looks like Ray was faster, I did not see his example, but perhaps this text will help explain.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: CloseCommandArea() on menu bar?
Reply #6 - Sep 8th, 2007 at 3:40pm
Print Post Print Post  
I'm familiar with the practice of inserting "&". I've been using that in my command buttons on my custom menu system for quite a while.

I was referring to the shortcut parameter which I've highlighted here:
AddCommandToMenuBar("Command Area/Open", "", "CloseCommandArea(0)")

For instance, if I place an "O" or a "C" there, the Command Area menu will look something like this:
Open          O
Close          C


But I was curious if someone could have it like this:
Open          Alt+O
Close          Alt+C


The goal being that they could simply press Alt+O or Alt+C, without having to first open the Command Area menu, or press a 3 key shortcut like Alt+C+O.

Here are some clips from the programming manual; "shortcut" is the parameter that I'm asking about. The manual doesn't explain much about it.
Quote:
AddCommandToMenubar(command, shortcut , program)

It takes three parameters: The title of the custom menu along with the text of its
selectable item, the shortcut key, if any, and the programming command to run.

  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged