FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to make memo edit in dialog automatic selectnone?
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
How to make memo edit in dialog automatic selectnone?
Posted: Thu Aug 24, 2017 02:01 PM

Has anyone found a way to have memo edit default to selectnone or unselect text during ON INIT?
I have tried many different ways to get the memo edit not to select all automatically.
This has caused more than 1 person to accidentally erase memo with keystroke.

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: How to make memo edit in dialog automatic selectnone?
Posted: Thu Aug 24, 2017 02:23 PM
Gale

Insert this code after your memo get statement .. what this code does is move the cursor to the first character and unselects All..

Rick Lipkin

Code (fw): Select all Collapse
oMemo:bGotFocus = { || oMemo:SetSel( 0, 0 ),;
                         oMemo:Goto( oMemo:GetLineCount() ),;
                         __Keyboard( Chr( VK_END ) ) }
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: How to make memo edit in dialog automatic selectnone?
Posted: Thu Aug 24, 2017 02:47 PM

Thanks,
This line was enough for my purposes.
oGet1:bGotFocus = { || oGet1:SetSel( 0, 0 ) }

Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: How to make memo edit in dialog automatic selectnone?
Posted: Fri Aug 25, 2017 11:42 AM

Another problem: I can not switch between insert and overwrite. (is always insert) but the cursortype is overwrite.

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: How to make memo edit in dialog automatic selectnone?
Posted: Fri Aug 25, 2017 12:34 PM
Günther

I place this at the top of my Main program :

Code (fw): Select all Collapse
// replaces overstrike in gets
Set( _SET_INSERT, .t. )
TGet():lChangeCaret := .f.


This globally sets all fields to insert rather to overstrike .. a bit clumsy, but it works.

Rick Lipkin
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: How to make memo edit in dialog automatic selectnone?
Posted: Sun Aug 27, 2017 03:48 PM
Thanks Rick!

Code (fw): Select all Collapse
local lSet := Set( _SET_INSERT) 
Set( _SET_INSERT, .t. )
TMultiGet():lChangeCaret := .t.
....
@ 1,1 redefine oMulti MULTIGET....  
....
Set( _SET_INSERT, lSet)


This is right code. After leaving the multiget i change to old mode. I have also tested with ::gotfocus and ::lostfocus to Change the caret.

Antonio, as the multiget cannot switch off the insert-mode, the caret should be always shown as block on this control.
Regards,
Günther
---------------------------------
office@byte-one.com

Continue the discussion