Thanks Karl,
I made a small app to try your suggestion, but am not sure about a couple of things. I've copied your code almost literally, and it compiles and runs, but... I don't think it is ever calling the dispatch in my case.
1) oParent - where should this value come from? I have tried declaring it in the method below and taking _GetInst(), but I don't think it is right.
2) Where do I look for the results of these? - with the "?" ? oControlFocusChangeEvent:Control:Namesym , oControlFocusChangeEvent:GotFocus
Are these visible in the debugger?
Here's what I did...
METHOD Dispatch(oEvent) CLASS Control
LOCAL uRet AS USUAL
//PP-040421 Improved focus handling
IF oEvent:msg == WM_SETFOCUS .OR. oEvent:msg == WM_KILLFOCUS
//uRet := SELF:FocusChange(__ObjectCastClassPtr(oEvt, __pCFocusChangeEvent))
uRet := SELF:FocusChange(FocusChangeEvent{oEvent})
ENDIF
RETURN SUPER:Dispatch(oEvent)
METHOD FocusChange(oFocusChangeEvent) CLASS Control
//PP-040518 Update from S Ebert
LOCAL oParent AS OBJECT
oParent := _GetInst()
IF IsInstanceOf(oParent,#DataWindow) .OR. IsInstanceOf(oParent,#DialogWindow)
//RETURN oParent:ControlFocusChange(__ObjectCastClassPtr(oFocusChangeEvent, __pCControlFocusChangeEvent))
RETURN oParent:ControlFocusChange(ControlFocusChangeEvent{oFocusChangeEvent})
ELSEIF IsInstanceOf(oParent, #__FormWindow) //It's a browser of a DataWindow
IF oFocusChangeEvent:GotFocus
oParent:DataWindow:LastFocus := SELF
ENDIF
ENDIF
RETURN NIL
METHOD ControlFocusChange(oControlFocusChangeEvent) CLASS DATAWINDOW1
SUPER:ControlFocusChange(oControlFocusChangeEvent)
? oControlFocusChangeEvent:Control:Namesym , oControlFocusChangeEvent:GotFocus
IF IsInstanceOf ( oControlFocusChangeEvent:Control , #DATETIMEPICKER ) .and. oControlFocusChangeEvent:Control:NameSym == #DATETIMEPICKER2 .and. oControlFocusChangeEvent:GotFocus
?? "", oControlFocusChangeEvent:Control:SelectedDate
ENDIF
RETURN NIL
DateTimePicker change available in EditFocusChange?
DateTimePicker change available in EditFocusChange?
Thanks Jamal,
Can this also be use in X# for VO dialect?
Can this also be use in X# for VO dialect?
DateTimePicker change available in EditFocusChange?
Hi John,
If it's not working as intended, please let us know!
Yes, the same should work in X# as well, you will just need to update the (same named) files in your XIDE folder.jonhn post=24256 userid=4531 wrote:Thanks Jamal,
Can this also be use in X# for VO dialect?
If it's not working as intended, please let us know!
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
-
- Posts: 774
- Joined: Wed May 17, 2017 8:50 am
- Location: Germany
DateTimePicker change available in EditFocusChange?
Hi Jonathan,
you may not add my posted "Class control" snippets to your app! I only posted this code, which is part of the VO Gui source code, to describe the message flow. All you need is your already created method:
btw. ? or ?? sends the output to a console window. To make it work:
- If you use VO add the "TerminalLight" Lib.
- if you use X# change the Target from "Windows" to "Console"
regards
Karl-Heinz
you may not add my posted "Class control" snippets to your app! I only posted this code, which is part of the VO Gui source code, to describe the message flow. All you need is your already created method:
Code: Select all
METHOD ControlFocusChange(oControlFocusChangeEvent) CLASS DATAWINDOW1
SUPER:ControlFocusChange(oControlFocusChangeEvent)
? oControlFocusChangeEvent:Control:Namesym , oControlFocusChangeEvent:GotFocus
IF IsInstanceOf ( oControlFocusChangeEvent:Control , #DATETIMEPICKER ) .and. oControlFocusChangeEvent:Control:NameSym == #DATETIMEPICKER2 .and. oControlFocusChangeEvent:GotFocus
?? "", oControlFocusChangeEvent:Control:SelectedDate
ENDIF
RETURN NIL
btw. ? or ?? sends the output to a console window. To make it work:
- If you use VO add the "TerminalLight" Lib.
- if you use X# change the Target from "Windows" to "Console"
regards
Karl-Heinz
DateTimePicker change available in EditFocusChange?
Ahhhh, yes... thank you.
Now that you explained it slowly enough (and in a large font) for me, I've finally got it, and indeed it seems to be working at my end.
Thank you for the suggestion and clarification!
Now that you explained it slowly enough (and in a large font) for me, I've finally got it, and indeed it seems to be working at my end.
Thank you for the suggestion and clarification!