Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to allow user to edit tooltips?
Message
From
30/04/2009 08:24:16
 
 
To
30/04/2009 02:08:29
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01318188
Message ID:
01397141
Views:
51
Great -- thanks, that's what I thought

>Hi Jim,
>
>my code snippet is part of my multi language class library which has to handle each type of container individually and therefore, at that time, I decided to break it up into the handled classes like pageframe, grid, optiongroup etc.
>I stripped the code snippet of irritating code, to give a better view to the way how to access and handle the questioned problem.
>So ... yes, you can just use the objects()-Array and iterate through it.
>
>-Tom
>
>>Thomas --
>>
>>I'm responding to a message from you of almost a year ago -- not about the original contents, but rather about a snippet of code you supplied:
>>
FOR i = 1 TO iCount
>>
>>	WITH m.vContainer
>>		DO CASE 
>>		CASE INLIST(LOWER(.Baseclass),[pageframe])
>>			oObject = .Pages(i)
>>		CASE INLIST(LOWER(.Baseclass),[grid])
>>			oObject = .Columns(i)
>>		CASE INLIST(LOWER(.Baseclass),[optiongroup],[commandgroup])
>>			oObject = .Buttons(i)
>>		OTHERWISE
>>			oObject = .Controls(i)
>>		ENDCASE 
>>	ENDWITH
>>
>>My question: is there any need here to index into Pages, Columns, Buttons, and Controls -- could not all of these cases simplify into a reference to .Objects instead?
>>
>>Thanks,
>>
>>Jim
>>
>>
>>>Hi James,
>>>
>>>I didn't read the complete thread, but how about this approach:
>>>
>>>Each object that might be in need of a tooltip also has a property called 'HelpContextID'. Each of your forms has (hopefully) a unique name. Otherwise add a property called 'FormID' which contains a unique name or number. Now as your Help and Tooltip are identical, and can be identified within your ToolTipText-Table, just use the HelpContextID to identify the corresponding record within a cursor and assign its value in a routine which is called by form.init.
>>>
>>>This routine will make use of recursion. Because everytime it meets a container class within its loop it will call itself with the container as new reference to loop through. In this example crsForms is the cursor name which contains the tooltips. This routine is just a code snipet of my multi language class which also modifys combobox contents, caption etc. So in this shortend version it is not checked in detail. But should be enough to give you an idea.
>>>
>>>
>>>FORM.INIT
>>>ModifyToolTipText(Thisform)
>>>
>>>FUNCTION ModifyTooltiptext
>>>LPARAMETERS vContainer
>>>IF VARTYPE(m.vContainer) <> [O]
>>>	m.vContainer = Thisform
>>>ENDIF 
>>>
>>>WITH m.vContainer
>>>	DO CASE 
>>>	CASE INLIST(LOWER(.Baseclass),[pageframe])
>>>		iCount = .PageCount
>>>	CASE INLIST(LOWER(.Baseclass),[grid])
>>>		iCount = .ColumnCount
>>>	CASE INLIST(LOWER(.Baseclass),[optiongroup],[commandgroup])
>>>		iCount = .ButtonCount
>>>	OTHERWISE
>>>		iCount = .ControlCount
>>>	ENDCASE 
>>>ENDWITH 
>>>
>>>FOR i = 1 TO iCount
>>>
>>>	WITH m.vContainer
>>>		DO CASE 
>>>		CASE INLIST(LOWER(.Baseclass),[pageframe])
>>>			oObject = .Pages(i)
>>>		CASE INLIST(LOWER(.Baseclass),[grid])
>>>			oObject = .Columns(i)
>>>		CASE INLIST(LOWER(.Baseclass),[optiongroup],[commandgroup])
>>>			oObject = .Buttons(i)
>>>		OTHERWISE
>>>			oObject = .Controls(i)
>>>		ENDCASE 
>>>	ENDWITH 
>>>		
>>>	IF  PEMSTATUS(oObject,[HelpContextID],5) ;
>>>	AND oObject.HelpContextID > 0
>>>
>>>		IF PEMSTATUS(oObject,[ToolTipText],5)
>>>			SELECT (crsForms)
>>>			LOCATE FOR frm_id = oObject.HelpContextID			
>>>			IF FOUND()
>>>				lcPreSet = IIF(LEFT(&crsForms..frm_tooltip,1) = [(],[],[( ] + ALLTRIM(STR(oObject.HelpContextID)) + [ )] + CHR(13))
>>>				IF oObject.Parent.BaseClass = [Column]
>>>					FOR EACH oColChild IN oObject.Parent.objects
>>>						IF oColChild.BaseClass = [Header]
>>>							oColChild.ToolTipText	= lcPreSet + ALLTRIM(&crsForms..frm_tooltip)
>>>							EXIT 
>>>						ENDIF 
>>>					ENDFOR 
>>>				ENDIF 
>>>				oObject.ToolTipText = lcPreSet + ALLTRIM(&crsForms..frm_tooltip)
>>>			ENDIF 
>>>		ENDIF 
>>>
>>>	ENDIF 
>>>	
>>>	IF INLIST(LOWER(oObject.BaseClass),[container],[pageframe],[page],[grid],[column],[commandgroup],[optiongroup])
>>>		ModifyToolTipText(oObject)
>>>	ENDIF 
>>>
>>>ENDFOR
>>>ENDFUNC
>>>
>>>
>>>>I have a request to allow a user (responsible for creating user documentation) to create and edit tooltips for all my forms.
>>>>
>>>>What I can see clearly is how and where to store the tooltips. Clearly, the user will not be modifying my forms directly, so I would want to store the tooltips in a table ... somewhere. Where?
>>>>
>>>>Then, how do I get the tooltips INTO the forms? Constantly reading the table on each MouseEnter? At the Init for the form (for all controls on the form)? Something else?
>>>>
>>>>Any suggestions would be most greatly appreciated.
Jim Nelson
Newbury Park, CA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform