Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by dcole Jan 17, 2011
- 1614 views
Hello Selgor,
I just made this up on the fly. It should do what you want.
-- code generated by Win32Lib IDE v0.22.0 Build Dec-16-2006 constant TheProgramType="exw" include Win32Lib.ew without warning -------------------------------------------------------------------------------- -- Window Window1 global constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 ) global constant LText4 = createEx( LText, "Type Number 1 and Enter", Window1, 72, 68, 132, 20, 0, 0 ) global constant EditText2 = createEx( EditText, "", Window1, 208, 68, 48, 20, 0, 0 ) global constant LText5 = createEx( LText, "Type Number 2 and Enter", Window1, 72, 100, 132, 20, 0, 0 ) global constant EditText3 = createEx( EditText, "", Window1, 208, 100, 48, 20, 0, 0 ) global constant LText7 = createEx( LText, "The Greatest Common Denominator is", Window1, 8, 168, 192, 20, 0, 0 ) global constant EditText6 = createEx( EditText, "", Window1, 208, 168, 48, 20, 0, 0 ) global constant LText9 = createEx( LText, "Hit Enter to Restart", Window1, 272, 168, 100, 20, 0, 0 ) --------------------------------------------------------- procedure calculate() integer a,b,r r=1 a=getNumber(EditText2) b=getNumber(EditText3) if a=0 or b=0 then return end if while r > 0 do r = a - b* floor(a/b) if r = 0 then exit end if a = b b = r end while setText(EditText6,b) end procedure -------------------------------------------------------------------------------- procedure Window1_onActivate (integer self, integer event, sequence params)--params is () setVisible(LText9,0) setFocus(EditText2) end procedure setHandler( Window1, w32HActivate, routine_id("Window1_onActivate")) -------------------------------------------------------------------------------- procedure EditText2_onKeyDown (integer self, integer event, sequence params)--params is ( atom scanCode, atom shift ) if params[1]=13 then if self=EditText2 then setText(EditText3,"") doEvents(0) setFocus(EditText3) elsif self=EditText3 then calculate() setVisible(LText9,1) elsif self=EditText6 then setText(EditText2,"") setText(EditText3,"") setText(EditText6,"") setVisible(LText9,0) end if end if end procedure setHandler( {EditText2,EditText3,EditText6}, w32HKeyDown, routine_id("EditText2_onKeyDown")) WinMain( Window1,Normal )
Don Cole