1. Dan MoyerRe: return statement

Dan Moyer,
This is the coding I'm doing . I set the number of edit fields to display,
and edit and then compare. Is this good or bad ? I would like to have the
choice to limit the text from 2 to 10 characters but ?
jim smiley

procedure onClick_startBtn()
 if isChecked(try15RB)  or  isChecked(try12RB) or  isChecked(try9RB)
  or  isChecked(try6RB)
  then
  setvisiblenumbers()
  setText(ERROR,"Enter  Your numbers!!!!")
     setVisible(ERROR, True)
  setFocus(mfEditText1)
 else
  setText(ERROR,"Select number report!!!!")
     setVisible(ERROR, True)
  return
 end if
-- trace(1)
 wmfEditText1 = getText(mfEditText1)
 if length(wmfEditText1) = 0 then
   setText(ERROR,"enter first number !!!!")
       setVisible(ERROR, True)
   setFocus(mfEditText1)
  return
  else
    setText(ERROR,"Ok !!!!")
       setVisible(ERROR, True)
    end if

 wmfEditText2 = getText(mfEditText2)
 if length(wmfEditText2) = 0 then
  setText(ERROR,"enter second number !!!!")
      setVisible(ERROR, True)
   setFocus(mfEditText2)
  return
 else
  setText(ERROR,"Ok !!!!")
     setVisible(ERROR, True)
    end if

  wmfEditText3 = getText(mfEditText3)
 if length(wmfEditText3) = 0 then
  setText(ERROR,"enter third number !!!!")
     setVisible(ERROR, True)
  setFocus(mfEditText3)
  return
 else
  setText(ERROR,"Ok !!!!")
     setVisible(ERROR, True)
    end if
 wmfEditText4 = getText(mfEditText4)
 if length(wmfEditText4) = 0 then
  setText(ERROR,"enter fourth number !!!!")
     setVisible(ERROR, True)
  setFocus(mfEditText4)
  return
 else
  setText(ERROR,"Ok !!!!")
     setVisible(ERROR, True)
    end if
 wmfEditText5 = getText(mfEditText5)
 if length(wmfEditText5) = 0 then
  setText(ERROR,"enter fifth number !!!!")
     setVisible(ERROR, True)
  setFocus(mfEditText5)
  return
 else
  setText(ERROR,"Ok !!!!")
    setVisible(ERROR, True)
    end if
 wmfEditText6 = getText(mfEditText6)
 if length(wmfEditText6) = 0 then
  setText(ERROR,"enter sixth number !!!!")
     setVisible(ERROR, True)
   setFocus(mfEditText6)
  return
 else
  setText(ERROR,"Ok !!!!")
     setVisible(ERROR, True)
    end if
 wmfEditText7 = getText(mfEditText7)
 if isChecked(try15RB)  or  isChecked(try12RB) or  isChecked(try9RB)
    then
  if length(wmfEditText7) = 0 then
   setText(ERROR,"enter seventh number !!!!")
      setVisible(ERROR, True)
   return
  else
   setText(ERROR,"Ok !!!!")
       setVisible(ERROR, True)
    setFocus(mfEditText7)
  end if
    end if
  if isChecked(try15RB)  or  isChecked(try12RB) or  isChecked(try9RB)
  then
  wmfEditText8 = getText(mfEditText8)
  if length(wmfEditText8) = 0 then
   setText(ERROR,"enter eighth number !!!!")
      setVisible(ERROR, True)
   setFocus(mfEditText8)
   return
  else
   setText(ERROR,"Ok !!!!")
      setVisible(ERROR, True)
     end if
 end if
 if isChecked(try15RB)  or  isChecked(try12RB) or  isChecked(try9RB)
   then
   wmfEditText9 = getText(mfEditText9)
  if length(wmfEditText9) = 0 then
   setText(ERROR,"enter ninth number !!!!")
      setVisible(ERROR, True)
   setFocus(mfEditText9)
   return
  else
   setText(ERROR,"Ok !!!!")
      setVisible(ERROR, True)
     end if
 end if
 if isChecked(try15RB)  or  isChecked(try12RB)
   then
  wmfEditText10 = getText(mfEditText10)
  if length(wmfEditText10) = 0 then
   setText(ERROR,"enter tenth number !!!!")
      setVisible(ERROR, True)
   setFocus(mfEditText10)
   return
  else
   setText(ERROR,"Ok !!!!")
      setVisible(ERROR, True)
     end if
 end if
 if isChecked(try15RB)  or  isChecked(try12RB) then
  wmfEditText11 = getText(mfEditText11)
  if length(wmfEditText11) = 0 then
   setText(ERROR,"enter eleventh number !!!!")
      setVisible(ERROR, True)
   setFocus(mfEditText11)
   return
  else
   setText(ERROR,"Ok !!!!")
      setVisible(ERROR, True)
     end if
 end if
 if isChecked(try15RB)  or  isChecked(try12RB) then
  wmfEditText12 = getText(mfEditText12)
  if length(wmfEditText12) = 0 then
   setText(ERROR,"enter twelveth number !!!!")
      setVisible(ERROR, True)
   setFocus(mfEditText12)
   return
  else
   setText(ERROR,"Ok !!!!")
      setVisible(ERROR, True)
     end if
 end if
 if isChecked(try15RB) then
  wmfEditText13 = getText(mfEditText13)
  if length(wmfEditText13) = 0 then
   setText(ERROR,"enter 13th number !!!!")
      setVisible(ERROR, True)
   setFocus(mfEditText13)
  return
  else
   setText(ERROR,"Ok !!!!")
      setVisible(ERROR, True)
     end if
 end if
 if isChecked(try15RB)  then
  wmfEditText14 = getText(mfEditText14)
  if length(wmfEditText14) = 0 then
   setText(ERROR,"enter 14th number !!!!")
      setVisible(ERROR, True)
    setFocus(mfEditText14)
   return
  else
   setText(ERROR,"Ok !!!!")
      setVisible(ERROR, True)
     end if
 end if
 if isChecked(try15RB) then
    wmfEditText15 = getText(mfEditText15)
  if length(wmfEditText15) = 0 then
   setText(ERROR,"enter 15th number !!!!")
      setVisible(ERROR, True)
    setFocus(mfEditText15)
   return
  else
   setText(ERROR,"Ok !!!!")
      setVisible(ERROR, True)
     end if
 end if

 setinvisiblenumbers()
 clearguess()
 setvisibleguess()
 end procedure
----- Original Message -----
From: Dan Moyer <DANIELMOYER at prodigy.net>
To: EUforum <EUforum at topica.com>
Sent: Tuesday, April 16, 2002 7:11 AM
Subject: Re: return statement


>
> jvandal,
>
> The following demo isn't exactly what you specified, but it's close &
maybe
> a start:
>
> -- CODE STARTS:
> --  code generated by Win32Lib IDE v0.10.6
>
> include Win32Lib.ew
> without warning
>
--
> ----
> --  Window Window1
> global constant Window1 = create( Window, "Enter info into each field,
press
> finished", 0, Default, Default, 400, 300, 0 )
> global constant StatusBar9 = create( StatusBar, "StatusBar9", Window1, 0,
0,
> 0, 0, 0 )
> global constant EditText2 = create( EditText, "", Window1, 24, 20, 50, 20,
> 0 )
> global constant EditText3 = create( EditText, "", Window1, 120, 20, 50,
20,
> 0 )
> global constant EditText4 = create( EditText, "", Window1, 212, 20, 50,
20,
> 0 )
> global constant EditText5 = create( EditText, "", Window1, 28, 68, 50, 20,
> 0 )
> global constant EditText6 = create( EditText, "", Window1, 124, 68, 50,
20,
> 0 )
> global constant EditText7 = create( EditText, "", Window1, 216, 68, 50,
20,
> 0 )
> global constant PushButton8 = create( PushButton, "Finished", Window1,
104,
> 116, 90, 30, 0 )
> ----
> procedure PushButton8_onClick ()
> if length(getText(EditText2)) = 0 or
>    length(getText(EditText3)) = 0 or
>    length(getText(EditText4)) = 0 or
>    length(getText(EditText5)) = 0 or
>    length(getText(EditText6)) = 0 or
>    length(getText(EditText7)) = 0 then
>         setText(StatusBar9, "Please enter data into all fields")
> else
>   setText(StatusBar9, "ok")
> end if
> end procedure
> onClick[PushButton8] = routine_id("PushButton8_onClick")
>
>
> WinMain( Window1, Normal )
>
> -- CODE ENDS
>
> ----- Original Message -----
> From: <sixs at ida.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Monday, April 15, 2002 11:15 PM
> Subject: return statement
>
>
> I have a Windows program where I am checking several fields and if the
> fields are not entered, I want to tell the user to input the data in the
> field and then proceed to the next field. If the user does not like what
he
> has entered he can change it and leave the other fields as entered. I have
> these several input statements in a procedure. If the field needs to be
> entered the program seems to return to the starting point  at the
beginning
> of the procedure, and does not return just to the statement being
executed.
> Is this is what is happening, or is there a way to force it to return to
the
> statement?
>
> jvandal
>
>
>
>

new topic     » topic index » view message » categorize

2. Re: Dan MoyerRe: return statement

jvandal,

I'm not not *not* an expert, so it would generally be better to not address
questions to me individually, but rather address them to the list as a
whole, so you could get more than one person considering your question.

That said, it *looks* to me that what you have done could work, though I'm
not sure why not to use the simpler method I demo'd:  a button tests length
of input for all fields, show message "enter data into all fields" if any
field tests empty, instead of trying to tell the user to go to the specific
empty field & then to the next etc.  I would personally think your method is
unnecessary, and therefore "bad", but as I said, I'm *not* an expert, so if
what you really want to have happen is what you have provided for, and it
works, then go with it, unless someone else more knowledgeable than I gives
you a good reason not to.

As far as limiting the length of text entered into a edit box, v55 of
Win32Lib has it, in the form of "LimitText(object, size)", but it's broken
in 57.1 (ie, doesn't do anything).

Dan Moyer

----- Original Message -----
From: <sixs at ida.net>
To: "EUforum" <EUforum at topica.com>
Sent: Wednesday, April 17, 2002 4:46 PM
Subject: Dan MoyerRe: return statement


>
> Dan Moyer,
> This is the coding I'm doing . I set the number of edit fields to display,
> and edit and then compare. Is this good or bad ? I would like to have the
> choice to limit the text from 2 to 10 characters but ?
> jim smiley
>
> procedure onClick_startBtn()
>  if isChecked(try15RB)  or  isChecked(try12RB) or  isChecked(try9RB)
>   or  isChecked(try6RB)
>   then
>   setvisiblenumbers()
>   setText(ERROR,"Enter  Your numbers!!!!")
>      setVisible(ERROR, True)
>   setFocus(mfEditText1)
>  else
>   setText(ERROR,"Select number report!!!!")
>      setVisible(ERROR, True)
>   return
>  end if
> -- trace(1)
>  wmfEditText1 = getText(mfEditText1)
>  if length(wmfEditText1) = 0 then
>    setText(ERROR,"enter first number !!!!")
>        setVisible(ERROR, True)
>    setFocus(mfEditText1)
>   return
>   else
>     setText(ERROR,"Ok !!!!")
>        setVisible(ERROR, True)
>     end if
>
>  wmfEditText2 = getText(mfEditText2)
>  if length(wmfEditText2) = 0 then
>   setText(ERROR,"enter second number !!!!")
>       setVisible(ERROR, True)
>    setFocus(mfEditText2)
>   return
>  else
>   setText(ERROR,"Ok !!!!")
>      setVisible(ERROR, True)
>     end if
>
>   wmfEditText3 = getText(mfEditText3)
>  if length(wmfEditText3) = 0 then
>   setText(ERROR,"enter third number !!!!")
>      setVisible(ERROR, True)
>   setFocus(mfEditText3)
>   return
>  else
>   setText(ERROR,"Ok !!!!")
>      setVisible(ERROR, True)
>     end if
>  wmfEditText4 = getText(mfEditText4)
>  if length(wmfEditText4) = 0 then
>   setText(ERROR,"enter fourth number !!!!")
>      setVisible(ERROR, True)
>   setFocus(mfEditText4)
>   return
>  else
>   setText(ERROR,"Ok !!!!")
>      setVisible(ERROR, True)
>     end if
>  wmfEditText5 = getText(mfEditText5)
>  if length(wmfEditText5) = 0 then
>   setText(ERROR,"enter fifth number !!!!")
>      setVisible(ERROR, True)
>   setFocus(mfEditText5)
>   return
>  else
>   setText(ERROR,"Ok !!!!")
>     setVisible(ERROR, True)
>     end if
>  wmfEditText6 = getText(mfEditText6)
>  if length(wmfEditText6) = 0 then
>   setText(ERROR,"enter sixth number !!!!")
>      setVisible(ERROR, True)
>    setFocus(mfEditText6)
>   return
>  else
>   setText(ERROR,"Ok !!!!")
>      setVisible(ERROR, True)
>     end if
>  wmfEditText7 = getText(mfEditText7)
>  if isChecked(try15RB)  or  isChecked(try12RB) or  isChecked(try9RB)
>     then
>   if length(wmfEditText7) = 0 then
>    setText(ERROR,"enter seventh number !!!!")
>       setVisible(ERROR, True)
>    return
>   else
>    setText(ERROR,"Ok !!!!")
>        setVisible(ERROR, True)
>     setFocus(mfEditText7)
>   end if
>     end if
>   if isChecked(try15RB)  or  isChecked(try12RB) or  isChecked(try9RB)
>   then
>   wmfEditText8 = getText(mfEditText8)
>   if length(wmfEditText8) = 0 then
>    setText(ERROR,"enter eighth number !!!!")
<snip>

> 0,
> > 0, 0, 0 )
> > global constant EditText2 = create( EditText, "", Window1, 24, 20, 50,
20,
> > 0 )
> > global constant EditText3 = create( EditText, "", Window1, 120, 20, 50,
> 20,
> > 0 )
> > global constant EditText4 = create( EditText, "", Window1, 212, 20, 50,
> 20,
> > 0 )
> > global constant EditText5 = create( EditText, "", Window1, 28, 68, 50,
20,
> > 0 )
> > global constant EditText6 = create( EditText, "", Window1, 124, 68, 50,
> 20,
> > 0 )
> > global constant EditText7 = create( EditText, "", Window1, 216, 68, 50,
> 20,
> > 0 )
> > global constant PushButton8 = create( PushButton, "Finished", Window1,
> 104,
> > 116, 90, 30, 0 )
> > ----
> > procedure PushButton8_onClick ()
> > if length(getText(EditText2)) = 0 or
> >    length(getText(EditText3)) = 0 or
> >    length(getText(EditText4)) = 0 or
> >    length(getText(EditText5)) = 0 or
> >    length(getText(EditText6)) = 0 or
> >    length(getText(EditText7)) = 0 then
> >         setText(StatusBar9, "Please enter data into all fields")
> > else
> >   setText(StatusBar9, "ok")
> > end if
> > end procedure
> > onClick[PushButton8] = routine_id("PushButton8_onClick")
> >
> >
> > WinMain( Window1, Normal )
> >
> > -- CODE ENDS
> >
> > ----- Original Message -----
> > From: <sixs at ida.net>
> > To: "EUforum" <EUforum at topica.com>
> > Sent: Monday, April 15, 2002 11:15 PM
> > Subject: return statement
> >
> >
> > I have a Windows program where I am checking several fields and if the
> > fields are not entered, I want to tell the user to input the data in the
> > field and then proceed to the next field. If the user does not like what
> he
> > has entered he can change it and leave the other fields as entered. I
have
> > these several input statements in a procedure. If the field needs to be
> > entered the program seems to return to the starting point  at the
> beginning
> > of the procedure, and does not return just to the statement being
> executed.
> > Is this is what is happening, or is there a way to force it to return to
> the
> > statement?
> >
> > jvandal
> >
> >
>
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu