Using Dialog Input parameter to close dialog and run macro.

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
User avatar
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.

Post by Full Bleed »

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?
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Using Dialog Input parameter to close dialog and run mac

Post by wolph42 »

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.

User avatar
jackolas
Cave Troll
Posts: 28
Joined: Tue Apr 16, 2013 8:19 am
Location: Netherlands
Contact:

Re: Using Dialog Input parameter to close dialog and run mac

Post by jackolas »

Call macro:

Code: Select all

[H, macro("YourFormMacro@Lib:Yourlib"):json.set("", "PictureID", "TablePictureValue")]
YourFormMacro:

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>	
}]
something like that? (remember to change the values and lib etc to your own)

User avatar
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

Post by Full Bleed »

jackolas wrote:something like that? (remember to change the values and lib etc to your own)
Thanks... but I couldn't get that to work...

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."

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Using Dialog Input parameter to close dialog and run mac

Post by aliasmask »

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().

Post Reply

Return to “Macros”