Hot Topic (More than 10 Replies) Custom Menu System (Read 1709 times)
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Custom Menu System
Aug 20th, 2004 at 11:20am
Print Post Print Post  
I know this topic has come up before, but I don't remember seeing an answer this question:
Has anyone found a way to return to their "Custom Menu" form automatically after a 2nd form has been closed?
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Custom Menu System
Reply #1 - Aug 21st, 2004 at 11:18am
Print Post Print Post  
You can put a custom Close button on your Form that runs the necessary @SelectTreeItem calls.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Custom Menu System
Reply #2 - Aug 22nd, 2004 at 1:34am
Print Post Print Post  
That works well... with one exception. I can't seem to make the 2nd form close.

If I place @exit in the code for the command button, it takes me to my custom "Menu" form, but instantly exits that form, bringing me to the Application Menu, and leaving the 2nd form still open as a tab at the bottom.

BTW, placing @exit before @SelectTreeItem like outlined below, causes a crash when run while the custom "Menu" form is NOT open already. (Don't know why it works if "Menu" form is open. It shouldn't matter, should it?)
Code
Select All
var success as Int

@exit

success = @SelectTreeItem("Price List!Forms!Search/Update!Price List!MENU")
 


If @exit is placed after @SelectTreeItem, it does not crash, but it functions otherwise (as I would expect in this case) as described above. So it doesn't matter where I place @exit, it always executes after @SelectTreeItem.

When that didn't work, I tried to use @SelectTreeItem rather than @exit to get out of the 2nd form. But both success = @SelectTreeItem("Search Menu!Exit Search Menu") and success = @SelectTreeItem("Add Data Menu!Exit Add Data") do nothing even though they return "1" indicating that they were each successful from their respective modes. And success = @SelectTreeItem("Search Update Menu!Exit Search/Update") only causes Sesame to highlight that selection in blue, it does not execute it. This also returns a "1".

I was able to close the 2nd form from a command button using @macro. But that is not acceptable because popup warnings are deactivated during macro playback, and any changes or updates in the form may be lost because there is no warning, the macro just blindly exits. (That reminds me. @exit is not a good solution anyway, since it exit without saving changes.) I wonder, if @SelectTreeItem functioned properly on the various exit selections, would it give a warning that changes had not yet been saved?

Can you check to see if @SelectTreeItem exits you out of a form? Is it something that I am doing wrong or is this a minor bug?

Thanks.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Custom Menu System
Reply #3 - Aug 22nd, 2004 at 5:38pm
Print Post Print Post  
Carl,

I just added a new SBasic command "SetDefaultTab" and "ClearDefaultTab" that sets/clears the tab that comes up when the current tab is closed, either by @exit or by hitting Escape. If you set it to the current tab, it effectively disables the escape key.

It will be in the next release, subject to testing, etc...
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Custom Menu System
Reply #4 - Aug 22nd, 2004 at 6:11pm
Print Post Print Post  
Carl,

In addition to Mark's comment above, to answer your other questions:

1. @SelectTree Item cannot close the tab you are on. Special provision is made to allow @Exit and macros to close the current form. Programming is tightly bound to a Form, so closing a Form while it is running its programming is very bad. If you do this with a macro, make sure you use @DeferredMacro.

2. Regarding your issue where doing this with a macro won't work because of the confirmation popup, an SBasic method would have the same problem.  On your Close button code, check @Modified yourself. If the Form has unsaved changes, don't call the macro. Or use @SelectTreeItem to save the Form.

3. Regardless of where you call @Exit in your code, it is always deferred until the rest of your code is finished, to avoid closing the Form with programming stil left to run.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Custom Menu System
Reply #5 - Aug 23rd, 2004 at 10:53am
Print Post Print Post  
Mark,
AWESOME! That's exactly what we need to make custom menus more seamless! Great idea!


Erika,
Quote:
1. @SelectTree Item cannot close the tab you are on... closing a Form while it is running its programming is very bad.

Makes good sense.


Quote:
2. ...On your Close button code, check @Modified yourself. If the Form has unsaved changes, don't call the macro. Or use @SelectTreeItem to save the Form.

Excellent! I should have thought of that. Tongue


Quote:
3. Regardless of where you call @Exit in your code, it is always deferred until the rest of your code is finished...

If it's always deffered, then do either of you have an idea why it crashes Sesame if it's place before @SelectTreeItem, but not if it's placed after it?
  


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: Custom Menu System
Reply #6 - Aug 23rd, 2004 at 11:09am
Print Post Print Post  
I was wondering, is it safe to backup an application while there are open forms displaying data?

I know changes that have not yet been committed on an open form probably won't make it into the backup copy, but other than that, will everthing copy safely?
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Custom Menu System
Reply #7 - Aug 23rd, 2004 at 11:34am
Print Post Print Post  
Quote:
If it's always deffered, then do either of you have an idea why it crashes Sesame if it's place before @SelectTreeItem, but not if it's placed after it?


I'm not sure. It does not seem to happen in 1.0.5, or possibly because of differences in the application. In any case if you use @SelectTreeItem to change what form you are viewing and you call @exit (either before or after), you are likely to be exiting the newly viewed form, not the one that launched the program. It may be going down because the the newly viewed form also has programming, and gets closed while that programming is running (which causes the program to suddenly and blindly lose context). I'll give that a try with 1.0.5.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Custom Menu System
Reply #8 - Aug 23rd, 2004 at 11:43am
Print Post Print Post  
Quote:
I was wondering, is it safe to backup an application while there are open forms displaying data?

I know changes that have not yet been committed on an open form probably won't make it into the backup copy, but other than that, will everthing copy safely?


Yes. So long as you are absolutely sure that it is not in active use. That isn't too difficult standalone, but in a client/server environment, it is necessary that everyone take their hands off of their keyboards for a moment. Even with several users, it is unlikely that you will coincide with a write operation. They tend to be very brief. The files are only open when actively being read or written. They are only read during initial loading. Only changes are written, in runtime Sesame during normal operation - so the write operations are very brief.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Custom Menu System
Reply #9 - Aug 23rd, 2004 at 10:35pm
Print Post Print Post  
Good, that's what I wanted to hear. 8)  I only run standalone, so I should be fine.

Considering that making a backup copy while a form is open is safe, then I guess I don't really need to close my forms. Thinking that they needed to be closed before making a backup is what started this message topic. But I do like VERY MUCH that you have added the ability to set a default tab. This will solve the concern that some of the other users/consultants have had regarding the "confusing menu tree" for data entry personel. SetDefaultTab will provide a seamless way to return users to a custom "Main Menu" form when they press the Escape key. I LOVE IT! Smiley

Even though I am my own data entry user and I understand the menu tree, I still like to set up custom menus for myself because it's more convenient and faster for me to get straight to the forms & functions I use most. I am very much in the habit (because of Q&A) of pressing Escape to get me out of a form and back to my custom menu(s), so this new function will help me greatly.

Thank you for making Sesame better and better all the time.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Custom Menu System
Reply #10 - Aug 24th, 2004 at 12:08pm
Print Post Print Post  
The next release will also include some features involving the menu tree which you consultant types should like quite a bit.  Wink
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged