B4J Question How To Change Mouse Cursor When Hover Over Label on Non-Main Window (B4XPages)

cklester

Well-Known Member
Licensed User
All of the threads I found about changing the mouse cursor dealt with the Main page. I have a label on a non-Main window. How do I get the mouse cursor to change only when hovering over that label?

I'm using B4XPages.
 
Last edited:

mangojack

Well-Known Member
Licensed User
Longtime User
In the other form module ...
B4X:
Private frmSecondForm As Form  'Process Global

Private Sub Label1_MouseEntered (EventData As MouseEvent)
  frmSecondForm.RootPane.MouseCursor = fx.Cursors.OPEN_HAND
End Sub

Private Sub Label1_MouseExited (EventData As MouseEvent)
  frmSecondForm.RootPane.MouseCursor = fx.Cursors.DEFAULT
End Sub
 

Attachments

  • MouseTest.zip
    20.6 KB · Views: 169
Upvote 0

cklester

Well-Known Member
Licensed User
Thank you, @mangojack !

I'm sorry! Sadly, I forgot to mention, I am using B4XPages, so I'm not sure how to set frmSecondForm from your example.

Do you know how to do this using B4XPages?
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
I'm lagging & lacking in B4XPages ... so cannot help. Can't be to difficult , and I'm sure you will be answered soon.
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Playing around with B4XPages example ... try this. Unsure if its the best approach. ( Process Global vs Dimmed locally )

B4X:
Private frm2 as Form  'Process Global

'in B4XPage_Created()
frm2 =  B4XPages.GetNativeParent(Me) 'will return the page Form.

Private Sub Label1_MouseEntered (EventData As MouseEvent)
  frm2.RootPane.MouseCursor = fx.Cursors.OPEN_HAND
End Sub

Private Sub Label1_MouseExited (EventData As MouseEvent)
  frm2.RootPane.MouseCursor = fx.Cursors.DEFAULT
End Sub
 
Last edited:
Upvote 0
Top