#90776 - 2003-01-03 04:54 PM
Re: KixForms "Feature"
|
Bonji
Starting to like KiXtart
Registered: 2001-09-28
Posts: 169
Loc: Virginia
|
Shawn - To save you a little time you can use this little snippet to test (since I decided to see the behavior). It appears Default cancels Cancel .
code:
BREAK ON $FORM = CREATEOBJECT("KIXTART.FORM") $FORM.SCALEHEIGHT = 50 $FORM.SCALEWIDTH = 100
$BUTTON = $FORM.COMMANDBUTTON("BUTTON") $BUTTON.HEIGHT = 19 $BUTTON.WIDTH = 80 $BUTTON.LEFT = 10 $BUTTON.TOP = 15 $BUTTON.ONCLICK = "CLICK()" $BUTTON.CANCEL = 1 $BUTTON.DEFAULT = 1 ;$BUTTON.CANCEL = 1
$FORM.SHOW WHILE $FORM.VISIBLE $ = EXECUTE($FORM.DOEVENTS) LOOP
FUNCTION CLICK() $ = MESSAGEBOX("HELLO","HELLO") ENDFUNCTION
-Ben http://www.rgcweb.org/kix
|
|
Top
|
|
|
|
#90777 - 2003-01-03 05:55 PM
Re: KixForms "Feature"
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
|
Top
|
|
|
|
#90780 - 2003-01-03 06:25 PM
Re: KixForms "Feature"
|
Bonji
Starting to like KiXtart
Registered: 2001-09-28
Posts: 169
Loc: Virginia
|
In my code if you have the Cancel property set last then the CommandButton is still the default and at the same time ESC will execute the button, too. However, if you set Default after Cancel, then the button executes when enter is hit, but does nothing when ESC is hit. So I'm not sure if they're supposed to be exclusive, but they only are in one circumstance.
-Ben http://www.rgcweb.org/kix
|
|
Top
|
|
|
|
#90783 - 2003-01-03 06:36 PM
Re: KixForms "Feature"
|
Bonji
Starting to like KiXtart
Registered: 2001-09-28
Posts: 169
Loc: Virginia
|
When I add a second button to the script, it then behaves as explained: a button only has the Cancel or Default property depending on which was set last. I cannot get a form with 2 buttons to have one button as Default and Cancel.
[EDIT] After reading Eddie's edit it appears he is correct. You can have a button as Default and Cancel if it is the last button added. I got that functionality when I moved the button that I set those properties on to the bottom of the script.
-Ben http://www.rgcweb.org/kix [ 03. January 2003, 18:40: Message edited by: Ben Dulaney ]
|
|
Top
|
|
|
|
#90785 - 2003-01-03 06:44 PM
Re: KixForms "Feature"
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
It might be because kixforms always does a setfocus to the last control added. But i was playing with this script here where just before the form is displayed, i setfocus to the textbox and i think it doesn't work anymore.
code:
BREAK ON $FORM = CREATEOBJECT("KIXTART.FORM") $TEXTBOX = $FORM.TEXTBOX $TEXTBOX.LOCATION = 10,10 $TEXTBOX.RIGHT = $FORM.CLIENTWIDTH-10 $TEXTBOX.BOTTOM = $FORM.CLIENTHEIGHT / 2 $BUTTON1 = $FORM.COMMANDBUTTON("BUTTON1") $BUTTON1.CENTER $BUTTON1.TOP = $TEXTBOX.BOTTOM+10 $BUTTON1.ONCLICK = '$$=$$FORM.MSGBOX("BUTTON1","")' $BUTTON2 = $FORM.COMMANDBUTTON("BUTTON2") $BUTTON2.CENTER $BUTTON2.TOP = $BUTTON1.BOTTOM+10 $BUTTON2.ONCLICK = '$$=$$FORM.MSGBOX("BUTTON2","")' $BUTTON2.DEFAULT = 1 $BUTTON2.CANCEL = 1 $FORM.SHOW $TEXTBOX.SETFOCUS WHILE $FORM.VISIBLE $ = EXECUTE($FORM.DOEVENTS) LOOP
|
|
Top
|
|
|
|
#90786 - 2003-01-03 06:51 PM
Re: KixForms "Feature"
|
Bonji
Starting to like KiXtart
Registered: 2001-09-28
Posts: 169
Loc: Virginia
|
That makes sense. I'll be able to sleep soundly at work now .
-Ben http://www.rgcweb.org/kix
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 764 anonymous users online.
|
|
|