Page 1 of 1

@ DCPICKLIST GOTFOCUS

Posted: Thu Apr 21, 2016 9:35 am
by reganc
Roger

Does the GOTFOCUS clause on a DCPICKLIST actually do anything?

I have a DCPICKLIST that is a child of a STATIC. I was trying to change the background color of the static when the DCPICKLIST object got focus but nthing happened.

I understand that this 'object' is actually made up of other objects so I was wondering which object the got focus is actually applied to?

Thanks

Re: @ DCPICKLIST GOTFOCUS

Posted: Thu Apr 21, 2016 11:57 am
by rdonnay
DC_XbpPicklist() is a complex dialog made of several Xbase parts.

The XbpStatic() portion never receives focus no matter what you do, therefore the GOTFOCUS clause really can't work.

I cannot think of an easy workaround for this problem.
It will take several setInputFocus and killInputFocus code blocks to get the behavior you want.

This would be a good learning exercise for you to look at the events that are occurring when you click around in your application.
From those events you may be able to discern a pattern that will work for you.

You would need to use a HANDLER clause and a WTF DC_AppEventDefine(nEvent) in your handler to observe the events.

Re: @ DCPICKLIST GOTFOCUS

Posted: Thu Apr 21, 2016 1:26 pm
by rdonnay
You may want to try this:

Code: Select all

@ .. DCPICKLIST .. ;
      EVAL {|o|o:leftListBox:killInputFocus := {||oMyStatic:setColorBG(GRA_CLR_BLUE)}, ;
               o:leftListBox:setInputFocus := {||oMyStatic:setColorBG(GRA_CLR_WHITE)}, ;
               o:rightListBox:killInputFocus := {||oMyStatic:setColorBG(GRA_CLR_BLUE)}, ;
               o:rightListBox:setInputFocus := {||oMyStatic:setColorBG(GRA_CLR_WHITE)} }

Re: @ DCPICKLIST GOTFOCUS

Posted: Fri Apr 22, 2016 12:35 am
by reganc
rdonnay wrote:You may want to try this:

Code: Select all

@ .. DCPICKLIST .. ;
      EVAL {|o|o:leftListBox:killInputFocus := {||oMyStatic:setColorBG(GRA_CLR_BLUE)}, ;
               o:leftListBox:setInputFocus := {||oMyStatic:setColorBG(GRA_CLR_WHITE)}, ;
               o:rightListBox:killInputFocus := {||oMyStatic:setColorBG(GRA_CLR_BLUE)}, ;
               o:rightListBox:setInputFocus := {||oMyStatic:setColorBG(GRA_CLR_WHITE)} }
I will certainly try that.

It is sort of what I was expecting, I just wanted to make sure I wasn't missing anything.

We use the COLORGETS clause so we can see which entry field is in focus and we lose that ability when using DCPICKLIST (although we don['t use it in very many places).

Thanks.