Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Programming Command Buttons (Read 2042 times)
jerry.frazier
Member
*
Offline


No personal text

Posts: 16
Location: Fort Worth, Texas
Joined: Feb 12th, 2004
Programming Command Buttons
Feb 12th, 2004 at 2:25am
Print Post Print Post  
I am trying to set up a form with just command buttons and static text for a menu system.  I cannot find an event that occurs when the button is clicked.  I can make the programming work on a database field, but not on a command button.  I have searched for any example of a working menu, but I cannot find.

Also, has anyone found a way to load a macro under program control?

Thanks
Jerry
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Programming Command Buttons
Reply #1 - Feb 12th, 2004 at 3:23am
Print Post Print Post  
Quote:
I am trying to set up a form with just command buttons and static text for a menu system.  I cannot find an event that occurs when the button is clicked.


You put the code that you want executed when the button is pressed in the on element entry area for  the command button.

See top of page 66 in user manual.

Hope this helps  Smiley

Can you explain what you mean by load a macro under program control?
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
jerry.frazier
Member
*
Offline


No personal text

Posts: 16
Location: Fort Worth, Texas
Joined: Feb 12th, 2004
Re: Programming Command Buttons
Reply #2 - Feb 12th, 2004 at 3:56am
Print Post Print Post  
I have gotten command buttons to work on one of the Quick start applications.  The buttons only work after the first record is returned. 

On my menu system, I have tried to define one field and create a record so that I can return it  to have something that works.  However on the new file, it does nothing when I first open the form.  When I hit F10 to bring in the first record, all of the command buttons are greyed out.  Any ideas about what I am doing wrong?

Thanks,
Jerry
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Programming Command Buttons
Reply #3 - Feb 12th, 2004 at 4:36am
Print Post Print Post  
Quote:
Any ideas about what I am doing wrong?


Jerry,

I am pretty sure nothing will work in search mode. You will have to be in a record. The Lanticans will correct me if I am wrong.

If I understand correctly what you would like to have is a screen with command buttons that act as your menu. I have not yet tried this but I am sure there are pobably numerous methods to accomplish this. The one that pops into my mind first (this does not mean its correct  Undecided) would be to create a form with one element and all of your command buttons. Put a unique word in that element in 1 record (this will always be your starting point)You could use the start up switch that runs a macro that searches for the 1 unique word in the element. The element can be hidden somewhere on your form. With this setup when someone logs in it would bring up the record so you will not be in search mode and then you can control things with Sbasic from command buttons.

This is just a quick thought hopefully to help get you started. Smiley

There are many others out here on the forum that will probably have additional thoughts. In the mean time use the forum search button to search on the word macro. There are many previous posts that discuss these issues.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Programming Command Buttons
Reply #4 - Feb 12th, 2004 at 1:56pm
Print Post Print Post  
On way to do this would be to build the form with the buttons. Then record a macro that takes Sesame into "Add" mode - presenting the form. Save the macro. Then in the Target field of the icon, launch Sesame with:

C:\Sesame\Program\sesame -macro my_macro.mac app.db

where "my_macro.mac" is the recorded macro that goes to "Add" mode and "app.db" is your intended application. This will cause Sesame to load that app and start the macro automatically, taking your user to the button laden form in "Add" mode.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
jerry.frazier
Member
*
Offline


No personal text

Posts: 16
Location: Fort Worth, Texas
Joined: Feb 12th, 2004
Re: Programming Command Buttons
Reply #5 - Feb 13th, 2004 at 3:03am
Print Post Print Post  
Thanks for the ideas.  I am making progress.   I open the menu form in Add Data mode.  I can place commands such as CloseCommandArea(1) behind the button and it works.  I have tried every level of @SelectTreeItem and cannot get it to work from a command button. The complete path is
C:\Sesame\data\tracker\tracker!Forms!Add Data!TrackerMain!MainMenu 
Has anyone gotten @SelectTreeItem to work from a command button.  If so, please tell me where to start in the above path.

This is on a sub menu to return to the main menu.

I have also tried a macro.  I have gotten to the point where when I click the button, the macro loads, but does not run.  After it loads, I can click Macro and Playback and it does what I need. 

Any suggestions would be greatly appreciated.

Jerry
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Programming Command Buttons
Reply #6 - Feb 13th, 2004 at 1:26pm
Print Post Print Post  
I have used @selectTreeItem successfully. I can understand your difficulties as I had gone through the same. The trick is just go one step at a time and let writeln ( ) window gives you feed back. You have to write the name of the item in tree exactly as it appears including whatever is in bracket with shortcut. Since you are starting in Add mode, I will give you some concrete examples, give me little time.
  
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: Programming Command Buttons
Reply #7 - Feb 13th, 2004 at 2:03pm
Print Post Print Post  
Jerry prehaps you misunderstood what I said in the e-mail

@SelectTreeItem() requires the entire path to the button

so in Customers.db to open Search update Countries the code would be
-
success = @SelectTreeItem("COUNTRIES and Cities!Forms!Search/Update!Countries!Countries")
-

and to open Search Update Cities the code would be
-
success = @SelectTreeItem("COUNTRIES and Cities!Forms!Search/Update!Countries!Cities!Cities")
-

I apoligize for the misunderstanding. When I said Application Name I meant Application Title which is displayed as the first folder in the Application menu in Sesame.
  

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


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Programming Command Buttons
Reply #8 - Feb 13th, 2004 at 2:30pm
Print Post Print Post  
Jerry, after having clarification from Ray, I am sure it is clear to you now.
  
Back to top
 
IP Logged
 
jerry.frazier
Member
*
Offline


No personal text

Posts: 16
Location: Fort Worth, Texas
Joined: Feb 12th, 2004
Re: Programming Command Buttons
Reply #9 - Feb 13th, 2004 at 2:43pm
Print Post Print Post  
Thanks for the clarification.  It will be tonight before I will be able to try it.  I have three sites that are wanting their applicatons migrated from Q&A and they all use extensive menus that were developed in Q&A macros and they want the same type interface.

Any clues on the @macro problem I am having where it will load the macro, but not run it?  If I hit F2 it runs and does what I expect.  Some of those menu entries will need to use macros to accomplish what they are expecting.

Thanks so much for your help.

Jerry

  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Programming Command Buttons
Reply #10 - Feb 13th, 2004 at 2:55pm
Print Post Print Post  
Try putting in the full file path to the macro file in the @macro call:

@macro("c:\Sesame\Data\my_macro.mac")

Substitute the actual path to your macro file.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
jerry.frazier
Member
*
Offline


No personal text

Posts: 16
Location: Fort Worth, Texas
Joined: Feb 12th, 2004
Re: Programming Command Buttons
Reply #11 - Feb 13th, 2004 at 4:20pm
Print Post Print Post  
I did put the complete path.  If I leave .mac off, it says that it cannot open the macro.  When I specify the complete path, the macro name appears in the field above indicating that it has loaded, but it does not run.  If I click Menu; Playback it runs and does what I expected.  I can also press F2 and in it will work at least the first time.  It always works by selecting Menu;playback, but does not execute when the Command Button is selected.

Jerry
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Programming Command Buttons
Reply #12 - Feb 13th, 2004 at 4:42pm
Print Post Print Post  
If the macro is loading, there is no condition that will prevent it from running in the @macro function other than some portion of the macro itself failing. That can occur if some portion (near the beginning) of the macro is expecting focus to be on a different element when the macro starts - but when using it from the button, the focus starts on the button instead.

In rough terms, what does this macro do? What are its visible signs of having run? What "mode" is the form in when you press the button?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
jerry.frazier
Member
*
Offline


No personal text

Posts: 16
Location: Fort Worth, Texas
Joined: Feb 12th, 2004
Re: Programming Command Buttons
Reply #13 - Feb 13th, 2004 at 5:18pm
Print Post Print Post  
This is a two level menu system.  The lower level menu is in control in Add Data mode.  When I click the menu button, nothing changes except that the button changes colors for a fraction of a second and the Macro name appears in the box above indicating that was loaded.  When I click Menu and then Playback, the current form closes and the main menu is reloaded.

The macro consisted of : "Close Add Data; Select main menu form; enter"

These forms are all in the same database if that makes a difference.

Jerry

  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Programming Command Buttons
Reply #14 - Feb 13th, 2004 at 5:36pm
Print Post Print Post  
Quote:
The macro consisted of : "Close Add Data; Select main menu form; enter"


Are these command tree items selected in the macro using the mouse or the keyboard?

I just tried a similar macro. It is running and failing. It fails because it can't close a form while form programming on that form is still running. If you watch the command tree carefully, you will see the highlight selecting the tree items.

If you rerecord the macro so that is selects "Application Menu" instead of "Exit Add Data", it should start working.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print