Page 7 of 15

HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 7:18 pm
by Pablo César
In midle of way... but I can say it working in XP SP3 not in XP SP2 (at least on my pc) and Spinner did not worked at all. I saw Spinner handle return an array with two elements (by MsgDebug) I have tested both handles and nothing about cuebanner in this component. In ComboBox is working.

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 0
        RANGEMAX 10
        VALUE 0
    END SPINNER

    DEFINE RICHEDITBOX RichEdit_1
        ROW    130
        COL    230
        WIDTH  120
        HEIGHT 90
        VALUE ""
    END RICHEDITBOX
End window
Setcuebanner(GetControlHandle("Text_1","Form_1"),"Enter your name here",.t.) // Third parameter is for not dissapear when getfocus
Setcuebanner(GetControlHandle("Text_2","Form_1"),"Enter address here",.t.) // Third parameter is for not dissapear when getfocus

Setcuebanner(GetControlHandle("Spinner_1","Form_1")[2],"Spinner CueBanner",.t.) // Third parameter is for not dissapear when getfocus
Setcuebanner(FindWindowEx(GetControlHandle("Combo_1","Form_1"),0,"Edit",Nil),"ComboBox CueBanner",.t.) // Third parameter is for not dissapear when getfocus

Setcuebanner(GetControlHandle("Edit_1","Form_1"),"EditBox CueBanner",.t.) // Third parameter is for not dissapear when getfocus
Setcuebanner(GetControlHandle("RichEdit_1","Form_1"),"RichEditBox CueBanner",.t.) // Third parameter is for not dissapear when getfocus
Form_1.center
Form_1.activate
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
Here you can see in WinXP SP3:
CueBanner.PNG
CueBanner.PNG (12.72 KiB) Viewed 5155 times
I have also seen this: http://www.autohotkey.com/board/topic/5 ... /?p=492749 using an old way taht could probably works... (but I do not know how to do it)..

HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 7:22 pm
by Pablo César
Your cue.exe example Carlos, is working but on WinXP SP3 not in SP2.

HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 7:24 pm
by Carlos Britos
Have you tried deleting the 0?

HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 7:27 pm
by Pablo César
Carlos Britos wrote:Have you tried deleting the 0?
Do you means to put Nil in Spinner Value at declaration ? If it so, yeas I tried and still not working.

Re: HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 7:30 pm
by Carlos Britos
Pablo César wrote:
Carlos Britos wrote:Have you tried deleting the 0?
Do you means to put Nil in Spinner Value at declaration ? If it so, yeas I tried and still not working.
No just selecting with mouse, cut and make focus on another control

Re: HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 7:33 pm
by Pablo César
Carlos Britos wrote:No just selecting with mouse, cut and make focus on another control
Even letting empty TextBox of Spinner and getting focus in other component, not working.

Re: HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 7:36 pm
by Carlos Britos
Pablo César wrote:
Carlos Britos wrote:No just selecting with mouse, cut and make focus on another control
Even letting empty TextBox of Spinner and getting focus in other component, not working.
I have no idea what happening, here works well on Xp sp3.

Re: HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 7:38 pm
by Pablo César
Carlos Britos wrote:I have no idea what happening, here works well on Xp sp3.
Working well your cue.exe been sent from you (XP SP3 and Win7) but this example (Spinner case in my last source) even NOT works in Win7...

HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 7:43 pm
by Pablo César
srvet_claudio wrote: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
Yes Claudio, Carlos advised me that Spinner returns an array with two elements. But still no right way for CueBanner in Spinner component. Also it is working in XP SP3 not SP2.

But an interesting thing Claudio. Why Carlos is using FindWindowEx for getting ComboBox handle ?

Setcuebanner(FindWindowEx(GetControlHandle("Combo_1","Form_1"),0,"Edit",Nil),"ComboBox CueBanner",.t.)

Re: HMG 3.1.4 (Test)

Posted: Thu Jun 20, 2013 7:50 pm
by Carlos Britos
Pablo César wrote:
Carlos Britos wrote:I have no idea what happening, here works well on Xp sp3.
Working well your cue.exe been sent from you (XP SP3 and Win7) but this example (Spinner case in my last source) even NOT works in Win7...
This is a capture of your sample with my changes on XP sp3.
Compiled with hmg 3.1.2