[Gambas-user] R: How to know is my Form activated or not?
ML
d4t4full at ...626...
Sat May 2 20:51:20 CEST 2015
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,
*On 05/02/2015 01:24 PM, Ru Vuott wrote:*
> If you know visible-name of Form, you could use (gb.Desktop):
> Public Sub Button1_Click()
> Dim dw As DesktopWindow
> For Each dw In Desktop.Windows
> ' If the visible-name is the same as the name of the form that we seek, then it detects that:
> If dw.VisibleName = "visible-name of Form" then Print "Form is active !"
> Next
> End
>
> --------------------------------------------
> *Sab 2/5/15, abbat81 <abbat.81 at ...787...> ha scritto:*
> Oggetto: [Gambas-user] How to know is my Form activated or not?
> A: gambas-user at lists.sourceforge.net
> Data: Sabato 2 maggio 2015, 13:43
> In Event I use *Form_Activate()* and
> *Form_Deactivate()*
> But I need to have boolean Y/N when I ask.
> --
> View this message in context: http://gambas.8142.n7.nabble.com/How-to-know-is-my-Form-activated-or-not-tp51426.html
> Sent from the gambas-user mailing list archive at Nabble.com.
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list