Hello Roger,
you posted this in changes-Forum:
1072. Added new Get-Set function: DC_XbpGetLbClick(). This is used to post a
code block to evaluate when the left mouse button is clicked in any
DCGET in the application. This code block can be used to position the
mouse cursor to the end of the get. Example:
DC_XbpGetLbClick( {|x,y,o|GoToEnd(o)} )
STATIC FUNCTION GoToEnd( oGet )
LOCAL nPos := oGet:get:pos
IF nPos > Len(Trim(oGet:buffer))
PostAppEvent(xbeP_Keyboard,xbeK_END,,oGet)
PostAppEvent(xbeP_Keyboard,xbeK_END,,oGet)
ENDIF
RETURN nil
Does this still work for you with the first click in a dcget (if another dcget has focus first). I use 252 and use a very simular solution, but with the first click in a dcget oGet:get:pos (and o:queryMarked()[2]) also gives 1 (and not the real pos). If a DCGET has the focus and using left click, all works fine...
Can you please have a look?
Greetings
Markus
DC_XbpGetLbClick / GoToEnd
- Markus Walter
- Posts: 54
- Joined: Thu Jan 28, 2010 12:49 am
- Location: Germany
DC_XbpGetLbClick / GoToEnd
-----------------
Greetings
Markus Walter
Greetings
Markus Walter
Re: DC_XbpGetLbClick / GoToEnd
I can confirm the behavior you described in my test program (below).
I really don't have a solution for you. It will take a lot more work.
Maybe someone will have the time to experiment with this.
I really don't have a solution for you. It will take a lot more work.
Maybe someone will have the time to experiment with this.
Code: Select all
#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"
FUNCTION Main()
LOCAL GetList[0], cString := 'This is a string '
DC_XbpGetLbClick( {|x,y,o|GoToEnd(o),(wtf o)} )
@ 0,0 DCGET cString
@ 1,0 DCGET cString
@ 2,0 DCGET cString
@ 3,0 DCGET cString
DCREAD GUI FIT TITLE 'GotoEnd Test'
RETURN nil
* -----------
PROC appsys ; return
* -----------
STATIC FUNCTION GoToEnd( oGet )
LOCAL nPos := oGet:get:pos
IF nPos > Len(Trim(oGet:buffer))
PostAppEvent(xbeP_Keyboard,xbeK_END,,oGet)
PostAppEvent(xbeP_Keyboard,xbeK_END,,oGet)
ENDIF
RETURN nil
The eXpress train is coming - and it has more cars.
- Markus Walter
- Posts: 54
- Joined: Thu Jan 28, 2010 12:49 am
- Location: Germany
Re: DC_XbpGetLbClick / GoToEnd
Hello Roger,
i play all the day with this (especially it is not with the alaska xbpget).
I found the setInputFocus-Block in your DC_XbpGet:Init()
I think the o:Home() can explain the behaviour, doesn't it?
i play all the day with this (especially it is not with the alaska xbpget).
I found the setInputFocus-Block in your DC_XbpGet:Init()
Code: Select all
::setInputFocus := {|x,y,o| ;
o:DateFlag := .T., ;
o:Home(), ;
DC_HiliteGets(o,1,o:getList:getOptions[nGETOPT_HILITECOLOR]), ;
DC_ColorGets(o,1,o:getList:getOptions[aGETOPT_COLORGETS]), ;
_PopupButtonShow(o,.t.) }
-----------------
Greetings
Markus Walter
Greetings
Markus Walter
Re: DC_XbpGetLbClick / GoToEnd
Yes, I forgot about that.
You can replace it like so:
You can replace it like so:
Code: Select all
bMyFocus := ;
{|x,y,o| DC_HiliteGets(o,1,o:getList:getOptions[nGETOPT_HILITECOLOR]), ;
DC_ColorGets(o,1,o:getList:getOptions[aGETOPT_COLORGETS]) }
@ .. DCGET myGet EVAL {|o|o:setInputFocus := bMyFocus}
The eXpress train is coming - and it has more cars.
- Markus Walter
- Posts: 54
- Joined: Thu Jan 28, 2010 12:49 am
- Location: Germany
Re: DC_XbpGetLbClick / GoToEnd
Hi Roger,
what about
o:DateFlag := .T.
and
_PopupButtonShow(o,.t.) ?
Do you know why o:home() was necessary?
what about
o:DateFlag := .T.
and
_PopupButtonShow(o,.t.) ?
Do you know why o:home() was necessary?
-----------------
Greetings
Markus Walter
Greetings
Markus Walter
Re: DC_XbpGetLbClick / GoToEnd
Ok, you can put the o:dateFlag back in. I don't remember why it's there.Hi Roger,
what about
o:DateFlag := .T.
and
_PopupButtonShow(o,.t.) ?
Do you know why o:home() was necessary?
_PopupButtonShow() make sure the popup button is displayed when the get receives focus.
It's only needed when using the autohide feature of the popup button.
You can't use it because it's a static function.
I will need to make it into a public function.
o:home() has been in there for 10 years.
I don't want to remove it and cause regression.
The eXpress train is coming - and it has more cars.
- Markus Walter
- Posts: 54
- Joined: Thu Jan 28, 2010 12:49 am
- Location: Germany
Re: DC_XbpGetLbClick / GoToEnd
Hi Roger,
perhaps o:home() is to prevent marking text with a single click? Since i use my own setinputfocus() (without this o:home()), sometimes the text in the get is marked by clicking first time in the get (normal lbclick)...
I have some DCGETs which are allways marked with a single lbclick (coming fro, outside the get), others not, strange. I will test more...
perhaps o:home() is to prevent marking text with a single click? Since i use my own setinputfocus() (without this o:home()), sometimes the text in the get is marked by clicking first time in the get (normal lbclick)...
I have some DCGETs which are allways marked with a single lbclick (coming fro, outside the get), others not, strange. I will test more...
-----------------
Greetings
Markus Walter
Greetings
Markus Walter