Normal Topic Trouble Getting Focus (Read 1304 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Trouble Getting Focus
Feb 3rd, 2004 at 3:56pm
Print Post Print Post  
I am trying to go from a form in add mode, and Load Retrieve Spec. My Debugging has been successful, Form loads in Search mode, however empty (without retrieve specification) and WriteLn Window states "Retrieve Spec Loaded", however, I come to find out the Retrieve Spec is loading into open form in Add Data instead of Search Form. Obviously I am not getting the Focus of the Form in the Search Mode.  

Following is the Code I am Placing in Command Button in Element Entry event.  My staring point is open form in add data mode.

var vSuccess as Int
           
     vSuccess = @SelectTreeItem ("Add Data Menu!Application Menu")
                             VSuccess = @SelectTreeItem ("NewSesameApplication!Forms!Search/Update!NewDatabase!NewForm")

     If vSuccess = 1 then
           //Writeln ("Gone into Another Tree")

           
vSuccess = @LoadRetrieveSpec ("stumps")

if vSuccess = 1 then
           Writeln ("Retrieve Spec Successfully Loaded")

Can someone pointout what am I doing wrong? I want to keep Form open in Add Mode, because I have all the intention to work on it, once I have completed looking into Retrieved Data.
  
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: Trouble Getting Focus
Reply #1 - Feb 3rd, 2004 at 5:43pm
Print Post Print Post  
Something is obviously wrong. There is no retrieve spec choice in Spec Manager of Add Data mode.  How Retrieve Spec can be Loaded in Add Data mode of the Form? ???   ???  
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Trouble Getting Focus
Reply #2 - Feb 3rd, 2004 at 6:35pm
Print Post Print Post  
Found and fixed. The fix will be in 1.0.2. The problem is that it was writing the spec to the wrong form. All you will need to do (in 1.0.2) is:

vSuccess = @LoadRetrieveSpec("r_spec_name")

and then use SelectTreeItem to kick off the retrieve. It will switch forms automagically to the retrieve form of the add/update you are on. If you need it to open an unrelated form, open the add/update mode for that form and load the retrieve from there.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
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: Trouble Getting Focus
Reply #3 - Feb 3rd, 2004 at 6:50pm
Print Post Print Post  
Thanks Mark,   I was going nuts, thinking I was doing something wrong.  Appreciate your help and input always.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Trouble Getting Focus
Reply #4 - Feb 3rd, 2004 at 6:58pm
Print Post Print Post  
I'm not exactly sure what you are trying to do, but you might consider using macros. I just recorded one that went from Add/Update mode into Retrieve mode, set the city LE to "Par.." and retrieved the two matching records (in the Customers.db).

I know I usually lean toward SBasic instead of macros, but a similar technique might get you past this problem and be an okay workaround until 1.0.2.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
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: Trouble Getting Focus
Reply #5 - Feb 3rd, 2004 at 9:34pm
Print Post Print Post  
Quote:
I'm not exactly sure what you are trying to do, but you might consider using macros. 
I know I usually lean toward SBasic instead of macros, but a similar technique might get you past this problem and be an okay workaround until 1.0.2.



I am not in hurry. I will wait until version 1.02 comes out.  I rather not use Macros as eventhough it works now, a little change in application or tree will throw it off.  Thank you for your concern.  I like automation by programming a lot and believe I shall be able to achieve it using programming in the most part if not exclusively.

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



Posts: 2530
Joined: Nov 22nd, 2002
Re: Trouble Getting Focus
Reply #6 - Feb 3rd, 2004 at 9:56pm
Print Post Print Post  
I agree about macros. To compensate somewhat for their shortcomings when it comes to design changes, some recorded events do not store the location of the element, but an identifier of the element (not foolproof).

Try this (for fun): go into Customers.db and record a macro that clicks on the Company LE in the retrieve form and fills in the value "Hunts". Save the macro. Go into SDesigner and switch the positions of Company and City. Save to a new .db. Go into the new .db in Sesame and go to the retrieve form, load and run the macro. It goes and finds the "Company" LE.

I believe that events involving the command tree work in a similar way - so we can add to the command tree and most macros using it should continue to work so long as the selected item is still there.

Macros will probably always take a backseat to SBasic for critical automation tasks - but they can be a lot of fun and very useful. For example, did you know that you can issue an "Exit" from the File pulldown in Sesame while recording a macro. Sesame will record that you want to exit - but won't really exit while recording - that way you can stop recording and save your macro. Then you can create a batch file (.bat file) that invokes Sesame using the -macro flag and turn Sesame into a batch processor. On each line, Sesame will be invoked, load the .db file, load and run the macro - and then exit - so the next line in the .bat file can run.

i.e.:

sesame -macro my_mac.mac db_file1.db
sesame -macro my_mac.mac db_file2.db
sesame -macro my_mac.mac db_file3.db
sesame -macro my_mac.mac db_file4.db
sesame -macro my_mac.mac db_file5.db
sesame -macro my_mac.mac db_file6.db

causing Sesame to operate on a series of .db files all using the same macro.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
FSGROUP
Full Member
***
Offline


No personal text

Posts: 179
Location: Edmonton, Alberta, Canada
Joined: Jan 14th, 2004
Re: Trouble Getting Focus
Reply #7 - Feb 9th, 2004 at 6:21pm
Print Post Print Post  
I am trying to use a command button to a) load a retrieve spec and b) use SelectTreeItem to execute it

but i discovered that the code for the button will only execute after i perform a search. i would like it to run when the form is empty and i simply click the button

thanx



  
Back to top
IP Logged
 
FSGROUP
Full Member
***
Offline


No personal text

Posts: 179
Location: Edmonton, Alberta, Canada
Joined: Jan 14th, 2004
Re: Trouble Getting Focus
Reply #8 - Feb 9th, 2004 at 7:32pm
Print Post Print Post  
to add to my last post, I'm noticing that command buttons don't execute when in Search/Update mode, only when in Add Mode or after a search is performed.
that makes for rather an inconvenience, no?
  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Trouble Getting Focus
Reply #9 - Feb 9th, 2004 at 7:49pm
Print Post Print Post  
No event programming runs while filling out a search spec, only retrieve spec programming.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged