1. 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!

new topic     » topic index » view message » categorize

2. 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>
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!
> 


---

new topic     » goto parent     » topic index » view message » categorize

3. Re: Who can write an inputbox.e?

Liu,

Interesting!
I was trying to create something like what you wanted, but couldn't (not too
surprising); and I never saw "openDialog", sigh.


Dan Moyer

----- Original Message -----
From: "Liu Junfeng" <rufi at 163.com>
To: "EUforum" <EUforum at topica.com>
Sent: Monday, January 20, 2003 12:48 AM
Subject: RE: Who can write an inputbox.e?


>
> 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! tongue
> > 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! tongue
> >
> > ...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!
> >
> >
> > ***********************************************************************
> >
> >
> > ***********************************************************************
> >
> >
<snip>

>
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: Who can write an inputbox.e?

On Mon, 20 Jan 2003 08:48:41 +0000, Liu Junfeng <rufi at 163.com> wrote:

>I am not satisfied with your solution,here is mine:

Your program works just fine, no worries, really, but:
Some comments about this:
>
>include win32lib.ew
>without warning
>integer inputbox,label,entry,ok,cancel
define these as constants, see below
>sequence Text
>procedure Click_cancelButton(integer self, integer event, sequence=20
>parms)
>    closeWindow( findParentWindow(self) )
>end procedure
>
>procedure Click_okButton(integer self, integer event, sequence parms)
>    Text=3DgetText(entry)
>    closeWindow( findParentWindow(self) )
>end procedure
>global function input_box(sequence text,sequence title,integer parent)
These lines...
>       integer Width,Height
>       sequence SrceenSize,controlRect
>           SrceenSize =3D getCtlSize( Screen )
>           Width=3D280
>           Height=3D120
  ....to here
>       Text=3D""
.. and these...=20
>       inputbox=3D=20
>create(Window,title,parent,(SrceenSize[1]-Width)/2,(SrceenSize[2]-Height=
)/2,Width,Height,{WS_CAPTION,WS_BORDER})
>
>       label =3D create(LText,text,inputbox,10,10,200,20,0)
>       entry =3D create( EditText, "", inputbox, 10, 30, 180, 25, 0 )
>       ok    =3D create( PushButton, "OK", inputbox, 20, 65, 60, 20, 0 )
>       cancel=3D create( PushButton, "Cancel",inputbox, 120, 65, 60, 20,=
 0=20
>)
>       setHandler(ok, w32HClick, routine_id( "Click_okButton" ))
>       setHandler(cancel, w32HClick, routine_id( "Click_cancelButton" ))
 ... should be moved out of this function and defined as constants to
avoid memory leak if this routine is called repeatedly. You will need
to have
	setText(inputbox,title)
	setText(lable,text)
... hmm, parent, there is no way I know of switching parent - do you
need this/what benefits does it give you?
>       openDialog(inputbox)
>return  Text
>end function
>
>The key point is to use openDialog, not openWindow.
Suppose I should confess I've always got by on/am a huge fan of
setVisible & setFocus...  another story. (I know the differences!)
>
Like I say, the above works fine; if the above suggested mods cause
problems, then maybe just let sleeping dogs lie. If you intend to use
it alot in the future though, the above advice stands.

Pete
PS maybe a destroy(inputbox) prior to each time calling input_box
would be same, no experience hereblink Anyone?

new topic     » goto parent     » topic index » view message » categorize

5. Re: Who can write an inputbox.e?

Liu,

1.  Although I'm a poor judge, if you just got to know Euphoria only ten
days ago, I'd say you're doing *exceptionally* well, & I hope we see many
useful code contributions from you!

2.  Your improved inputbox.ew is missing the code doing the creation of the
inputbox.  (That was one of the problems I had when I tried to do it in
response to your question: ie, making a window that was child of the main
window, before the main was created.)

3.  You "copyrighted" your code; did you mean that no one may use your code
without your express permission?  I think many people don't understand that
"copyright" does NOT mean "this code was created by me", but rather "I, the
creator of this code, restrict the right to copy this code without my
express permission".  In other words, "copyright" means "having the right to
copy", and restricts that right to the author and any persons expressly
given that right *by* the author.

4.  I think most people on this list know that Euphoria (and various
libraries like Win32Lib and utilities like the IDE) need improvement, and
many are in one way or another working to help with that improvement; so
your "Euphoria has a long way to go!" message is at the somewhat superfluous
at best.

Water is Wet!
Fire is Hot!
Ice is Cold!
Sand is Abrasive!

Dan Moyer

----- Original Message -----
From: "Liu Junfeng" <rufi at 163.com>
To: "EUforum" <EUforum at topica.com>
Sent: Tuesday, January 21, 2003 12:37 AM
Subject: RE: Who can write an inputbox.e?


>
>
> Pete Lomax wrote:
> > Some comments about this:
> > >
> > >
> > Like I say, the above works fine; if the above suggested mods cause
> > problems, then maybe just let sleeping dogs lie. If you intend to use
> > it alot in the future though, the above advice stands.
> >
> > Pete
> > PS maybe a destroy(inputbox) prior to each time calling input_box
> > would be same, no experience hereblink Anyone?
> >
> >
> I got to know Euphoria only ten days ago,so I havn't much experience.
> Here is my modified code:
> -- inputbox.ew - open an inputbox
> -- Copyright (C) 2003  Liu Junfeng
> -- If you wish to contact me, send an e-mail to rufi at 163.com
>
> include win32lib.ew
> without warning
>
> constant Width=280,Height=120
> sequence ScreenSize,Text
> ScreenSize = getCtlSize( Screen )
> constant inputbox=
> ]-Width)/2,(ScreenSize[2]-Height)/2,Width,Height,{WS_CAPTION,WS_BORDER},
> WS_EX_TOPMOST),
>          label   = create(LText,"",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 )
> procedure Click_Button(integer self, integer event, sequence parms)
>     if self=ok then Text=getText(entry)
>     else Text=""  end if
>     closeWindow( inputbox )
> end procedure
> setHandler({ok,cancel}, w32HClick, routine_id( "Click_Button" ))
> global function input_box(sequence text,sequence title,integer parent)
>        setText(label,text)
>        setText(inputbox,title)
>        openDialog(inputbox)
> return  Text
> end function
>
> Euphoria has a long way to go!
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>

new topic     » goto parent     » topic index » view message » categorize

6. Re: Who can write an inputbox.e?

Sigh.

When I wrote to Liu:
> your "Euphoria has a long way to go!" message is at the somewhat
superfluous
> at best.
>

I meant:
your "Euphoria has a long way to go!" message is somewhat superfluous.

Dan Moyer

new topic     » goto parent     » topic index » view message » categorize

7. Re: Who can write an inputbox.e?

Liu responded:

> Dan Moyer wrote:
> > Liu,
> >
<snip>
> > 2.  Your improved inputbox.ew is missing the code doing the creation of
> > the
> > inputbox
<snip>> >

> That is an unexpected error of IE, not my original code.

Well, no one can be very surprised by errors in IE!  :)   Can you re-send
your code for inputbox.ew?

>
> > 3.  You "copyrighted" your code; did you mean that no one may use your
> > code
> > without your express permission?  I think many people don't understand
> > that
> > "copyright" does NOT mean "this code was created by me", but rather "I,
> > the
> > creator of this code, restrict the right to copy this code without my
> > express permission".  In other words, "copyright" means "having the
> > right to
> > copy", and restricts that right to the author and any persons expressly
> > given that right *by* the author.
> >
> I am not a native speaker of English, anyone can use my code freely,
> only to know who coded it.

I think I've seen other people, probably native English speakers,  also use
"copyright" in code they almost certainly meant to be freely useable,
presumbly thinking it meant "written by"; perhaps this post will help end
that misunderstanding.

By the way, welcome to the Euphoria community :)

Dan Moyer

new topic     » goto parent     » topic index » view message » categorize

8. Re: Who can write an inputbox.e?

Liu,

Ok, I'm confused:

> > constant inputbox=
>
>createEx(Window,"",0,(ScreenSize[1]-Width)/2,(ScreenSize[2]-Height)/2,Width
,Height,{WS_CAPTION,WS_BORDER},

makes the inputbox the *main* window, whereas the intention would be to be
able to use the function to put an inputbox in (& child of) another window,
right?

This was one of the difficulties I had when I tried to do make an inputbox
include, namely that the included code should preferably be able to be
placed near the beginning of a program, so it could be used whenever
desired, but because it would have to be able to make the inputbox window be
a child of another window, it would have to be placed *after* that window
was created (and after *any* window that might want to use it).  Somehow
messagebox avoids that requirment!?!

 (The other difficulty I had was solved when you used "openDialog".)


Dan Moyer

new topic     » goto parent     » topic index » view message » categorize

9. Re: Who can write an inputbox.e?

On Wed, 22 Jan 2003 03:18:47 -0800, Dan Moyer
<DANIELMOYER at prodigy.net> wrote:

>makes the inputbox the *main* window, whereas the intention would be to =
be
>able to use the function to put an inputbox in (& child of) another =
window,
>right?
>
>This was one of the difficulties I had when I tried to do make an =
inputbox
>include, namely that the included code should preferably be able to be
>placed near the beginning of a program, so it could be used whenever
>desired, but because it would have to be able to make the inputbox =
window be
>a child of another window, it would have to be placed *after* that =
window
>was created (and after *any* window that might want to use it).

Hmm... I mentioned this before as I was not sure, but got no answer...

>Somehow messagebox avoids that requirment!?!

Can you explicitly state the problems with a dialogue not being the
child of a specific window?

Pete

new topic     » goto parent     » topic index » view message » categorize

10. Re: Who can write an inputbox.e?

Pete,

Hmm,

Well, I'm thinking that the problem isn't exactly that a dialog (for an
inputBox) would have to create the inputbox as a child of a specific window,
but rather that Liu's inputbox was the *main* window, which would seem to be
undesirable.  The "messageBox" function somehow gets around having to make
it an (explicit?) child of some window, but that's apparently by a wrap of a
call to a .dll.

Could easily be I'm way off base here & am missing something obvious.

Dan Moyer

----- Original Message -----
From: "Pete Lomax" <petelomax at blueyonder.co.uk>
To: "EUforum" <EUforum at topica.com>
Sent: Wednesday, January 22, 2003 3:54 PM
Subject: Re: Who can write an inputbox.e?



On Wed, 22 Jan 2003 03:18:47 -0800, Dan Moyer
<DANIELMOYER at prodigy.net> wrote:

>makes the inputbox the *main* window, whereas the intention would be to be
>able to use the function to put an inputbox in (& child of) another window,
>right?
>
>This was one of the difficulties I had when I tried to do make an inputbox
>include, namely that the included code should preferably be able to be
>placed near the beginning of a program, so it could be used whenever
>desired, but because it would have to be able to make the inputbox window
be
>a child of another window, it would have to be placed *after* that window
>was created (and after *any* window that might want to use it).

Hmm... I mentioned this before as I was not sure, but got no answer...

>Somehow messagebox avoids that requirment!?!

Can you explicitly state the problems with a dialogue not being the
child of a specific window?

Pete

==^^===============================================================
This email was sent to: DANIELMOYER at prodigy.net


TOPICA - Start your own email discussion group. FREE!

new topic     » goto parent     » topic index » view message » categorize

11. Re: Who can write an inputbox.e?

Don,

It was Liu who actually wanted the inputbox.e, I was just commenting about
it after I tried unsuccessfully to make one.

Dan

----- Original Message -----
From: "Don Phillips" <EuNexus at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: Who can write an inputbox.e?


>
> > Pete,
> >
> > Hmm,
> >
> > Well, I'm thinking that the problem isn't exactly that a dialog (for an
> > inputBox) would have to create the inputbox as a child of a specific
> > window,
> > but rather that Liu's inputbox was the *main* window, which would seem
> > to be
> > undesirable.  The "messageBox" function somehow gets around having to
> > make
> > it an (explicit?) child of some window, but that's apparently by a wrap
> > of a
> > call to a .dll.
>
> I think it was stated earlier that a normal message box worked as
> intended, but it had no field for entering or returning data.
>
> If on one hand you would like to code it from scratch, I would look up
> the API call CreateDialogIndirect which creates a modeless dialog box
> from a dialog box template in memory...
>
> Or, it is possible to add controls to just about anything, including
> built in dialogs.  I do not have time to code up an example tonight, but
> it seems the easier solution would be to create an ok/cancel message box
> and add a text field to it.
>
> If you would like a working example, let me know and I will code
> something up in the next couple of days.
>
> Don
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>

new topic     » goto parent     » topic index » view message » categorize

12. Re: Who can write an inputbox.e?

> If you would like a working example, let me know and I will code 
> something up in the next couple of days.
> Don

Love to see it,
... *especially* if it was 'wrapped' without the need for win32lib-eaze.

I'm not always very good at 'structures containing structures containing
pointers to structures'

Wolf

D:\Test\Crush\filenametest.exw:59
unknown command
jk = c_func(xGetOpenFileName,{ofn_ptr}) then quit  blink
                                                                             ^

new topic     » goto parent     » topic index » view message » categorize

13. Re: Who can write an inputbox.e?

> Well it turned out ok.  It works as intended, but I forgot that the 
> standard message box comes with a beep.  Oh well, cant win them all...

Very nice example, Don,
and I ( had to ) check that NewEditHWND was actually being destroyed    ;)

new topic     » goto parent     » topic index » view message » categorize

14. Re: Who can write an inputbox.e?

Don,

Neat!!

I had to change:
CreateWindow = define_c_func( Lib1, "CreateWindowExA",
,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG},
C_LONG ),

to:
CreateWindow = define_c_func( Lib1, "CreateWindowExA",
{C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LON
G,C_LONG},
C_LONG ),

to get it to work, hope that's correct??
(added two more "C_LONG" & a "{" )

Hope Liu likes it when he returnes from Spring Festival.

Dan Moyer


----- Original Message -----
From: "Don Phillips" <EuNexus at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Sent: Thursday, January 23, 2003 7:48 PM
Subject: RE: Who can write an inputbox.e?


>
>
> Wolf wrote:
> > > If you would like a working example, let me know and I will code
> > > something up in the next couple of days.
> > > Don
> >
> > Love to see it,
> > ... *especially* if it was 'wrapped' without the need for win32lib-eaze.
> >
> > I'm not always very good at 'structures containing structures containing
> > pointers to structures'
> >
> > Wolf
>
> Well it turned out ok.  It works as intended, but I forgot that the
> standard message box comes with a beep.  Oh well, cant win them all...

new topic     » goto parent     » topic index » view message » categorize

15. Re: Who can write an inputbox.e?

I wroe similar thing for me: message box which coutndowns 10 seconds and
selected default button if no button was pressed in this time. It calculates
width of message box and all. For win32lib.

----- Original Message -----
From: "Dan Moyer" <DANIELMOYER at prodigy.net>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Who can write an inputbox.e?


>
> Don,
>
> Neat!!
>
> I had to change:
> CreateWindow = define_c_func( Lib1, "CreateWindowExA",
> ,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG},
> C_LONG ),
>
> to:
> CreateWindow = define_c_func( Lib1, "CreateWindowExA",
>
{C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LONG,C_LON
> G,C_LONG},
> C_LONG ),
>
> to get it to work, hope that's correct??
> (added two more "C_LONG" & a "{" )
>
> Hope Liu likes it when he returnes from Spring Festival.
>
> Dan Moyer
>
>
> ----- Original Message -----
> From: "Don Phillips" <EuNexus at yahoo.com>
> To: "EUforum" <EUforum at topica.com>
> Sent: Thursday, January 23, 2003 7:48 PM
> Subject: RE: Who can write an inputbox.e?
>
>
> > Wolf wrote:
> > > > If you would like a working example, let me know and I will code
> > > > something up in the next couple of days.
> > > > Don
> > >
> > > Love to see it,
> > > ... *especially* if it was 'wrapped' without the need for
win32lib-eaze.
> > >
> > > I'm not always very good at 'structures containing structures
containing
> > > pointers to structures'
> > >
> > > Wolf
> >
> > Well it turned out ok.  It works as intended, but I forgot that the
> > standard message box comes with a beep.  Oh well, cant win them all...
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu