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

Fabien Bodard gambas.fr at ...626...
Sat May 2 23:10:31 CEST 2015


Public Toto as String 'is public
Public  _Toto as string 'Is public but hidden
Private $sToto as String 'Is Private

Property _Toto as String 'Is public access but hidden

Dim sToto as string 'Is Local

In Fact it is the convention used on the gambas IDE and generally on
my own projects.

Even _MyClass is hidden by the ide

Well generally the _Var means to not expert DO NOT TOUCH THAT WITHOUT
MANY CARE !

2015-05-02 22:52 GMT+02:00 ML <d4t4full at ...626...>:
> Fabien,
>
> Thanks for the clarification.
>
> Actually, as an old-time VB6 and more recently VBNet and Gambas
> developer, I tend to use camel-case and actually dropped the
> *b*/Boolean, *l*/Long, *s*/String, etc prefixes not long ago.
> Also, I normally used to go *m_<variableName>* for a module (local to
> the class) variable in VB6. But I found that Gambas can happily use the
> underscore without the "*m*" prefix, just as in VBNet.
>
> And, as an even older-time Sinclair Basic user, I tend to reserve the
> *$* sign for string suffixes :P
> Somehow it just looks strange to me to use the *$* as a prefix!
>
> Anyway, I don't quite understand what you mean by "Private Global"; to
> me it's either Private or Global, but not both. What I do is use a
> Private variable to hold a value that I will publish later via a Public
> Property. But the variable itself is Private while the Property is
> Public. I do make that distinction. And, as you say, the private
> variable is hidden by the IDE, so the only way to access it is via the
> property, which is the original intention.
>
> Nonetheless, I will try to remember and adhere to your specs if I give
> further examples to the list.
>
> Regards,
>
> *On 05/02/2015 05:35 PM, Fabien Bodard wrote:*
>> *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 '_'
>>
>> ------------------------------------------------------------------------------
>> One dashboard for servers and applications across Physical-Virtual-Cloud
>> Widest out-of-the-box monitoring support with 50+ applications
>> Performance metrics, stats and reports that give you Actionable Insights
>> Deep dive visibility with transaction tracing using APM Insight.
>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



-- 
Fabien Bodard




More information about the User mailing list