Page 1 of 1

Insert/Overstrike Cursors in GETS

Posted: Sat May 19, 2007 4:03 pm
by PatrickWeisser
Our customers are used to seeing the thin vertical cursor (|) for both insert and overstrike mode (this is the behavior in Word, Quickbooks, and even the very text box I'm typing in right now on this forum). Does anyone know if there a way to either have the thin (|) cursor always appear in a GET, or at least reverse them and have the | cursor be for insert mode and the wider cursor for overstrike?

Thanks!

Posted: Sat May 19, 2007 4:48 pm
by Antonio Linares
Patrick,

In Class TGet comment out this code:

Code: Select all

           DestroyCaret()
           if Set( _SET_INSERT )
              CreateCaret( ::hWnd, 0, 6, ::nGetChrHeight() )
           else
              CreateCaret( ::hWnd, 0, 2, ::nGetChrHeight() )
           endif
           ShowCaret( ::hWnd )
and

Code: Select all

          DestroyCaret()
          CreateCaret( ::hWnd, 0, 6, ::nGetChrHeight() )
          ShowCaret( ::hWnd )

Posted: Mon May 21, 2007 9:04 am
by PatrickWeisser
Thanks Antonio, that worked perfectly. I actually used:

CreateCaret( ::hWnd, 0, 2, ::nGetChrHeight() )

...to get the smaller vertical bar cursor. I also made a change to the KeyChar() method in TGet.prg so that the GET text control will stop accepting characters in insert mode when the control is full, instead of having existing characters "fall off" on the right. This is more in keeping with the behavior of our current application I am porting. For consistency, I also changed the WM_PASTE case in HandleEvent() so that only as many characters as there is space remaining for in the control will be pasted, again preventing existing text in the control from being truncated on the right if the paste string is too big.

I think it's wonderful that you have opened up many of the FiveWin classes to user inspection and customization. For me personally they are a great learning tool since I have not done much object oriented programming as of yet. And having some of the FiveWin source code also gives us a glimpse at how very well designed and elegant FiveWin is internally.

-Patrick

Posted: Mon May 21, 2007 9:36 am
by Antonio Linares
Patrick,

glad to know you are moving forward and enjoying FiveWin :-)

Posted: Mon May 21, 2007 9:29 pm
by James Bott
Patrick,

>For me personally they are a great learning tool since I have not done much object oriented programming as of yet.

Have you read the articles about programming with OOP and Fivewin on my website? They may help.

http://ourworld.compuserve.com/homepage ... rogram.htm

Regards,
James

Posted: Tue May 22, 2007 1:18 am
by hua
Using testmem3.prg in the FWH's SAMPLES directory, I find pressing Insert button doesn't toggle between the 2 mode (insert/overstrike). How to solve this?

TIA

--
FWH 2.8

Do you have to recompile fivewin libaries

Posted: Sat May 26, 2007 9:22 am
by charles dominic
Hi Antonio Linares,

I have marked out the lines you mentioned in "/SOURCE/CLASSES/TGET.PRG"

Following which I recompiled a test app with a get object.

The change in "TGET.PRG" does not take place. The get object still changes to a thick line as before making the change.

What am I not doing ? Do you have to recompile fivewin libraries ? If so, can you tell me how?

Thank you.(hope if its not too much trouble.!)

Posted: Sat May 26, 2007 9:40 am
by Antonio Linares
You have to link the resulting GET.obj into your app

It works!

Posted: Sat May 26, 2007 11:58 am
by charles dominic
Hi Antonio,

Thanks for the reply. It works!.
It comes to me now that this is the same way things were done in clipper 5.2. Sorry but I am a bit rusty in clipper programming. I an including two working BAT scripts to convert the TGET.PRG into an OBJ. Could you just comment if its OK by you.

FILENAME: C.BAT
-------------------------------------------------------
ECHO Compiling from .PRG to .C

set hdir=\zz\xh
set fwhdir=\zz\fwxh
set bcdir=\zz\bcc55

%hdir%\bin\harbour /n /w /p /oOBJ\ /i%fwhdir%\include;%hdir%\include;%bcdir%\include %1 %2 %3 > clip.log
@TYPE clip.log


FILENAME: L.BAT
-------------------------------------------------------
@ECHO OFF
ECHO Compiling...From .C TO .OBJ

SET hdir=\zz\xh
SET fwh=\zz\fwxh
SET bcdir=\zz\bcc55

ECHO -oOBJ\%1 -I%fwh%\include;%hdir%\include;%bcdir%\include -L%fwh%\lib;%hdir%\lib;%bcdir%\lib OBJ\%1.c > l.bc

%bcdir%\bin\bcc32 -M -c -v @l.bc



Thanks a lot.

Posted: Sat May 26, 2007 3:42 pm
by Antonio Linares
Yes, it seems ok