[Gambas-user] Checking values in a variable from a Gambas Shell...

Benoit Minisini gambas at ...1...
Tue Feb 6 08:10:49 CET 2007


On Monday 05 February 2007 16:24, sbungay wrote:
>    Applolgies in advance for the length of the post.
>    I noticed an interesting behaviour that I never noticed before, and
> perhaps it is just the first time I noticed this.
>    A form which instantiates a module level public variable as a new
> instance of a class populates that variable with data. After the
> variable has been populated and the form is waiting for more events you
> are unable to use the Gambas shell to display values that have been
> stored in the variable.
>    For example lets say we have a class called 'ClassCustomer' and it is
> defined as follows;
>
> ' Gambas Class file.
> PUBLIC LastName AS String
> PUBLIC FirstName AS String
>
>
> And then we have a form which has an OK and Cancel button on it and some
> logic in it that goes something like this...
>
> 'Gambas Class file
> PUBLIC mCustomer AS NEW ClassCustomer
>
> PUBLIC SUB ButtonOK_Click()
>    mCustomer.LastName = "Doe"
>    mCustomer.FirstName = "John"
> END
>
> PUBLIC SUB ButtonCancel_Click()
>    STOP
> END
>
>
>    Set a break point on the second assignment statement in
> ButtonOK_Click and run the program. Click on OK and when execution stops
> at the break point open the Gambas shell and type;
>
> ? mCustomer.LastName
> Doe
>
>    No problem there. If we press F5 and let the program continue (the
> form does not close) and we go back to the Gambas shell and type;
>
> ? mCustomer.LastName
>
>   We get nothing. No result... if we type;
>
> ? FormName.mCustomer.LastName
>
>    We get nothing again... as if mCustomer has ceased to exist. Clicking
> on the Cancel button program execution stops (because of the STOP
> stqtement in the event). Back to the Gambas shell, if we type
>
> ? mCustomer.LastName
> Doe
>
>    I get the expected response. So the data is indeed there.
>
> Question
>    Why can't the Gambas shell see the values that are stored in
> mCustomer when the form in which mCustomer exists is sitting waiting for
> an event?
>
> Steve.
>

The debugger is embedded in the program being debugged, and communicates with 
the IDE with named pipes.

When your program is in the event loop, the debugger cannot be raised, and so 
cannot send to the IDE the value of the expressions you are requested. You 
must stop the program before.

This is just an implementation problem! :-)

Regards,

-- 
Benoit Minisini




More information about the User mailing list