Help with message handler please:

  • Follow


In Debug4x I have created an informbox with three choices:

1.  Checkbox to select "None"
2.  Checkbox to select "At Startup"
3.  Checkbox to select "Time Interval" and has and has an associated
text box to enter time in seconds; initially not visible.

I have all checkboxes intially set to FALSE, and % 60 for the initial
and reset values of the text box for item 3.  Also for item 3 ("Time
Interval") the following definitions apply:

  DEFINE Label3 BINT2  ( Time Interval Label )
  DEFINE Field3  BINT2  ( Time Interval checkbox ) 
  DEFINE Field4  BINT3  ( Time Interval text for value in seconds )

In the message handler editor for field3 (the checkbox),  if checked,
I want to make the text box visible, and be able to get a value.  I am
having trouble with the handler code, which I have  placed in the item
3 checkbox message handler editor:

'
::
  BINT2      ( #2 = Time Interval Check Box )
  #=case
  ::
    BINT3    ( #3 = Time Interval Value )
    3PICK    
    
*  field3 = BINT2 = Time interval checkbox.
*  field4 = BINT3 = Time interval text (value in seconds).

*  If Checked then TrueTrue TRUE.  To make field4 (BINT3) visible
*  and get a value.

*  ELSE TrueFalse FALSE. To nake field4 BINT3 not visible and
*  skip value.

    ITE
    ::
      TrueTrue
      FLASHPTR IfSetFieldVisible  ( Make BINT3 Visible )
    ;
    
    ::
      TrueFalse
      FLASHPTR IfSetFieldVisible  ( MAKE BINT3 not Visible )
    ;
    TRUE  ( Returns TRUE if Visible )
  ;
  FALSE   ( Returns FALSE if NOT Visible )
;

It doesn't work.  If anyone can help me with this, I sure would
appreciate it.  Thank you.

-Dot-


0
Reply dot 3/31/2007 2:00:12 PM

I might be able to figure this out for myself, except I do not seem to
be able to use a breakpoint within the INFORM code editor that stops
execution of the message handler during runtime.  Initially, it does
stop execution *before* the INFORM screen appears, but not while one
is actually using the INFORM screen.

It seems that in debug4x the INFORM source gets preprocessed  so that
at runtime, the debugger no longer uses the source editor and any
breakpoints that were set there are not able to trap execution.  I
might be wrong here, but for me the emulator displays the INFORM
screen and even though input fields were set or 'OK' was clicked, the
debugger doesn't use the breakpoints I set in the INFORM source editor
for my message handler code.

So I don't seem to be able to debug my added INFORM box message
handler code.  

-Dot-
1
Reply dot 3/31/2007 2:19:16 PM


> I might be able to figure this out for myself, except I do not seem to
> be able to use a breakpoint within the INFORM code editor that stops
> execution of the message handler during runtime.  Initially, it does
> stop execution *before* the INFORM screen appears, but not while one
> is actually using the INFORM screen.

Well, can't help you much there.  All my projects now have C code
embedded so they don't run on the emulator.  Trial and error for me!
Luckily I've been doing this since 9th grade and spent more time
trying rather than erroring. :-)

Now as to the message handler.  First- always name your fields and
labels.  It makes your code much easier to maintain and read.  For
example, I would name the label "interval" and the entry box
"interval_box".

Second, the message handler you want to be using here is "5" which
reads:

35.8.2.6IfMsgSetFieldValue-5
The complimentary message of IfMsgSetFieldValue: it gives as input
the "external" (or user) value, and the internal value should be
returned. If
you want a message to be called after each change in the value of a
field, this
is the one. You can leave the value given as input unchanged,
naturally.

Here is an example that should work, but I just woke up 10 minutes ago
so it may not. :-)

'
::
  BINT5      ( run this when field is checked/unchecked )
  #=case
  ::
    FALSE  ( you aren't doing anything to the value, just testing
value, so I'd leave false)
    BINT3    ( what is this? oh! it is the interval_box . . . names
are nice! :-)
    3PICK  ( get new value of field)
    ITE
    TrueTrue
    TrueFalse
    FLASHPTR IfSetFieldVisible  ( Make BINT3 (. . . which is?) Visible/
Invisible, notice how I compacted your statement )
  ;
  FALSE   ( Returns FALSE if NOT message handler 5!!! you must always
return a false for your other numbers if you aren't doing anything)
;

Once you get your form working how you'd like, check our the
compression utilities in debug4x.  Many input forms can be compresses
40-70% in size!  Good job on getting into sysRPL.  It is a fun
language.  Message handlers are one of the trickiest things to master,
and input forms are the most complicated.

TW



0
Reply TW 3/31/2007 2:40:21 PM

On 31 Mrz., 16:19, dot <d...@dot.com> wrote:
> I might be able to figure this out for myself, except I do not seem to
> be able to use a breakpoint within the INFORM code editor that stops
> execution of the message handler during runtime.  Initially, it does
> stop execution *before* the INFORM screen appears, but not while one
> is actually using the INFORM screen.

The debugger does only work, if the adress of a program in memory is
known. So it can=B4t debug a program which is build by another program,
for example.
IfMain2, for example, is a POL-Loop, so you might have to dig in
deeper to see what realy happens when an Inform-Box starts/runs.
A trick I usally use (and helps a lot to understand some stuff inside)
is to use a ROMPTR as a substitute for something inside IfMain2. You
can debug the ROMPTR and after erverthing works the qay you want it
replace the ROMPTR with your code (if you don=B4t want/need the overhead
of an extra ROMPTR in your source).

Greetings
Andreas



0
Reply iso 4/3/2007 7:43:38 PM

3 Replies
981 Views

(page loaded in 0.002 seconds)

Similiar Articles:













7/21/2012 5:33:54 PM


Reply: