[Gambas-user] R: How to know is my Form activated or not?

Fabien Bodard gambas.fr at ...626...
Sat May 2 22:35:33 CEST 2015


2015-05-02 20:51 GMT+02:00 ML <d4t4full at ...626...>:
> Abbat,
>
> I'd go like this instead:
>
> *  Private _active As Boolean = False**           'This private form
> variable will hold the form's state
> **  Public Property Read IsActive As Boolean     'This property will
> return the private variable value**
>
> **  Private Function IsActive_Read() As Boolean  'The function
> declaration for reading the property**
> **    Return _active                             '  the current form
> state is returned**
> **  End**
> **
>   Public Sub Form_Activate()                   'This sub will change the
> **private variable value to Active.
> **    _active = True**                             '  flag the state as
> Active.
> **  End**
> **
>   Public Sub Form_Deactivate()**                 'This sub will change
> the **private variable value to Inactive.**
> **    _active = False**                            '  flag the state as
> Inactive.**
> **  End*
>
> >From any other form, module or class you can now check the new
> *IsActive* form property:
>
> *  Dim myForm As New frmWithProperty  'Assume frmWithProperty has the
> above property code
>   [... code ...]
> **  If myForm.IsActive Then
>     [... code for when the form is active...]
>   Else
> **    [... code for when the form is not active...]
>   Endif
>   [... even more code ...]*
>
> The property can be added the same way to a single, some, or all forms
> in the project.
>
> Regards,

To informate

By convention :


Private $bIsActive as Boolean


$ = Private globale
b = boolean

_ = hidden public Property Variable or Procedure.

The Ide hide the Names beginning by '_'




More information about the User mailing list