FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TMultiGet overstrike capability
Posts: 223
Joined: Thu Dec 01, 2005 03:34 PM
TMultiGet overstrike capability
Posted: Sun Aug 20, 2006 03: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
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
TMultiGet overstrike capability
Posted: Sun Aug 20, 2006 11:56 AM

Thanks Roger,

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

Best regards,
Detlef

Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
TMultiGet overstrike capability
Posted: Mon Aug 21, 2006 02: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
Posts: 223
Joined: Thu Dec 01, 2005 03:34 PM
TMultiGet overstrike capability
Posted: Mon Aug 21, 2006 04: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
Posts: 223
Joined: Thu Dec 01, 2005 03:34 PM
TMultiGet overstrike capability
Posted: Mon Aug 21, 2006 05: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
Posts: 223
Joined: Thu Dec 01, 2005 03:34 PM
TMultiGet overstrike capability
Posted: Mon Aug 21, 2006 05: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
Posts: 223
Joined: Thu Dec 01, 2005 03:34 PM
TMultiGet overstrike capability
Posted: 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
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
TMultiGet overstrike capability
Posted: Tue Aug 22, 2006 03: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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TMultiGet overstrike capability
Posted: Tue Aug 22, 2006 06:43 AM

Ramesh,

We are reviewing Roger's posts.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 223
Joined: Thu Dec 01, 2005 03:34 PM
TMultiGet overstrike capability
Posted: Tue Aug 22, 2006 02: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
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
TMultiGet overstrike capability
Posted: Wed May 23, 2007 02:32 AM

Is there an official solution to this issue?

--
xHb 0.96
FWH 2.8

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour

Continue the discussion