Re: Secondary window

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Sat, 12 Aug 2000, you wrote:
> I've been working on a problem which I've not been able to resolve.
>snip
>However, I'd rather
> have users be able to click on the OK button instead of just closing
> the window.  Any help would be greatly appreciated.
>
>    -J. Kenneth Riviere (JoKeR)

It's just a matter of positioning. You were assigning the onClick function
before there was any such  function to call.

include win32lib.ew
without warning

integer  result
sequence userName
userName = {}
constant
Win = create( Window, "TestWindow", 0, Default, Default, 200, 200,
0 ),
testButton = create( PushButton, "Push Me!", Win, 30, 60, 120, 40, 0 )

constant
PromptWin = create( Window,"Enter your name",0,Default,Default,260,120,0),
PromptLbl = create( LText, "Please enter your name",PromptWin, 10, 15, 120, 20,
0 ),
PromptFld = create( EditText, "", PromptWin, 10, 45, 120, 20, 0 ),
OKButton  = create( PushButton, "OK", PromptWin, 180, 40, 30, 30,0)

--** was here **

global procedure onClick_OKButton()
-- use the data from the text field to demonstrate this code -- is executing
userName = getText( PromptFld ) -- ** changed from NameFld, which doesn't exist
result = message_box( sprintf("Name = %s", {userName}),"Player's name", 0 )
closeWindow(PromptWin)
end procedure
onClick[ OKButton ] = routine_id("onClick_OKButton")
-- the test button's behavior
-- ** now here **
onClick[ OKButton ] = routine_id("onClick_OKButton")

global procedure onClick_TestButton()
if length(userName) > 0 then
result = message_box( sprintf("Name = %s", {userName}),"Player's name", 0 )
end if
openWindow( PromptWin, Normal )
end procedure

-- tell Windows when to do the action
onClick[testButton] = routine_id( "onClick_TestButton" )
WinMain(Win, Normal)
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu