Page 2 of 2

Re: Problem with TGET class in FWH 13.08

PostPosted: Mon Sep 30, 2013 5:33 pm
by Antonio Linares
James,

yes, they can be used from resources too. Anyhow the more users that try it the better to improve it :-)

Re: Problem with TGET class in FWH 13.08

PostPosted: Mon Sep 30, 2013 6:38 pm
by driessen
Antonio,

Is there an example available in the samples of the TEdit class used from resources?
I can't find one.
If not, can you provide one here?

Thanks a lot in advance.

Re: Problem with TGET class in FWH 13.08

PostPosted: Mon Sep 30, 2013 8:00 pm
by Antonio Linares
Michel,

testedi2.prg
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg, cTest := "Hello world"

   DEFINE DIALOG oDlg RESOURCE "Test"

   REDEFINE EDIT cTest ID 110 OF oDlg

   REDEFINE BUTTON ID 120 OF oDlg ACTION MsgInfo( cTest )

   ACTIVATE DIALOG oDlg CENTERED

return nil


testedi2.rc
Code: Select all  Expand view
#ifdef __FLAT__
  1 24 "winxp\WindowsXP.Manifest"
#endif

#ifdef __64__
  1 24 "winxp\WindowsXP.Manifest64"
#endif

Test DIALOG 0, 0, 300, 150
STYLE DS_MODALFRAME | WS_BORDER | WS_DLGFRAME | WS_POPUP | WS_SYSMENU
FONT 8, "MS Sans Serif"
CAPTION "Dialog"
BEGIN
    EDITTEXT  110, 11, 11, 80, 13, ES_AUTOHSCROLL
    PUSHBUTTON "&Value", 120, 112, 112, 60, 17
END


Also in FiveWin.ch this command is needed: (We did not include it in FWH yet)
Code: Select all  Expand view
#xcommand REDEFINE EDIT [ <oEdit> VAR ] <uVar> ;
            [ ID <nId> ] ;
            [ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
       => ;
          [ <oEdit> := ] TEdit():Redefine( <nId>, [<oWnd>],;
                                           bSETGET(<uVar>) )


And finally in edit.prg a change is required:
Code: Select all  Expand view
METHOD ReDefine( nId, oWnd, bSetGet ) CLASS TEdit

   DEFAULT oWnd := GetWndDefault()

   ::nId     = nId
   ::oWnd    = oWnd
   ::bSetGet = bSetGet

   oWnd:DefControl( Self )

return Self


Thanks for testing it and for your feedback :-)

Re: Problem with TGET class in FWH 13.08

PostPosted: Mon Sep 30, 2013 10:27 pm
by driessen
Antonio,

Tedit class from resources is working fine the way you suggested it.

I noticed one problem (for me).

If the Tedit field has the focus, and you press the end-key on your keyboard, then the cursor goes to the end of the datafield, spaces included.
Shouldn't it be more logic that the cursor goes just behind the last character if the end-key is pressed?

Will the changes you suggested be included in FWH 13.09?

Thanks.

Re: Problem with TGET class in FWH 13.08

PostPosted: Tue Oct 01, 2013 5:16 am
by Antonio Linares
Michel,

If we do that, then it will not be Windows standard. So we are again in a similar situation, allowing non standard Windows behaviors.

But we can do it, if you need it :-)

Yes, its already included for FWH 13.09

Re: Problem with TGET class in FWH 13.08

PostPosted: Tue Oct 01, 2013 8:04 am
by Enrico Maria Giordano
Antonio,

Antonio Linares wrote:If we do that, then it will not be Windows standard.


As far as I know, it is Windows standard behavior to put the caret after the last non-space character. Am I wrong?

EMG

Re: Problem with TGET class in FWH 13.08

PostPosted: Tue Oct 01, 2013 8:17 am
by Antonio Linares
Enrico,

If you run the testedi2.prg that I published here, and change the variable this way:

local oDlg, cTest := "Hello world "

then if you press end, it goes to the end of the string (including spaces) and we do nothing with the keyboard there. In fact, I have declared both methods as virtual:

METHOD KeyDown() VIRTUAL

METHOD KeyChar() VIRTUAL

So it seems as this is the default behavior. I have also removed ES_AUTOHSCROLL from the RC and the same behavior.

More over, if you test it from PellesC resources editor, you will see that if you add some spaces to the end of the text, the caret goes to the end of the spaces. So the only way not to have that behavior is that the variable have NO spaces at the end.

Maybe I am missing something... :-)

Re: Problem with TGET class in FWH 13.08

PostPosted: Tue Oct 01, 2013 8:22 am
by Enrico Maria Giordano
Antonio,

Antonio Linares wrote:Maybe I am missing something... :-)


No, you are right and I was wrong. :-)

The unusual behavior is exactly the spaces after the text...

EMG

Re: Problem with TGET class in FWH 13.08

PostPosted: Tue Oct 01, 2013 9:46 am
by driessen
Antonio,

One more question about Tedit class : how do we define the picture?

Thanks.

Re: Problem with TGET class in FWH 13.08

PostPosted: Tue Oct 01, 2013 10:55 am
by Antonio Linares
Michel,

The fact is a that a standard Windows Edit control does not support pictures :-(

http://msdn.microsoft.com/en-us/library/windows/desktop/bb775458(v=vs.85).aspx

thats the whole point for using a related Harbour GET, to get pictures and masks.

Re: Problem with TGET class in FWH 13.08

PostPosted: Tue Oct 01, 2013 4:33 pm
by James Bott
One interesting point RE spaces.

With (x)Harbour we limit the length of the input by padding any data with spaces so we often have spaces at the end of the text.

I tried a standard Microsoft Windows app (Outlook Express) and by default the fields have no length (and no spaces) and allow you to enter data up to a set length. I don' know how that length is determined. When you enter a field and then press the End button, the cursor doesn't move. Perhaps there is a property to set the field length?

James

Re: Problem with TGET class in FWH 13.08

PostPosted: Tue Oct 01, 2013 5:01 pm
by Enrico Maria Giordano
James,

James Bott wrote:One interesting point RE spaces.

With (x)Harbour we limit the length of the input by padding any data with spaces so we often have spaces at the end of the text.

I tried a standard Microsoft Windows app (Outlook Express) and by default the fields have no length (and no spaces) and allow you to enter data up to a set length. I don' know how that length is determined. When you enter a field and then press the End button, the cursor doesn't move. Perhaps there is a property to set the field length?

James


Yes, the EM_LIMITTEXT message. :-)

EMG