1. Getting Dialog Button Results?
- Posted by David Owens <daveo at NBNET.NB.CA> Apr 17, 1999
- 306 views
I'm new at Euphoria (like 1 week), but I like how you can easily edit and compile an .exe file, with fairly straightforward language. To learn, I took on a project at work to store data in a database, using a form in a DOS window. I am trying to modify the mydata.ex program to do this, using David Cuny's routines for dialog boxes. I have been successful in creating different modules that work OK by themselves, and a "form", really a large dialog box with SLE fields, default values passed into the function, labels, and a few special buttons on the bottom. My problem is, I can't figure out how to use the results of the button click used to exit the dialog procedure. David's examples end by printing out "you exited with: New" where New is my button name. However, I want to use this button click to decide what to do next. I've tried assigning a variable to the result[1], and it prints with no problems, but I have been unable to get a "If result[1]="New" type of statement to work. Am I doing this correctly, or is the syntax wrong? Is it something to do with the result being stored as ASCII? How do I use the results David's button click routine to branch off where I want? Any help would save my sanity! Dave Owens
2. Re: Getting Dialog Button Results?
- Posted by Lucius Hilley III <lhilley at CDC.NET> Apr 18, 1999
- 310 views
I think you are looking for if compare(result[1], "New") = 0 then OR with version 2.1 if equal(result[1], "New") then On Sat, 17 Apr 1999 18:03:28 -0300, David Owens <daveo at NBNET.NB.CA> wrote: >I'm new at Euphoria (like 1 week), but I like how you can easily edit and >compile an .exe file, with fairly straightforward language. > >To learn, I took on a project at work to store data in a database, using a >form in a DOS window. > >I am trying to modify the mydata.ex program to do this, using David Cuny's >routines for dialog boxes. I have been successful in creating different >modules that work OK by themselves, and a "form", really a large dialog box >with SLE fields, default values passed into the function, labels, and a few >special buttons on the bottom. > >My problem is, I can't figure out how to use the results of the button click >used to exit the dialog procedure. David's examples end by printing out >"you exited with: New" where New is my button name. However, I want to use >this button click to decide what to do next. > >I've tried assigning a variable to the result[1], and it prints with no >problems, but I have been unable to get a "If result[1]="New" type of >statement to work. > >Am I doing this correctly, or is the syntax wrong? Is it something to do >with the result being stored as ASCII? How do I use the results David's >button click routine to branch off where I want? > >Any help would save my sanity! > >Dave Owens
3. Re: Getting Dialog Button Results?
- Posted by Jeff Zeitlin <jzeitlin at CYBURBAN.COM> Apr 18, 1999
- 305 views
On Sun, 18 Apr 1999 00:01:49 -0400, David Owens <daveo at NBNET.NB.CA> wrote: >I've tried assigning a variable to the result[1], and it prints with no >problems, but I have been unable to get a "If result[1]=3D"New" type of >statement to work. >Am I doing this correctly, or is the syntax wrong? Is it something to do >with the result being stored as ASCII? How do I use the results David's >button click routine to branch off where I want? You can't use "=3D" in a comparison with a string; you have to use the compare() function: if compare(result[1],"New")=3D0 then blah, blah, blah end if compare() returns -1 if the first argument is less than the second argument, 0 if they are equal, or 1 if the first argument is greater than the second argument. "=3D" applied to strings (sequences) returns a sequence of 1s and 0s where each element is a 1 if the corresponding elements in the two sequences are the same, and 0 if they are not. So, "ABC"=3D"aBC" will return a sequence {0,1,1}. Sequences are not valid for IF tests, so your program bombs. -- Jeff Zeitlin jzeitlin at cyburban.com