Page 6 of 15

Re: HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 4:49 pm
by Carlos Britos
Hi.
the below attachments, capture and exe are on Xp.
The exe is not an HMG code but the related function SetCuebanner() is Almost identical. The exe is just to show the behaviour. The exe wwas compiled with harboour 3.2 and bcc but is the same with MinGW. Unicode and Ansi.

HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 5:01 pm
by Pablo César
Hi Carlos, thank you for your patience and contribution. But your exe here in WinXP SP2 lamentably not working...
Screen95.PNG
Screen95.PNG (12.29 KiB) Viewed 5098 times
Shall be SP2/SP3 the problem ?

In Win7 is working perfectly.

Re: HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 5:03 pm
by Carlos Britos
Pablo César wrote: Shall be SP2/SP3 the problem ?
In Win7 is working perfectly.
Maybe I have sp3

HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 5:06 pm
by Pablo César
And for Spinner and ComboBox did not worked in HMG (even in Win7) and also not for EDITBOX, RICHEDITBOX (these last two, you said already not working).

HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 5:10 pm
by Pablo César
Rathinagiri wrote:CueBanner is supported in XP as declared in MSDN here.

http://msdn.microsoft.com/en-us/library ... 85%29.aspx

And as the MSDN suggests,

"Note To use this API, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see Enabling Visual Styles."

We have a manifest file in HMG Resource path. But how to enable!?
Yes Rathi, I also have found this... but I still do not understanding. I guess something in C:\hmg.3.1.4\MINGW\include\commctrl.h where COMCTL32_VERSION is declare to 5 or 6... but this is in MINIGW.

Re: HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 5:13 pm
by Carlos Britos
Pablo César wrote:And for Spinner and ComboBox did not worked in HMG (even in Win7) and also not for EDITBOX, RICHEDITBOX (these last two, you said already not working).
Remember combobox and spinner are specials controls, two or more in one.
The combobox has listbox + textbox or label and spinner has updown + textbox.
To set the cuebanner you need the handle of the edit part. The textbox of combobox or spinner.

HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 5:27 pm
by Pablo César
Carlos Britos wrote:Remember combobox and spinner are specials controls, two or more in one.
The combobox has listbox + textbox or label and spinner has updown + textbox.
To set the cuebanner you need the handle of the edit part. The textbox of combobox or spinner.
Ahhh yes, you are right. I do not know how to do it, I will continue searching...

Code: Select all

#include <hmg.ch>

Function Main
Define window Form_1 at 0, 0 width 400 height 300 main Title "Demo2 - Carlos example"
	DEFINE TEXTBOX Text_1
        ROW    10
        COL    10
        WIDTH  200
    END TEXTBOX

    DEFINE TEXTBOX Text_2
        ROW    40
        COL    10
        WIDTH  200
    END TEXTBOX

    DEFINE EDITBOX Edit_1
        ROW    10
        COL    230
        WIDTH  120
        HEIGHT 110
        VALUE ""
    END EDITBOX

    DEFINE COMBOBOX Combo_1
        ROW    70
        COL    10
        WIDTH  200
        HEIGHT 100
        ITEMS {"Item 1","Item 2","Item 3"}
        VALUE 0
    END COMBOBOX

    DEFINE SPINNER Spinner_1
        ROW    100
        COL    10
        WIDTH  200
        HEIGHT 24
        RANGEMIN 1
        RANGEMAX 10
        VALUE 0
    END SPINNER

    DEFINE RICHEDITBOX RichEdit_1
        ROW    130
        COL    230
        WIDTH  120
        HEIGHT 90
        VALUE ""
    END RICHEDITBOX
End window
SetTextBoxCueBanner("Form_1","Text_1","Enter your name here")
SetTextBoxCueBanner("Form_1","Text_2","Enter address here")

SetTextBoxCueBanner("Form_1","Spinner_1","Spinner CueBanner")
SetTextBoxCueBanner("Form_1","Combo_1","ComboBox CueBanner")

SetTextBoxCueBanner("Form_1","Edit_1","EditBox CueBanner")
SetTextBoxCueBanner("Form_1","RichEdit_1","RichEditBox CueBanner")
Form_1.center
Form_1.activate
Return Nil

Function SetTextBoxCueBanner(cParent,cControl,cText)
Local nHandle := GetControlHandle(cControl,cParent)

Setcuebanner(nHandle,cText,.t.) // Third parameter is for not dissapear when getfocus
Return Nil

#pragma BEGINDUMP

#define COMPILE_HMG_UNICODE
#include <HMG_UNICODE.h>

#include <windows.h>
#include <commctrl.h>

#define ECM_FIRST         0x1500          // Edit control messages
#define EM_SETCUEBANNER  (ECM_FIRST + 1)  // Set the cue banner with the lParm = LPCWSTR

HB_FUNC( SETCUEBANNER )                    // (editHandle, cMsg) -> nil
{
   #ifdef UNICODE
      LPWSTR lpWCStr = HMG_parc(2) ;
   #else
      LPWSTR lpWCStr = (LPCWSTR) ( hb_parc(2) == NULL ) ? NULL : hb_mbtowc( (const char *) hb_parc(2) ) ;
   #endif
   SendMessage( (HWND) hb_parnl(1), EM_SETCUEBANNER, (WPARAM) hb_parl(3), (LPARAM) (LPCWSTR) lpWCStr ) ;
   SysFreeString( lpWCStr );
}

#pragma ENDDUMP
May you try to correct this code for us ?

Probably for EditBox and RichEditBox would exist a way for do it too...

Re: HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 6:20 pm
by Carlos Britos
Please try with code
Note that:
in spinner GetControlHandle() return an array. So SetTextBoxCueBanner() need a trick to work.
in combobox I'm using FindWindowEx( GetControlHandle( "Combo_1", "Form_1" ), 0, "Edit", Nil ) to get the handle of textbox.
Probably for EditBox and RichEditBox would exist a way for do it too...
Probably, I'd tried time ago but with no luck, sorry.

Code: Select all

#include <hmg.ch>

Function Main
Define window Form_1 at 0, 0 width 400 height 300 main Title "Demo2 - Carlos example"
   DEFINE TEXTBOX Text_1
        ROW    10
        COL    10
        WIDTH  200
    END TEXTBOX

    DEFINE TEXTBOX Text_2
        ROW    40
        COL    10
        WIDTH  200
    END TEXTBOX

    DEFINE EDITBOX Edit_1
        ROW    10
        COL    230
        WIDTH  120
        HEIGHT 110
        VALUE ""
    END EDITBOX

    DEFINE COMBOBOX Combo_1
        ROW    70
        COL    10
        WIDTH  200
        HEIGHT 100
        ITEMS {"Item 1","Item 2","Item 3"}
        VALUE 0
        DISPLAYEDIT .T.      // must be .T. for cuebanner
    END COMBOBOX

    DEFINE SPINNER Spinner_1
        ROW    100
        COL    10
        WIDTH  200
        HEIGHT 24
        RANGEMIN 1
        RANGEMAX 10
        VALUE 0
    END SPINNER

    DEFINE RICHEDITBOX RichEdit_1
        ROW    130
        COL    230
        WIDTH  120
        HEIGHT 90
        VALUE ""
    END RICHEDITBOX
End window

SetTextBoxCueBanner("Form_1","Text_1","Enter your name here")
SetTextBoxCueBanner("Form_1","Text_2","Enter address here")

// SetTextBoxCueBanner("Form_1","Spinner_1","Spinner CueBanner")
// SetTextBoxCueBanner("Form_1","Combo_1","ComboBox CueBanner")

Setcuebanner(FindWindowEx( GetControlHandle( "Combo_1", "Form_1" ), 0, "Edit", Nil ),"ComboBox CueBanner",.f.)
Setcuebanner( GetControlHandle( "Spinner_1", "Form_1" )[1],"Spinner CueBanner",.f.)

SetTextBoxCueBanner("Form_1","Edit_1","EditBox CueBanner")
SetTextBoxCueBanner("Form_1","RichEdit_1","RichEditBox CueBanner")

Form_1.center
Form_1.activate
Return Nil

Function SetTextBoxCueBanner(cParent,cControl,cText)
Local nHandle := GetControlHandle(cControl,cParent)

Setcuebanner(nHandle,cText,.f.)
Return Nil

#pragma BEGINDUMP

#define COMPILE_HMG_UNICODE
#include <HMG_UNICODE.h>

#include <windows.h>
#include <commctrl.h>

#define ECM_FIRST         0x1500          // Edit control messages
#define EM_SETCUEBANNER  (ECM_FIRST + 1)  // Set the cue banner with the lParm = LPCWSTR

HB_FUNC( SETCUEBANNER )                    // (editHandle, cMsg) -> nil
{
   #ifdef UNICODE
      LPWSTR lpWCStr = HMG_parc(2) ;
   #else
      LPWSTR lpWCStr = (LPCWSTR) ( hb_parc(2) == NULL ) ? NULL : hb_mbtowc( (const char *) hb_parc(2) ) ;
   #endif
   SendMessage( (HWND) hb_parnl(1), EM_SETCUEBANNER, (WPARAM) hb_parl(3), (LPARAM) (LPCWSTR) lpWCStr ) ;
   SysFreeString( lpWCStr );
}

#pragma ENDDUMP


Re: HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 6:39 pm
by Carlos Britos
Hi Pablo

En MSDN I saw this comment:
wParam option note

wParam TRUE - only appears to work on Vista.

Under XP the cue text always disappears when the control gets focus regardless of this parameter.
Stanley Roark
4/13/2009
Can you try if this is true for us ?
Maybe is the problem with sp2

Re: HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 6:41 pm
by srvet_claudio
Remember combobox and spinner are specials controls, two or more in one.
The combobox has listbox + textbox or label and spinner has updown + textbox.
To set the cuebanner you need the handle of the edit part. The textbox of combobox or spinner.
Hi boys,
this is how to get all handles of a control:

Code: Select all

hControl := GetControlHandle (cControlName, cParentName)

IF Valtype (hControl) == "A"
    FOR i = 1 TO LEN(hControl)
        ControlHandle := hControl [i]
        ProcessControlHandle (ControlHandle)
    NEXT
ELSE
    ControlHandle := hControl
    ProcessControlHandle (ControlHandle)
ENDIF


Procedure ProcessControlHandle (ControlHandle)
   // code for process ControlHandle
Return