Page 1 of 2
Tool tips
Posted: Fri Apr 01, 2011 5:56 am
by omni
Roger,
We use datatooltips quite a bit. I need to do something similar on a standard get or dcsay...does not matter which.
We have some special instructions that users want to see, which can be up to 100 characters. Due to space on the screen for this window, the viewable area is limited to 20 or so characters. I have tried to use tooltip and gettooltip, but both give me error messages if I use {||var }..just says invalid. If I user the var, it will work but its not refreshed.
Any suggestions are appreciated.
thanks
Fred Henck
Omni
Re: Tool tips
Posted: Fri Apr 01, 2011 6:22 am
by Tom
Hi, Fred.
The errors you get may have something to do with the fact that the tooltip system runs in a different thread. You don't have access to your workareas there! It's quite hard to display tool tips depending on data in a workarea. Your gets need to set values in get/set-functions or even public vars (for example using "GOTFOCUS"). But this is not very reliable.
Re: Tool tips
Posted: Sat Apr 02, 2011 8:40 am
by rdonnay
Tom is right about tooltips running in another thread, however you should have no problem with local variables provided that you pass by reference.
Code: Select all
LOCAL cVar := 'My tooltip'
@ .. DCGET .. TOOLTIP {||@cVar}
@ .. DCPUSHBUTTON .. ACTION {||UpdateToolTip(@cVar)}
DCREAD GUI
* ----------
STATIC FUNCTION UpdateTooltip( cVar )
cVar := 'My Updated tooltip'
RETURN nil
Re: Tool tips
Posted: Sun Apr 03, 2011 9:51 am
by Janko
I have a problem with TIPBLOCK when browsing arrays: nPointer points to the row which is ITEMMARKED, Dc_BrowseRow(oBrowse) points as well to marked row and not to the row under mouse pointer. My question is how to retrive the number of array row which is currently under mouse pointer. This would enable me to read data from browsed array.
Best regards
Janko
Re: Tool tips
Posted: Sun Apr 03, 2011 11:12 am
by rdonnay
I'm not sure I understand your question.
Are you wanting to display a tooltip based on the current mouse position over an array-based browse?
You would do that like so:
Code: Select all
aDir := Directory()
@ .. DCBROWSE .. DATA aDir
DCBROWSECOL ELEMENT 1 HEADER 'File Name' WIDTH 10 ;
DATATOOLTIP {|| .T. } TIPBLOCK {|nPos| aDir[nPos,1]}
Re: Tool tips
Posted: Mon Apr 04, 2011 12:55 am
by Janko
Yes, you understood correctly. Your solution works as I wanted. And, as usuall, I should read manual more careful. Thank you very much
Re: Tool tips
Posted: Tue Apr 05, 2011 1:23 pm
by omni
It will not compile with a tooltip with @. Says invalid use of @ (pass by reference). Will not work otherwise..says unknown var.
Fred
Omni
Re: Tool tips
Posted: Tue Apr 05, 2011 3:03 pm
by rdonnay
Show me your code.
Re: Tool tips
Posted: Tue Apr 05, 2011 3:49 pm
by omni
Ok, here it is
shipins='TOOLTIP TEST'
@ 14,01 DCsay "Instructions:" get CSHIPINS PICTURE "!!!!!!!!!!!!!!!!!!!!" GETTOOLTIP {||@SHIPINS }
I have tried just the dcsay..get and the dcget. Same results
The actual cshipins is 80 characters, so the shipins is the entire instruction, or that is what the user wants to display in the tooltip.
There are other ways to do it, with the picture clause, or a popup..which is what we will do if I cannot get the tooltip to work
Fred
Re: Tool tips
Posted: Wed Apr 06, 2011 12:43 am
by skiman
Hi,
The following are working variations:
Code: Select all
shipins='TOOLTIP TEST'
@ 14,01 DCsay "Instructions:" get CSHIPINS PICTURE "!!!!!!!!!!!!!!!!!!!!" GETTOOLTIP SHIPINS
Or
@ 14,01 DCsay "Instructions:" get CSHIPINS PICTURE "!!!!!!!!!!!!!!!!!!!!" GETTOOLTIP 'TOOLTIP TEST'
Or
@ 14,01 DCsay "Instructions:" get CSHIPINS PICTURE "!!!!!!!!!!!!!!!!!!!!" GETTOOLTIP fTooltip(1)
...
function fTooltip(nNumber)
if nNumber == 1
return 'TOOLTIP TEST 1'
elseif nNumber == 2
return 'TOOLTIP TEST 2'
....
[/code]