Page 1 of 1

TOOLTIP question

Posted: Thu Aug 07, 2008 7:11 am
by Otto
Sometimes I redefine the used controls without inserting an object name.

REDEFINE GET cBetriebnr ID 103 of oDlg

Is it possible to inset tooltips without having an object name or do I have to insert object names.


REDEFINE GET oGet VAR cBetriebnr ID 103 of oDlg
oGet:cTooltip = “Help me”

Thanks in advance
Otto

Posted: Thu Aug 07, 2008 7:17 am
by James Bott
Otto,

Since there is no TOOLTIP clause for REDEFINE GET, then yes you have to assign an object name so you can assign the tooltip.

You can always look at the .CH file (in this case FIVEWIN.CH) to see what all the available clauses are.

James

Re: TOOLTIP question

Posted: Thu Aug 07, 2008 11:49 am
by Enrico Maria Giordano
You can access the control through its position inside oDlg:aControls or find it using nId.

EMG

Posted: Thu Aug 07, 2008 2:15 pm
by Otto
Thank you. Could you show me how to find a control by the nID.
Thanks in adance.
Regards,
Otto

Posted: Thu Aug 07, 2008 2:37 pm
by Rochinha
Otto,

see the SAMPLES\TESTFOC2.PRG.

Posted: Thu Aug 07, 2008 2:47 pm
by TecniSoftware
Try it this way:

niD := 123
nPosition := aScan( oDlg:aControls, { |oCtrl| oCtrl:nID == nID } )

oDlg:aControls[nPosition]:cToolTip := "Hello"



Regards.

Posted: Thu Aug 07, 2008 3:09 pm
by demont frank
Otto,

I use very often the controls from a dialog with their nId.

Before activating the dialog :

BuildDlgObj(@oDlg)

This procedure add as DATA to oDlg DlgObj (Hash array)

Code: Select all

******************************************************************************
PROC BuildDlgObj(oDlg)
**********************
LOCAL el
IF ! __ObjHasData(oDlg,"DLGOBJ")
	__OBJADDDATA(oDlg,"DlgObj")
END
oDlg:DlgObj := Hash()
WITH OBJECT oDlg
	FOR EACH el IN :aControls
		//IF el:nId > 9
		IF __ObjHasData(el,"NID")
			oDlg:DlgObj[el:nId] := el
		END
	NEXT
END
RETURN
To use a control we can now

oDlg:DlgObj[nId]

This is possible in each routine where oDlg is visible

Frank

Posted: Thu Aug 07, 2008 3:59 pm
by James Bott
Finding the control's ID seems like a lot more work than just assigning an object name.

Regards,
James

Posted: Thu Aug 07, 2008 4:07 pm
by Otto
Thanks to all for helping.
Regards,
Otto

Posted: Thu Aug 07, 2008 5:51 pm
by demont frank
James Bott wrote:Finding the control's ID seems like a lot more work than just assigning an object name.

Regards,
James
James

In many cases we have to pass this objects to sub routines. All objects ? which one ? A nightmare to synchronise to pass !

In mine code we have only to call ones BuildDlgObj , and later when it is necessary oDlg as parameter

Frank

Another idea

Posted: Fri Aug 08, 2008 1:30 am
by xProgrammer
Hi all

I'm basically a FiveLinux guy rather than FiveWin guy and I build my dialogs via code but the other logical alternative would presumably be to modify FiveWin.ch to support TOOLTIPS on a REDEFINE.

Regards
xProgrammer