I'd like to pop a dialog window that will show an image from a table and then once the image is clicked it will close the dialog window and fire off another macro.
What would be the simplest way to do this?
Using Dialog Input parameter to close dialog and run macro.
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Using Dialog Input parameter to close dialog and run macro.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: Using Dialog Input parameter to close dialog and run mac
the way you describe it, then the only way I see is through an html form. you want to set up a form with the image as button, I'd suggest you check out the forms tutorial in the wiki.
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Using Dialog Input parameter to close dialog and run mac
Call macro:
YourFormMacro:
something like that? (remember to change the values and lib etc to your own)
Code: Select all
[H, macro("YourFormMacro@Lib:Yourlib"):json.set("", "PictureID", "TablePictureValue")]
Code: Select all
<!-- Picture Selection Window -->
[H: PictureId = json.get(macro.args, "PictureID")]
[H: TableImage = tableImage("YourTable", PictureId)]
[R, dialog("PicSelect", "temp=1; closebutton=0; height=300; width=300"):{
<head>
<meta name="input" content = "true">
<title>Select Picture</title>
</head>
<body>
<form method="json" name="PicSelect" action="[r: macroLinkText('YourHandelingMacro@Lib:Yourlib', 'none')]">
<table border="1" cellpadding="1" width="100%">
<tr><td>
<input type="image" src="[R: TableImage]" name="Immage" value="{R: PictureId]">
</td></tr>
</table>
</form>
</body>
}]
My own 5th d&d character sheet framework (preview)
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: Using Dialog Input parameter to close dialog and run mac
Thanks... but I couldn't get that to work...jackolas wrote:something like that? (remember to change the values and lib etc to your own)
I ended up doing it without forms by creating a function to pop the dialog, center an image macrolink, and then simply closed the dialog in the called macro.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: Using Dialog Input parameter to close dialog and run mac
You could use an image button as well. It basically acts as a form submit button but you use an image instead of the normal submit button. An interesting thing you can do with that is it returns an x,y value too so you know where on the button you clicked.
But for your application putting all the macro call info in the value should do the trick. If you want to close a frame/dialog from another macro, you can use Wiki: closeFrame() or Wiki: closeDialog().
But for your application putting all the macro call info in the value should do the trick. If you want to close a frame/dialog from another macro, you can use Wiki: closeFrame() or Wiki: closeDialog().
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools