Hint text, attempt #1 << Back

This is my attempt #1 for trying to provide "hint" text to a Form control. Since Windows XP (with Common Control 6.0, that means include a manifest file with your EXE), Microsoft has added the capability to the Edit (Form) control. The following was my first (sad) attempt to add that to VDF. The trick is to use the EM_SETCUEBANNER message. In case of TL;DR scenario -

The following code does not work

Use DfAllEnt


Class cEdit is an DFControl
	Procedure Construct_Object
		Set External_Class_Name 'cEdit' to 'Edit'
		Forward Send Construct_Object
		Set Border_Style to Border_ClientEdge
	Function Form_Window_Handle Returns Handle
		Function_Return (Window_Handle(Self))

Procedure Set CueBanner Handle hForm String sText
	Handle hEdit
	Integer iVoid
	Address aUniString
	Get Form_Window_Handle of hForm to hEdit
	Get OemToUtf16Buffer (AddressOf(sText)) (Length(sText)+1) to aUniString
	Move (SendMessage(hEdit,EM_SETCUEBANNER,1,aUniString)) to iVoid
	Move (Free(aUniString)) to iVoid

Object oMain is a Panel
	Set Size to 100 200
	Object oForm is a Form //***** cEdit *****\\
		Set Size to 20 180
		Procedure Page_Object Integer iPage
			Forward Send Page_Object iPage
			Set CueBanner Self to "Enter text"
	Object oButton is a Button
		Set Location to 20 0


If I use cEdit instead of Form class on line 28, then everything would work as expected. However there is something a little bit more to the Form control than meet the eys. Most VDF native controls are just wrapper to the standard Windows controls. I expected it to work, but it doesn't. Back to the drawing board ...

Free Web Hosting