Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with commands from edit box 1

Status
Not open for further replies.

pyutian

IS-IT--Management
Dec 10, 2003
58
US
I am trying to make an edit box that I can type data into and when I hit enter it will transmit the text in the edit box and do a couple of othr things. I can make it work with a push button but I dont want to have ti hit the button every time. Is ther a way to put the focus on the edit box or something? Someone please help.

Here is the sample code:

proc main

dialogbox 0 7 16 672 29 2 "Caption"
editbox 2 20 4 482 20 cmdtext
pushbutton 3 517 5 62 17 "Push"
enddialog

while 1 ; Loop forever.
dlgEvent 0 EventID ; Get dialog EventID.
switch EventID ; Evaluate the EventID.
case 0
endcase
case 2
keyget ikey
if ikey==13
call sndcmd
;usermsg "%d" ikey
endif
endcase
case 3
call sndcmd
endcase
default

exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL
endproc

proc sndcmd
;strfmt cmdtxt "%s^M" cmdtxt
transmit cmdtext
transmit "^M"
cmdtext = ""
main ()
endproc

Thanks
 
If you add the DEFAULT keyword to the end of your pushbutton statement, that should fix you up. This will cause the dialog to close when the Enter key is pressed.

 
Thanks Knob! Sometimes its the simple things that we most often overlook!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top