FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Multiget: reading position of the cursor
Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Multiget: reading position of the cursor
Posted: Mon Feb 21, 2011 09:57 AM

Hi,

with mGet:OnKeyDown() (using oGet:GetCol()) I can read the position of the cursor before the usage of the key is being handled. Now I need to know the position of the cursor after the key is being used.
To explain: I've got a mget field and want to display the actual position of the cursor. With OnKeydown I get the position where the cursor was before I pressed a key.
Maybe someone has got an idea?

Thanks in advance.

Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Multiget: reading position of the cursor
Posted: Mon Feb 21, 2011 11:48 AM

to make what ?

Best Regards, Saludos



Falconi Silvio
Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Re: Multiget: reading position of the cursor
Posted: Mon Feb 21, 2011 12:31 PM
Silvio wrote:to make what ?

I need the actual column of the cursor after KeyDown has been processed. So if the cursor blinks at position 3 and I press the right-arrow key, the cursor jumps to position 4, which is the value I need. But with OnKeyDown I get value 3. (I guess, because OnKeyDown is being processed before the actual pressed right-arrow key)

Example: notepad++ has an info at the bottom in which line number and at which column number the cursor is at the moment. That's what I want for my program (only column, don't need the line).
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Re: Multiget: reading position of the cursor
Posted: Mon Feb 28, 2011 02:54 PM

nobody an idea? Just need to know at which position the cursor is blinking...

Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Re: Multiget: reading position of the cursor
Posted: Tue Apr 05, 2011 03:46 PM

This problem isn't solved yet...
Maybe someone an idea?

Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Multiget: reading position of the cursor
Posted: Tue Apr 05, 2011 05:56 PM

Have you tried oGet:nPos?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Re: Multiget: reading position of the cursor
Posted: Wed Apr 06, 2011 07:38 AM
James Bott wrote:Have you tried oGet:nPos?

James

yes, but if I use it with bChanged it evaluates the position of the cursor before processing the movement of the cursor.
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Multiget: reading position of the cursor
Posted: Wed Apr 06, 2011 02:50 PM

Have you tried bKeydown?

Can you provide a small self contained test program?

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Re: Multiget: reading position of the cursor
Posted: Thu Apr 07, 2011 08:42 AM
James, bKeyDown won't work, because then the normal bKeyDown won't be processed anymore. So I used OnKeyDown which provides me with the position of the cursor before actually changing it. (Just use the left and right arrow keys and when the cursor jumps into the next line you'll see what my problem is.

Thanks for your help!

Code (fw): Select all Collapse
#include "fivewin.ch"

function main()
local oDlg, omGet, oGet
local cGet := 0
local cmGet := "Testing 1"+CRLF+"Testing 2"

    DEFINE DIALOG oDlg FROM 5, 5 TO 30, 44 TITLE "Cursor Position Test"

        @ 1,1 GET oGET VAR cGet OF oDlg SIZE 25,10 //DISABLED
        @ 3,1 GET omGet VAR cmGet OF oDlg SIZE 140,140 MULTILINE

        oGet:Disable()
        //omGet:bKeyDown := {|| oGet:cText := omGet:GetCol()}
        omGet:OnKeyDown := {|| oGet:cText := omGet:GetCol()}

    ACTIVATE DIALOG oDlg

return .t.
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Multiget: reading position of the cursor
Posted: Fri Apr 08, 2011 11:37 AM

Gilbert,

Please try it this way:

    oGet:OnKeyDown := { || oGet:cText := omGet:GetCol() }
    omGet:OnKeyDown := { || oGet:PostMsg( WM_KEYDOWN ) }
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Re: Multiget: reading position of the cursor
Posted: Fri Apr 08, 2011 12:38 PM

Antonio,

many thanks, it is working fine now :D

Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Multiget: reading position of the cursor
Posted: Fri Apr 08, 2011 12:44 PM

>it is working fine now

Except that it shows 1 when first run, and actually it should show 10.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
Re: Multiget: reading position of the cursor
Posted: Fri Apr 08, 2011 02:22 PM

James,

you're right, but because I position the cursor at column 1 when I initialize the multiline get, it's ok for me.

However, another small problem came up: when I use the mouse to reposition the cursor the position isn't updated.

Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de

Continue the discussion