B4J Question DatePicker - Lost Focus Event?

RichardN

Well-Known Member
Licensed User
Longtime User
If the user opens the jfx DatePicker but then does not change the date then moves focus elsewhere in the form the initialised DatePicker remains open.

I saw this code used in slightly different context.... I guess it can be modified to listen for a LostFocus event? Is there a reference source for the java string values to use and how this is done somewhere?

B4X:
Sub Initialize
    Dim dp As JavaObject = DatePicker1
    Dim e As Object = dp.CreateEvent("javafx.event.EventHandler", "dp_OnAction", False)
    dp.RunMethod("setOnAction", Array(e))
End Sub

Private Sub dp_OnAction_Event(MethodName As String, Args() As Object)
    'your action
End Sub
 
Last edited:

RichardN

Well-Known Member
Licensed User
Longtime User
Sorry that was a poor description on my part. The application is a database front-end where a date field is displayed in a label. The DatePicker is being added as a node within the label when you click on it - it remains in view if not changed hence by desire to hide it on loss of focus.

I see now that this a bad way of presenting it, I should have used the native DatePicker to display the database field in the first place. Just getting to grips with B4J for the first app.

I didn't realise the Sub... Space.... Tab list of events was incomplete!
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top