Page 8 of 15
HMG 3.1.4 (Test)
Posted: Thu Jun 20, 2013 7:59 pm
by Pablo César
Carlos Britos wrote:This is a capture of your sample with my changes on XP sp3.
Compiled with hmg 3.1.2
VERY SORRY Carlos, my fault !
(I was testing with .."Form_1")[2]..)
It is working with:
Setcuebanner(GetControlHandle("Spinner_1","Form_1")[1],"Spinner CueBanner",.t.) // Third parameter is for not dissapear when getfocus
At Win XP SP3, but will need to delete "0", which it´s means that we should find a way to let it EMPTY in the TextBox of Spinner in order to see CueBanner display.
I have tested with 3.0.46 and 3.1.4. Here my updated sample:
Code: Select all
/* SetCueBanner Demo2.prg which works in ANSI and UNICODE
Author: Carlos Britos
Contributor: Pablo César
Important: SetCueBanner() does not show aAnything in Win XP (any Service Pack).
On some configurations of WinXP, there is a known problem with SetCueBanner().
Solution: In the Control Panel/Regional and Language Options (On the Languages tab)
The removal of Operating System support for Complex Scripts
The removal of Operating System support for East Asian languages
*/
#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
TOOLTIP "Put your name"
END TEXTBOX
DEFINE TEXTBOX Text_2
ROW 40
COL 10
WIDTH 200
TOOLTIP "Put your address"
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 "" // must be "" for cuebanner
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.)
SetCueBanner(GetControlHandle("Spinner_1","Form_1")[1],"Spinner CueBanner",.t.)
SetCueBanner(FindWindowEx(GetControlHandle("Combo_1","Form_1"),0,"Edit",Nil),"ComboBox CueBanner",.t.)
SetCueBanner(GetControlHandle("Edit_1","Form_1"),"EditBox CueBanner",.t.)
SetCueBanner(GetControlHandle("RichEdit_1","Form_1"),"RichEditBox CueBanner",.t.)
Form_1.center
Form_1.activate
Return Nil
#pragma BEGINDUMP
#define COMPILE_HMG_UNICODE // Remove this for ANSI building
#include <HMG_UNICODE.h> // Remove this for ANSI building
#include <windows.h>
#include <commctrl.h>
#define EM_SETCUEBANNER 5377 // Set the cue banner with the lParm = LPCWSTR
HB_FUNC( SETCUEBANNER ) // (nEditHandle, cMsg, lGetFocus) -> 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
I do not know what is happing in SP2... Also third paramter does not take any effect at XP... It's a pity !

HMG 3.1.4 (Test)
Posted: Thu Jun 20, 2013 8:08 pm
by Pablo César
Rathinagiri wrote:The behaviour is optional. You have to change WPARAM to 0 or 1 to change the behaviour of your choice.
SendMessage((HWND) hWnd1,EM_SETCUEBANNER, (WPARAM)(int) 1,(LPARAM) HMG_parc(2) );
or
SendMessage((HWND) hWnd1,EM_SETCUEBANNER, (WPARAM)(int) 0,(LPARAM) HMG_parc(2) );
Your code Rathi in WinXP SP3 it is working (not in SP2), but this behaviour does not take any effects. What it's means that always dissapear at Getting focus (same behaviour than Carlos example, not working well this erd parameter). In my example above, I put optional 3rd parameter for user optional define.
This is your updated example if do you wish to be included at next samples releases:
Code: Select all
/* Demo1.prg */
#include <hmg.ch>
Function Main
Define window Form_1 at 0, 0 width 400 height 300 main Title "Demo1 - Rathi example"
Define TextBox name
Row 10
Col 10
Width 200
End Textbox
Define TextBox address
Row 40
Col 10
Width 200
End Textbox
End window
SetTextBoxCueBanner("Form_1","name","Enter your name here")
SetTextBoxCueBanner("Form_1","address","Enter address here")
Form_1.center
Form_1.activate
Return Nil
Function SetTextBoxCueBanner(cParent,cControl,cText)
Local nHandle := GetControlHandle(cControl,cParent)
_SetTextBoxCueBanner(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 ( _SETTEXTBOXCUEBANNER )
{
HWND hWnd1;
hWnd1 = (HWND) hb_parnl (1);
SendMessage((HWND) hWnd1,EM_SETCUEBANNER, (WPARAM) hb_parl(3),(LPARAM) HMG_parc(2) );
}
#pragma ENDDUMP
This code, not working for ANSI versions, need some implementations.
And I am very happy Rathi, because based in your example was posible to get a new functional source.
HMG 3.1.4 (Test)
Posted: Fri Jun 21, 2013 1:29 pm
by Pablo César
Pablo César wrote: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.)
I Based on the example of Carlos, I'm not getting even find the right handle of the control components of EditBox and RichEditBox.
Definitions of EM_SETCUEBANNER message by MSDN says:
Sets the textual cue, or tip, that is displayed by the edit control to prompt the user for information.
So these EDIT controls (EditBox and RichEditBox) should be possible to setcuebanner, but I can not find the way.
I have tried with:
wapi_GetDlgItem
GetDlgItemText
GetDlgItemInt
GetDlgCtrlId
But unsuccesfully... so please, I need a help...
And another question: is it possible to let Spinners with not value when at starting ?
Re: HMG 3.1.4 (Test)
Posted: Fri Jun 21, 2013 2:03 pm
by Rathinagiri
And another question: is it possible to let Spinners with not value when at starting ?
Use empty string as the value.
Please see below:
Code: Select all
#include <hmg.ch>
function main
define window x at 0, 0 width 400 height 300 main
define spinner s1
row 10
col 10
rangemin 10
rangemax 100
value ''
end spinner
define spinner s2
row 40
col 10
rangemin 100
rangemax 300
end spinner
end window
x.center
x.activate
return nil
HMG 3.1.4 (Test)
Posted: Fri Jun 21, 2013 2:13 pm
by Pablo César
Rathinagiri wrote:Use empty string as the value.
Thank you Rathi ! It's working for Spinner.
HMG 3.1.4 (Test)
Posted: Fri Jun 21, 2013 3:02 pm
by Pablo César
Pablo César wrote:In midle of way... but I can say it working in XP SP3 not in XP SP2...
..//..
I do not know what is happing in SP2...
Sorry, this is a wrong information !
If you have installed east asian language and complex script support, CueBanner will be affected with stop working.
SetCueBanner() does not show aAnything in Win XP (any Service Pack). On some configurations of WinXP, there is a known problem with SetCueBanner(). The situation can arise that even though the EM_SETCUEBANNER is set, no cue banner is shown.
Unfortunately, there really is no workaround at the moment, in the shipping versions of Windows. The choice has to be explicitly made between language support and cue banners.
But there are two known things that may help. In the Control Panel/Regional and Language Options (On the Languages tab):
- The removal of Operating System support for Complex Scripts
The removal of Operating System support for East Asian languages.
Both of these will require a reboot.
Then SetCueBanner will work in XP.
Re: HMG 3.1.4 (Test)
Posted: Fri Jun 21, 2013 4:07 pm
by Rathinagiri
Thanks for the information Pablo.
So, it won't work for us since we have to install East Asian/Complex script languages.
In Win7 it works fine.
HMG 3.1.4 (Test)
Posted: Fri Jun 21, 2013 5:03 pm
by Pablo César
Rathinagiri wrote:So, it won't work for us since we have to install East Asian/Complex script languages.
It is OS limitation with these "Supplemental language support", but will be interesting to know if remove this "
Supplemental language support" will affect your WinXP with default asian language there at yours. Probably will not affect much, can be this confirmed, can you test it there (at any PC with XP) ?
Re: HMG 3.1.4 (Test)
Posted: Sat Jun 22, 2013 4:27 am
by srvet_claudio
Hi Boys.
This is the power of event handling, HMG now can read the keyboard and intercept virtually all windows messages before they reach the application.
Try the example with the EXE file, tomorrow I prepare a patch with the upgrades.
Re: HMG 3.1.4 (Test)
Posted: Sat Jun 22, 2013 5:15 am
by bpd2000
srvet_claudio wrote:Hi Boys.
This is the power of event handling, HMG now can read the keyboard and intercept virtually all windows messages before they reach the application.
Try the example with the EXE file, tomorrow I prepare a patch with the upgrades.
Thank you, Sir
Please include code to create log file also