TMultiGet overstrike capability

TMultiGet overstrike capability

Postby Roger Seiler » Sun Aug 20, 2006 3:00 am

Tmultiget seems to be frozen in insert mode regardless of user's pressing of the insert key. So I created a workaround that simulates Clipper's oGet:Overstrike() for TMultiget as follows, similar to usage in TGet...

// Insert in methods declarations for TMultiGet of Mget.prg...

// Simulate a Clipper Get system method...
METHOD Overstrike()

//-------------------------------------------

// Insert in METHOD KeyChar() just after declaration of locals...

// Adapted from Tget...
IF nKey >= 32 .and. nKey < 256
if Set( _SET_INSERT )
// Do nothing because Mget is frozen in insert mode.
else
// Use workaround to get same effect as Clipper's Overstrike()
::Overstrike( Chr( nKey ) )
end
ENDIF
//

//-------------------------------------------
// Add this method to bottom of Mget.prg file...

// This is a workaround to enable overstriking though Mget is actually frozen
// in insert mode regardless of the _SET_INSERT setting...

METHOD Overstrike( cChar ) CLASS TMultiGet
LOCAL cOld := "",nLen := 0,cNewMem := "",nPos1 := 1

// Get existing text...
cOld = ::VarGet()
nLen := LEN(cOld)

// Get cursor pos where to insert...
::nPos = nLoWord( ::SendMsg( EM_GETSEL ) )


// Copy text to cNewMem out to position of newly inserted char...
cNewMem := SubStr( cOld, 1, ::nPos )
// Now add remainder of text, omitting the char just after the inserted char...
cNewMem := cNewMem + SubStr(cOld,::nPos+2,nLen)

// Replace multiline get memvar's text...
::VarPut(cNewMem)

nPos1 := ::nPos

// EMW - the text has been changed!
if ::bChange != nil
Eval( ::bChange,,, Self )
endif

// Refresh display of multiline get with new version of text...
::Refresh()
::SetPos(nPos1+1) // Put cursor at beg of next char

RETURN nil
*----------------------------------------------

- Roger
User avatar
Roger Seiler
 
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA

Postby Detlef Hoefner » Sun Aug 20, 2006 11:56 am

Thanks Roger,

i missed this get behaviour and i'll give it a try.

Best regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby RAMESHBABU » Mon Aug 21, 2006 2:30 am

Hi Mr.Roger

Good attempt to a missing feature in MGet Class.

I tested the method. I found that the method is not able to
insert/overwrite from the position where the cursor is positioned.
It is always taking from the beginning of the text.

FWH 2.7 + xHarbour 0.99.61

Regards,

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 625
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby Roger Seiler » Mon Aug 21, 2006 4:27 pm

To make new text go to the right place, make sure that you do NOT use the following code with your memo field: oMemo:bGotFocus := {|| SetPos(0,0) }

If you use the above code (which used to be needed in 16 bits to prevent automatic highlighting of text), then ::nPos will put the inserted text at the beginning of your memo's text.

Without the above bGotFocus, my TmultiGet puts the inserted or overstrike text exactly where I've placed the cursor.

- Roger
User avatar
Roger Seiler
 
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA

Postby Roger Seiler » Mon Aug 21, 2006 5:02 pm

Ramesh,

The more I think about it, the more unsure I am that my immediately previous post will solve the problem that you saw, and which I don't experience here. Another possibility is that ::VarPut() which is a Tcontrol method accesses bSetGet, might be an issue here. If you want to email your revised version of Mget.prg to me, along with the code you use to define work with your memo field, then I'll be glad to look at them and see if I can find something. You can email me to: roger[at]leadersoft[dot]com.

- Roger
User avatar
Roger Seiler
 
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA

Postby Roger Seiler » Mon Aug 21, 2006 5:20 pm

Another problem I've discovered with my overstrike "fix" for Mget is that it only works for text that is manually keyed in, and does not work for text that is pasted in. I'll figure out a way to make it work for pasting also.

- Roger
User avatar
Roger Seiler
 
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA

Postby Roger Seiler » Tue Aug 22, 2006 12:10 am

Nevermind. I see that standard Windows behavior when "overstrike" is on, is for a pasting of text to get inserted rather than to replace existing text. So the current behavior of TMultiGet is correct in this respect. Overstrike is only supposed to work with individual keystrokes, which is what the fix that I posted earlier enables. At least this fix works here if not for Ramesh.

- Roger
User avatar
Roger Seiler
 
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA

Postby RAMESHBABU » Tue Aug 22, 2006 3:03 am

Hi Mr. Roger

I am using FWH 2.7 July Build + xHarbour 0.99.61.

I have not used
oMemo:bGotFocus := {|| SetPos(0,0) }

anywhere in my test program.

Inspite of that I am not getting the expected result.

BTW which version of fivewin you are using?

I dont know how Mr.Antonio and his team has ignored this essential
feature!

Regards,

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 625
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby Antonio Linares » Tue Aug 22, 2006 6:43 am

Ramesh,

We are reviewing Roger's posts.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Roger Seiler » Tue Aug 22, 2006 2:26 pm

Ramesh,

I'm using FWH 2.7 as of March, 2006 and xHarbour Builder of the same date.

Unfortunately, I haven't been able to deduce why this workaround isn't working for you. It works okay on my apps. Maybe Antonio will create a better solution.

- Roger
User avatar
Roger Seiler
 
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA

Postby hua » Wed May 23, 2007 2:32 am

Is there an official solution to this issue?

--
xHb 0.96
FWH 2.8
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 42 guests