Normal Topic 2.0 Toggle Table View Menu Bar Item (Read 7472 times)
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
2.0 Toggle Table View Menu Bar Item
Jun 25th, 2007 at 3:06pm
Print Post Print Post  
For those of you who were at my discussion table at the conference on Sunday night, below is the code that I helped Robert Scott create. I promised I would post it up once I got back to the office so here it is.

What it does is create a custom menu bar at the Top of the Sesame window that is labeled Custom and has a choice of Toggle Table View, which toggles the current form in and out of Table View in Search/Update mode. Note: This is 2.0 only code and will not work in the 1.X series of Sesame.

Code
Select All
Function AddQuotes(vVal as String) as String
Var VReturn as String
Var vQuote as Char

	vQuote = @Chr(34)
	vReturn = vQuote + vVal + vQuote
	Return(vReturn)
End Function

AddCommandToMenuBar("Custom/Toggle Table View", "", "GlobalValue(" + AddQuotes("Fake") + ", @SelectTreeItem(" + AddQuotes("Search Update Menu!Other Commands!Toggle Table View (Shift-F6)") + "))") 



-Ray

  

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



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: 2.0 Toggle Table View Menu Bar Item
Reply #1 - Jun 25th, 2007 at 10:01pm
Print Post Print Post  
I'm sure Ray already knows this, but for the rest of you...

You can also have the actual command name directly on the menu bar. This saves the user from having to click once to open the menu, then click again to select the command. Just one click, and the Table View toggles on or off.

To do that, simply change "Custom/Toggle Table View" to "Toggle Table View".
  


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



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: 2.0 Toggle Table View Menu Bar Item
Reply #2 - Jun 26th, 2007 at 12:49am
Print Post Print Post  
I played with this a bit, and found that we don't need the user defined function to make this work. (I'm sure Ray knew that already, but maybe he just found it easier to do it that way; especially with a crowd of people sitting around him, watching while he built this. We all know how difficult it can be to write code when someone is watching what you're doing. Wink)

Without the function, it can all be done in one line of code. (I wish I could also eliminate the need for the global value too, but I couldn't.) The following sample reduces the code to one line, and only requires one mouse click to toggle between modes.

Code
Select All
AddCommandToMenuBar("Toggle Table View", "", "GlobalValue(" + @Chr(34) + "Fake" + @Chr(34) + ", @SelectTreeItem(" + @Chr(34) + "Search Update Menu!Other Commands!Toggle Table View (Shift-F6)" + @Chr(34) + "))" )
 

  


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: 2.0 Toggle Table View Menu Bar Item
Reply #3 - Jun 26th, 2007 at 1:22pm
Print Post Print Post  
Hi Carl,

The original code that was done at the table had the @Chr(34)'s in it but I figured I'd make it slightly easier to understand by using the UDF. Either way works.

-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: 2.0 Toggle Table View Menu Bar Item
Reply #4 - Jul 3rd, 2007 at 5:16am
Print Post Print Post  
For those who were not at that session (including me):

It should also be pointed out that this code needs to be installed in the Application Property Manager / Program Application section.

Also note, that "&" Hot Keys are not currently working on Menu Bars.
« Last Edit: Jul 3rd, 2007 at 8:58pm by Bob_Hansen »  



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: 2.0 Toggle Table View Menu Bar Item
Reply #5 - Jul 3rd, 2007 at 1:53pm
Print Post Print Post  
Bob_Hansen wrote on Jul 3rd, 2007 at 5:16am:
Also note, that "&" Hot Keys are not currently working.

Mine still work okay in command buttons on a form. But, I see what you mean on a menu bar.
  


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: 2.0 Toggle Table View Menu Bar Item
Reply #6 - Jul 5th, 2007 at 10:34pm
Print Post Print Post  
Quote:
What it does is create a custom menu bar at the Top of the Sesame window that is labeled Custom and has a choice of Toggle Table View, which toggles the current form in and out of Table View in Search/Update mode.

This is marvelous, thanks guys!
  

**
Captain Infinity
Back to top
IP Logged