How to make memo edit in dialog automatic selectnone?

Post Reply
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

How to make memo edit in dialog automatic selectnone?

Post 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.
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: How to make memo edit in dialog automatic selectnone?

Post 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 ) ) }


 
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Re: How to make memo edit in dialog automatic selectnone?

Post by Gale FORd »

Thanks,
This line was enough for my purposes.
oGet1:bGotFocus = { || oGet1:SetSel( 0, 0 ) }
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: How to make memo edit in dialog automatic selectnone?

Post by byte-one »

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
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: How to make memo edit in dialog automatic selectnone?

Post 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
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: How to make memo edit in dialog automatic selectnone?

Post 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.
Regards,
Günther
---------------------------------
office@byte-one.com
Post Reply