-
July 21st, 2018, 17:05 #1
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Problem with Tooltips on a buttoncotntrol
I think I have some kind of a conceptual error regarding button controls. I always struggle to get tooltips to work properly. My current dilemma:
I have an Export button that is modal (you press it so you can export one or more tables and press it again when you are done exporting). The button permits you to either enter an export mode where you can select tables or generators in the list and export them one-at-a-time, or, if you push the Alt key when you click the export button, you can mark tables for exporting into one file with multiple tables. Then when you click the export button again, all the marked tables get exported.
So, the tooltip needs to have one of three values:
- When the button is not pressed:
"gen_export_button_up" = Depress to export tables or generators one at a time (<alt> to mark multiple items for export) - When the button has been pressed w/o the Alt key:
"gen_export_button_down"=Click to exit export mode - When the button has been depressed with the Alt key:
"alt_gen_export_button_down"=Click to export marked items
Here is the export button declaration:
Code:<template name="button_export"> <buttoncontrol> <anchored to="buttonanchor" width="50" height="20"> <top /> <left anchor="right" relation="relative" offset="5" /> </anchored> <pressed name="buttondown" offset="2,2,2,2" nobaseframe="true" /> <font>button-white</font> <textres>gen_export</textres> <state tooltipres="gen_export_button_up" frame="buttonup" frameoffset="2,2,2,2"/> <state tooltipres="gen_export_button_down" frame="buttondown" frameoffset="2,2,2,2"/> <script file="export_table_generator.lua" /> </buttoncontrol> </template>
Code:function onHover(state) --if state then if getValue()==0 then setTooltipText(Interface.getString("gen_export_button_up")); elseif bAlternate then setTooltipText(Interface.getString("alt_gen_export_button_down")); else if getTooltipText()~=Interface.getString("gen_export_button_down") then Debug.chat("setting tooltip text"); end setTooltipText(Interface.getString("gen_export_button_down")); end --end end
So, when you hover on the button before pushing it, the screen has the appearance of the first screen shot below, but when you hover over it once it is pressed, there is never a tooltip displayed, regardless of the alternate key status when the button was pushed, as you can see from the second screenshot. When you push export again to return to normal mode, the original tooltip for button up will be displayed.
Tooltip.jpg
We know that the onHover code is working, because the debug shows up in the chat window.
(Note that the control that appeared to the right of the export button is where any module dependency would appear, and note that the export icons on each line get added when Export is clicked)Last edited by Bidmaron; July 21st, 2018 at 17:08.
-
July 21st, 2018, 22:27 #2
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Another issue:
I need a control that will only accept a string drop but cannot be user edited. I have it working, but the user can go in and type into the field. I tried specifying <disable/> but that wouldn't let you drop on the field. I don't think <readonly/> lets you drop either, but I guess I can test that. I just don't see a flag in windowcontrol, textbasecontrol, or string control that will disable user editing but still permit dropping.
Edit: <readonly /> doesn't even have a highlight frame when you try to drag to it, and it sure won't let drop happen.Last edited by Bidmaron; July 21st, 2018 at 22:35.
-
July 22nd, 2018, 01:04 #3
Doesnt really answer your Q but when I have buttons that have different click/button+click/scroll options on the same button I have always listed them all in the one tooltip.
-
July 22nd, 2018, 06:15 #4
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Thanks, damned, but I am too stubborn to give up on it, and I am ready to conclude that there is a bug with tooltips and multi-state buttons.
Any idea on the second post?
-
July 22nd, 2018, 06:26 #5
Who would do the drag and drop?
if its only the GM then there is a <gmonly /> or similar tag that might practically solve the issue without doing it fully?
-
July 22nd, 2018, 16:09 #6
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
It would be the GM. I have a work-around now, but maybe MW will chime in and tell me how you are really supposed to do this. The system is so flexible I have a hard time believing you can't do this.
My workaround: capture onChar events and keep changing the value back to what it previously was, sending an error message to the chat window. Works, but a little bit of a kluge.
-
July 22nd, 2018, 16:14 #7---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
July 22nd, 2018, 16:48 #8
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
That is not what I want, celestian. I need it to where you can only drag to it, not manually edit. I have tried all the combinations of tags I can find. I don't think it can be done, but, as I said, I have a workaround.
-
July 22nd, 2018, 19:21 #9
Sorry, I thought you wanted the DM to be the only one able to edit. Not that you wanted the players to be able to drag/drop and not edit.
Setting it to GMeditonly (for the manual part) and then capture drag/drop should be doable tho? Have you tested for onDrop() from a player on a GMeditonly field? Does it not even trigger? (never had a need to try this myself). Tho based on your readonly problem my guess is it doesn't.---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
July 22nd, 2018, 20:48 #10
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
What I need is a string that can only be dragged to not edited. This is because you are dragging a library icon dependency which my ondragstart code for the library makes a string out of the module name.
As I said, I have a workaround so not that big of a deal.
The tooltip problem, on the other hand, is irritating and I think just a bug with button controls.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks