5E Character Create Playlist
Page 1 of 2 12 Last
  1. #1

    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:
    1. 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)
    2. When the button has been pressed w/o the Alt key:
      "gen_export_button_down"=Click to exit export mode
    3. 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>
    Here is the code that sets the tooltip based upon the button state and the status of the Alt key (and this code is invoked when the button is depressed, in addition to when hovering):
    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
    Note that, in the code above, bAlternate is a variable in the script block that is set according to the alt key status when the button is depressed.
    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.

  2. #2

    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.

  3. #3
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,684
    Blog Entries
    1
    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.

  4. #4

    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?

  5. #5
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,684
    Blog Entries
    1
    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?

  6. #6

    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.

  7. #7
    Quote Originally Posted by Bidmaron View Post
    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.
    <gmeditonly /> is what you're looking for to keep a value from being edited by anyone but the host.
    ---
    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.

  8. #8

    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.

  9. #9
    Quote Originally Posted by Bidmaron View Post
    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.
    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.

  10. #10

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in