Form active or in focus?

Joosttt

Member
Licensed User
Hi,
In my application I want to know if a certain form is active or in focus. There seems to be no easy way to do this. I found the Form.ActiveForm property on MSDN here: Form.ActiveForm Property (System.Windows.Forms)

But i'm having trouble using this with the door library. Is there a way to use it in basic4ppc? Or is there a more easy way of finding the active form?

Thanks.

Joost
 

agraham

Expert
Licensed User
Longtime User
If you know which Form you want to check the ContainsFocus property gets a value indicating whether the control, or one of its child controls, currently has the input focus.

B4X:
    Obj1.New1(False)
   Obj1.FromControl("Form1")
   Obj1.Value = Obj1.GetProperty("ContainsFocus")   
   Focussed = Obj1.RunMethod("ToString")
   Msgbox(Focussed)
 

Joosttt

Member
Licensed User
Hi Agraham and Erel,
Thanks for both replies. For now I can use Agraham's solution.

Good thing that a Form.visible property will be included in the next version. :sign0060:
 
Top