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

Define EM_SETCUEBANNER For |CI$1501

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
	End_Procedure
	Function Form_Window_Handle Returns Handle
		Function_Return (Window_Handle(Self))
	End_Function
End_Class

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
End_Procedure

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"
		End_Procedure
	End_Object
	Object oButton is a Button
		Set Location to 20 0
	End_Object
End_Object

Start_UI

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