RE: Win32lib cascading windows

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

OK, I have been able to put together a program which is little more than 
a series of windows that call each other.  The opening window has a 
button.  Push that button and it opens a window which prompts for a 
name.  Click the OK button there and it opens a window which would show 
scores, except I've stripped all the displays to minimize the code.  
Click OK on that window and it should return control to the original 
main window since I'm not opening any further windows.  That is when I 
wind up in this weird, locked-up state.  Thanks for helping me to look 
at this.  No doubt I've done something stupid, but I've seen many times 
how having another set of eyes look at it can spot the thing I'm 
missing.

J. Kenneth Riviere


--------------------------------
include file.e
include misc.e
include Win32Lib.ew
 without warning

sequence userName


constant
    scoreWin      = create( 
Window,"Standings",0,Default,Default,350,320,0 ),
    scoreOKButton = create( DefPushButton, "OK", scoreWin, 160, 250, 60, 
32, 0 )

procedure closeScoreWin()
    integer result
    result = message_box( "Ready to close scoreWin",
                          "finishScoreWin!", 0 ) 
end procedure
onClose[ scoreWin ] = routine_id("closeScoreWin")

procedure onClick_ScoreOKButton()
    closeWindow(scoreWin)
end procedure
onClick[ scoreOKButton ] = routine_id( "onClick_ScoreOKButton" )

procedure scorePaint( integer x1, integer y1, integer x2, integer y2 )
    sequence printSol, sortSols
    integer  madeTop10

    madeTop10 = 1

    if madeTop10 = 0 then
        setPosition( scoreWin, 50, 210 )
        wPuts( scoreWin, printSol )
    end if
end procedure
onPaint[scoreWin] = routine_id( "scorePaint" )

procedure writeSol()
    openWindow( scoreWin, Modal )
end procedure

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


procedure finishGameWon()
    atom result
    result = message_box( "Ready to close PromptWin",
                          "finishGameWon!", 0 ) 
    writeSol()
    --nextPuzzle()
end procedure

procedure displayUserName( integer x1, integer y1, integer x2, integer 
y2 )
    sequence tmpName

    tmpName = "JoKeR"
    setText(NameFld, tmpName)
end procedure

procedure onClick_OKButton()
    userName = getText( NameFld )
    closeWindow(PromptWin)
end procedure

onClick[ OKButton ]  = routine_id("onClick_OKButton")
onPaint[ PromptWin ] = routine_id("displayUserName")
onClose[ PromptWin ] = routine_id("finishGameWon")



constant ButtonWindow =  
    create( Window, "Button Example", 0, Default, Default, 100, 100, 0 )

-- create a control in the window
constant OkButton = 
    create( PushButton, "&Button", ButtonWindow, 10, 10, 80, 40, 0 )    

-- add a tooltip to the button
    setHint( OkButton, "This button invokes name prompting." )

procedure doPrompt()
    openWindow(PromptWin, Modal)
end procedure 

onClick[ OkButton ] = routine_id("doPrompt")

-- hand control over to Windows
WinMain( ButtonWindow, Normal )

> demonstration program that exhibits the effect?
> 
> For windows that are not the main one, the closeWindow() is little more 
> than
> a glorified hideWindow().
> 
> ------
> Derek Parnell
> Melbourne, Australia
> "To finish a job quickly, go slower."
> 
> 
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu