Problem with program
All,
Below is some code snippets from a project I am currently
working on, the problem is no matter what I put in Rnumber it gives
me the Warning about the range being wrong, this same code seems to
work fine in another include file I have for a different window? Is
there a BETTER way to do range checking on input in win32lib programs,
also when the setFocus(edtRnumber) is executed the cursor disappears,
but edtRnumber has the Focus?
-- Program: GenTools.ew
--
-- Generic Tools
--
global constant FALSE = 0, TRUE = 1
global type boolean(integer b)
return b = FALSE or b = TRUE
end type
global type YesNo(sequence YN)
if find('Y', YN) then
return TRUE
elsif find('N', YN) then
return TRUE
else
return FALSE
end if
end type
global sequence junk
global function range(sequence num, sequence lowest, sequence highest)
if compare(num,lowest) >= 0 and compare(num,highest) <= 0 then
return TRUE
else
return FALSE
end if
end function
--------------------------------------------------
global procedure Warn(sequence Msg)
junk = message_box( Msg, "Invalid Input!",
MB_ICONWARNING+MB_TASKMODAL)
end procedure
-------------------------------------------------
-- end of GenTools.ew --------
-- Program Rotate.ew
--
-- include file for Rotation Window
--
include GenTools.ew
procedure onLostFocus_edtRnumber()
-- range for rnumber is 2 - 199
FRnumber = getText(edtRnumber)
if length(FRnumber) = 1 then
if not range(FRnumber, "2", "9") then
Warn( "R Number MUST be between 2 and 199" )
setFocus(edtRnumber)
end if
end if
if length(FRnumber) > 2 then
if not range(FRnumber, "2", "199") then
Warn( "R Number MUST be between 2 and 199" )
setFocus(edtRnumber)
end if
end if
end procedure
onLostFocus[ edtRnumber ] = routine_id( "onLostFocus_edtRnumber" )
-- end of Rotate.ew ---------
TIA for ANY Help!!!
+ + + Rev. Ferlin Scarborough - Centreville, Alabama - USA
|
Not Categorized, Please Help
|
|