RE: Who can write an inputbox.e?
- Posted by Liu Junfeng <rufi at 163.com> Jan 20, 2003
- 445 views
I am not satisfied with your solution,here is mine: include win32lib.ew without warning integer inputbox,label,entry,ok,cancel sequence Text procedure Click_cancelButton(integer self, integer event, sequence parms) closeWindow( findParentWindow(self) ) end procedure procedure Click_okButton(integer self, integer event, sequence parms) Text=getText(entry) closeWindow( findParentWindow(self) ) end procedure global function input_box(sequence text,sequence title,integer parent) integer Width,Height sequence SrceenSize,controlRect SrceenSize = getCtlSize( Screen ) Width=280 Height=120 Text="" inputbox= create(Window,title,parent,(SrceenSize[1]-Width)/2,(SrceenSize[2]-Height)/2,Width,Height,{WS_CAPTION,WS_BORDER}) label = create(LText,text,inputbox,10,10,200,20,0) entry = create( EditText, "", inputbox, 10, 30, 180, 25, 0 ) ok = create( PushButton, "OK", inputbox, 20, 65, 60, 20, 0 ) cancel= create( PushButton, "Cancel",inputbox, 120, 65, 60, 20, 0 ) setHandler(ok, w32HClick, routine_id( "Click_okButton" )) setHandler(cancel, w32HClick, routine_id( "Click_cancelButton" )) openDialog(inputbox) return Text end function The key point is to use openDialog, not openWindow. Patrick.Barnes at transgrid.com.au wrote: > Create a child window, and the controls inside that (textfield, buttons > etc) > > When you want the user to enter a value, call openWindow(mychildwin) > > To continue once the user has clicked a button (Ok, or Cancel, or > whatever you have put in the window) > have a procedure defined ... for example > > procedure on_click_Cbutton(integer ID, integer Event, sequence params) > > and set the handler for those buttons you defined to point to it: > > setHandler({myokbutton, mycancelbutton}, w32HClick, > routine_id("on_click_Cbutton") ) > > So, when the user clicks a button, the procedure on_click_Cbutton will > be called, so you can stick whatever you want inside of that > procedure... ie > > procedure on_click_Cbutton(integer ID, integer Event, sequence params) > if ID = myokbutton then > data = getText(mytextfield) > closeWindow(mychildwin) > restofmyprogram() > elsif ID = mycancelbutton then > data = "" > closeWindow(mychildwin) > restofmyprogram() > end if > end procedure > > > > Euphoria has a long way to go! > You may be used to VB, but at least our language isn't full of security > holes! > You may be used to C, but at least our language doesn't have so many > different ways of doing things, that reading another person's code can > be next to impossible! > > ...I'll stop now. > > > -----Original Message----- > From: jordah at btopenworld.com [mailto:jordah at btopenworld.com] > Sent: Monday, 20 January 2003 15:22 > To: EUforum > Subject: Re: Who can write an inputbox.e? > > > have u thought of getText().....or EM_GETTEXT? > > Jordah > ----- Original Message ----- > From: "Liu Junfeng" <rufi at 163.com> > To: "EUforum" <EUforum at topica.com> > Sent: Monday, January 20, 2003 3:34 AM > Subject: Who can write an inputbox.e? > > > > just like the message_box() show some message,I'd like an input_box() > > to get some input. > > I can make a window to input some text,but I don't know how to return > > the text. > > > > Euphoria has a long way to go! > > > > > > TOPICA - Start your own email discussion group. FREE! > > > > --- > > > TOPICA - Start your own email discussion group. FREE! > > > *********************************************************************** > > > *********************************************************************** > > Euphoria has a long way to go!