How to make memo edit in dialog automatic selectnone?

How to make memo edit in dialog automatic selectnone?

Postby Gale FORd » Thu Aug 24, 2017 2: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.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

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

Postby Rick Lipkin » Thu Aug 24, 2017 2: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: Select all  Expand view

oMemo:bGotFocus = { || oMemo:SetSel( 0, 0 ),;
                         oMemo:Goto( oMemo:GetLineCount() ),;
                         __Keyboard( Chr( VK_END ) ) }


 
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

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

Postby Gale FORd » Thu Aug 24, 2017 2:47 pm

Thanks,
This line was enough for my purposes.
oGet1:bGotFocus = { || oGet1:SetSel( 0, 0 ) }
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

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

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

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

Postby Rick Lipkin » Fri Aug 25, 2017 12:34 pm

Günther

I place this at the top of my Main program :

Code: Select all  Expand view

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

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

Postby byte-one » Sun Aug 27, 2017 3:48 pm

Thanks Rick!

Code: Select all  Expand view

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 40 guests