Combobox Tooltip for long Values

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Frank Müßner
Posts: 276
Joined: Sat Dec 12, 2015 2:22 pm
Location: Germany

Combobox Tooltip for long Values

Post by Frank Müßner »

Hi
I use VOForms and I'm looking for a way to show tooltips for longer entries in a combo box. Is there a solution, or am I just not finding the relevant entry.
Frank
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

Combobox Tooltip for long Values

Post by Karl-Heinz »

Hi Frank,

To make all items readable, simply adjust the width of the opened combobox

This sets the width to e.g. 300 pixels.

SendMessage(oYourCombo:Handle(), CB_SETDROPPEDWIDTH, 300 , 0L )
.
regards
Karl-Heinz
Frank Müßner
Posts: 276
Joined: Sat Dec 12, 2015 2:22 pm
Location: Germany

Combobox Tooltip for long Values

Post by Frank Müßner »

Hi Karl-Heinz,

thanks for this Info. Not a Tooltip solution, but i can use this.

Regards, Frank
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

Combobox Tooltip for long Values

Post by Karl-Heinz »

Hi Frank,

The combobox has a buildin tooltip, but it only popups when the combobox is closed. There are several optionss to refresh the tooltip text.

- if the combobox is linked to a server field, refresh the text in the notify()

Code: Select all

METHOD Notify (kEvent, uDescription)    CLASS Yourwin 
LOCAL xReturn := SUPER:Notify(kEvent,uDescription)
	
	DO CASE
	CASE kEvent >= NotifyRecordChange .AND. kEvent <= NotifyGoTop  
		
		oDCyourcmb:Tooltiptext := oDCyourcmb:GetItem(0)

	ENDCASE

	RETURN xReturn
- listen to the ListBoxSelect() event

Code: Select all

METHOD ListBoxSelect(oControlEvent) CLASS YourWin
	LOCAL oControl AS Control
	oControl := IIF(oControlEvent == NULL_OBJECT, NULL_OBJECT, oControlEvent:Control)
	SUPER:ListBoxSelect(oControlEvent)
	//Put your changes here 
	
	IF oControl:NameSym == #yourcmb
		oDCyourcmb:Tooltiptext := oDCyourcmb:GetItem(0)
	ENDIF 	   
	
	RETURN NIL
regards
Karl-Heinz
Frank Müßner
Posts: 276
Joined: Sat Dec 12, 2015 2:22 pm
Location: Germany

Combobox Tooltip for long Values

Post by Frank Müßner »

Hi Karl-Heinz,

thanks, that I can use before I can replace with a .Net Control :-)

Regards, Frank
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

Combobox Tooltip for long Values

Post by Karl-Heinz »

Guys,

i couldn´t resist to add two comments about comboboxes. FOr those who didn t notice it til now:

1) mouse wheel behaviour

- activate with the mouse a comboBox
- move the mouse away from the combobox
- now torture the mouse wheel
- you should notice that the comobox selection changes !

to avoid this IMO dangerous behaviour add this to a comboxBox dispatcher

Code: Select all

METHOD Dispatch ( oEvent ) CLASS myCmb
	
 	IF oEvent:message == WM_MOUSEWHEEL
		 
    	IF SendMessage(SELF:Handle(),CB_GETDROPPEDSTATE,0,0L ) == 0 
       	RETURN SELF:EventReturnValue := 1L
    	ENDIF
    	
	ENDIF	
  	
	RETURN SUPER:Dispatch ( oEvent )


now the mouse wheel only works when the comboBox is opened.

2.) CB_SETEXTENDEDUI

Code: Select all

Sendmessage ( <ocmb>:Handle() , CB_SETEXTENDEDUI , 1 , 0L )


this strange setting exists since VISTA, and after all i still don´t get it why MS added this "feature" at all ?

See the REMARKS section that describes the behaviour (sic) of this setting.

https://docs.microsoft.com/en-us/window ... extendedui


regards
Karl-Heinz
Post Reply