1. inputbox
- Posted by =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> Jul 25, 2000
- 423 views
------=_NextPart_000_0007_01BFF659.E7137EC0 charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable how do i make inputbox function with Win32Lib? object text text=3Dinputbox() it will return text when user presses ok, or 0 if user presses cancel = button. ------=_NextPart_000_0007_01BFF659.E7137EC0 charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-2" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DVerdana size=3D2>how do i make inputbox function with=20 Win32Lib?</FONT></DIV> <DIV><FONT face=3DVerdana size=3D2>object text</FONT></DIV> <DIV><FONT face=3DVerdana size=3D2>text=3Dinputbox()</FONT></DIV> <DIV><FONT face=3DVerdana size=3D2>it will return text when user presses = ok, or 0 if=20 ------=_NextPart_000_0007_01BFF659.E7137EC0--
2. Re: inputbox
- Posted by Matthew Lewis <MatthewL at KAPCOUSA.COM> Jul 26, 2000
- 422 views
-----Original Message----- From: =A9koda >how do i make inputbox function with Win32Lib? >object text >text=3Dinputbox() >it will return text when user presses ok, or 0 if user presses cancel button. There's no real way to do this (yet). The proper way to do it would be = to use a dialog box (CreateDialog, etc--see msgbox.e), which isn't wrapped = into win32lib yet. I came up with a hack a while back, which allows you to = run extra event loops within the main loop. Then you can create a separate window with your input box. Include the code below, and use a function to 'wrap' the input box = function. The pseudocode for the input box would look something like this: function inputbox run event loop check status (pressed cancel, ok, etc) return value end function -- Begin Code -- Allows extra event loops to be run! sequence EventLoopExit =20 EventLoopExit =3D {} global procedure EventLoop( integer id, integer style ) -- main routine=20 atom hWnd atom msg atom ele =20 -- allocate a message buffer =20 msg =3D allocate_struct(SIZEOF_MESSAGE) =20 EventLoopExit &=3D 0 ele =3D length(EventLoopExit) openWindow( id, style ) -- message loop while c_func( xGetMessage, { msg, NULL, 0, 0 } ) and not EventLoopExit[ele] do c_proc( xTranslateMessage, { msg } ) c_proc( xDispatchMessage, { msg } ) end while =20 free(msg) =20 EventLoopExit =3D EventLoopExit[1..ele-1] end procedure -- Back to original program ------------------------------------------------------------------ global procedure ExitEventLoop() =20 if length(EventLoopExit) then EventLoopExit[length(EventLoopExit)] =3D 1 end if end procedure -- End Code
3. Re: inputbox
- Posted by =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> Jul 26, 2000
- 415 views
- Last edited Jul 27, 2000
> -- message loop > while c_func( xGetMessage, { msg, NULL, 0, 0 } ) and not > EventLoopExit[ele] do if msg.message=WM_COMMAND then .... end if > c_proc( xTranslateMessage, { msg } ) > c_proc( xDispatchMessage, { msg } ) > end while why can't we process messages directly withing this loop? then it would be similar to dos programming, where you handle user actions in one big loop. WndProc just complicates things up. why is this in windows that way?
4. Re: inputbox
- Posted by Bernie <xotron at PCOM.NET> Jul 26, 2000
- 422 views
On Wed, 26 Jul 2000 21:40:16 +0200, =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> wrote: >> -- message loop >> while c_func( xGetMessage, { msg, NULL, 0, 0 } ) and not >> EventLoopExit[ele] do > if msg.message=WM_COMMAND then > .... > end if >> c_proc( xTranslateMessage, { msg } ) >> c_proc( xDispatchMessage, { msg } ) >> end while > >why can't we process messages directly withing this loop? then it would be >similar to dos programming, where you handle user actions in one big loop. >WndProc just complicates things up. why is this in windows that way? I think you are forgeting that more than one application can be running at the same time in windows and each application has a window's procedure so that windows can send the message to the proper application window.
5. Re: inputbox
- Posted by =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> Jul 27, 2000
- 411 views
----- Original Message ----- From: Bernie <xotron at PCOM.NET> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Wednesday, July 26, 2000 11:03 PM Subject: Re: inputbox > On Wed, 26 Jul 2000 21:40:16 +0200, =?iso-8859-2?B?qWtvZGE=?= > <tone.skoda at SIOL.NET> wrote: > > >> -- message loop > >> while c_func( xGetMessage, { msg, NULL, 0, 0 } ) and not > >> EventLoopExit[ele] do > > if msg.message=WM_COMMAND then > > .... > > end if > >> c_proc( xTranslateMessage, { msg } ) > >> c_proc( xDispatchMessage, { msg } ) > >> end while > > > >why can't we process messages directly withing this loop? then it would be > >similar to dos programming, where you handle user actions in one big loop. > >WndProc just complicates things up. why is this in windows that way? > > > > I think you are forgeting that more than one application can be > > running at the same time in windows and each application has > > a window's procedure so that windows can send the message to the > > proper application window. are you saying that messages for all windows an application has go thru that loop? i thought there were messages just for main application window.
6. Re: inputbox
- Posted by Bernie <xotron at PCOM.NET> Jul 27, 2000
- 412 views
On Thu, 27 Jul 2000 12:20:39 +0200, =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> wrote: >>are you saying that messages for all windows an application has go thru that >>loop? i thought there were messages just for main application window. The message loop is a part of each window's application. The WINDOW PROCEDURE function is a CALLBACK function. When any application or thread is running and it needs to be notified by the windows operating system, that some action has taken place within that ( application ) window. Whenever the operating system see that a particular window needs something to be done it places a message in the message Que that the operating system has reserved for that particular application. The OS then calls your CALLBACK WINDOW PROCEDURE FUNCTION. in your application you are responsible to handle that message or you can send the message to a DEFAULT OS WINDOW PROCEDURE. Get message will get the message that is in your application's message Que. Every Application that is running on your computer has a message Que including the OS. So there is no way that I know of getting a message from the OS without callback function and message loop. Without a callback procedure function there would be no way to know which message was yours and how current it is.
7. Re: inputbox
- Posted by Matthew Lewis <MatthewL at KAPCOUSA.COM> Jul 27, 2000
- 408 views
<snip> > are you saying that messages for all windows an application > has go thru that > loop? i thought there were messages just for main application window. Actually, messages go to and from all controls. Win32lib has two procedures that handle windows: WndProc(), which handles windows, and SubProc(), which handles controls. These two functions are called by windows itself, rather than from your program. An event loop is used in WinMain() to deal with messages. This is true in Eu or C or whatever (although it might be implemented differently in other languages). Matt
8. Re: inputbox
- Posted by Bernie <xotron at PCOM.NET> Jul 27, 2000
- 411 views
On Thu, 27 Jul 2000 15:29:25 -0400, Bernie <xotron at PCOM.NET> wrote: >On Thu, 27 Jul 2000 12:20:39 +0200, =?iso-8859-2?B?qWtvZGE=?= ><tone.skoda at SIOL.NET> wrote: > > > >>>are you saying that messages for all windows an application has go thru >that >>>loop? i thought there were messages just for main application window. > > > The message loop is a part of each window's application. > > The WINDOW PROCEDURE function is a CALLBACK function. > > When any application or thread is running and it needs to be notified > > by the windows operating system, that some action has taken place within > > that ( application ) window. Whenever the operating system see that > > a particular window needs something to be done it places a message in > > the message Que that the operating system has reserved for that > > particular application. > > The OS then calls your CALLBACK WINDOW PROCEDURE FUNCTION. > > in your application you are responsible to handle that message or > > you can send the message to a DEFAULT OS WINDOW PROCEDURE. Get message > > will get the message that is in your application's message Que. > > Every Application that is running on your computer has a message Que > > including the OS. So there is no way that I know of getting a message > > from the OS without callback function and message loop. > > Without a callback procedure function there would be no way to know > > which message was yours and how current it is. Ignore the last 2 lines they should have read : Without the message loop in the main function and responding through callback procedure function there would be no way to know which message was yours and how current it is.