Page 1 of 1
How to make memo edit in dialog automatic selectnone?
Posted: Thu Aug 24, 2017 2:01 pm
by Gale FORd
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.
Re: How to make memo edit in dialog automatic selectnone?
Posted: Thu Aug 24, 2017 2:23 pm
by Rick Lipkin
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: Select all
oMemo:bGotFocus = { || oMemo:SetSel( 0, 0 ),;
oMemo:Goto( oMemo:GetLineCount() ),;
__Keyboard( Chr( VK_END ) ) }
Re: How to make memo edit in dialog automatic selectnone?
Posted: Thu Aug 24, 2017 2:47 pm
by Gale FORd
Thanks,
This line was enough for my purposes.
oGet1:bGotFocus = { || oGet1:SetSel( 0, 0 ) }
Re: How to make memo edit in dialog automatic selectnone?
Posted: Fri Aug 25, 2017 11:42 am
by byte-one
Another problem: I can not switch between insert and overwrite. (is always insert) but the cursortype is overwrite.
Re: How to make memo edit in dialog automatic selectnone?
Posted: Fri Aug 25, 2017 12:34 pm
by Rick Lipkin
Günther
I place this at the top of my Main program :
Code: Select all
// 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
Re: How to make memo edit in dialog automatic selectnone?
Posted: Sun Aug 27, 2017 3:48 pm
by byte-one
Thanks Rick!
Code: Select all
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.