PDA

View Full Version : Formattedtext and other new features



Bidmaron
April 6th, 2014, 17:03
Recently, there has been a renewed interest in formattedtextcontrols. In order to make more improvements in the use of formatted text, we need some improved functionality in the control functions. There are some feature requests to support this, but they are so far down that no one ever sees them and no one understands whey they are so important.

If you want more formatted text support, please vote for the following entry:

https://fg2app.idea.informer.com/proj/?ia=59178

While you are at it, if you want real-time features (such as give a player 2 minutes to take his attack or skip him, such as take out the pizza in 30 minutes, such as advance the game calendar 5 minutes for every 10 minutes real time, etc), please vote for the following:

https://fg2app.idea.informer.com/proj/?ia=59890
https://fg2app.idea.informer.com/proj/?ia=55752

Trenloe
April 6th, 2014, 18:25
If you'd like more robust modules, like a no-kidding word atlas, we need better image support, please vote for

https://fg2app.idea.informer.com/proj/?ia=82831
Can you explain the need for this please? What would this allow that the current way of images being stored in the campaign images directory and modules doesn't? Examples?

Bidmaron
April 6th, 2014, 19:20
Maybe I just don't understand how to make it work, but I cannot figure out a way to do a setValue or getValue on an image control. We can't programmatically build an image window. The documentation for the image control states:

The control internally supports the "token" and "shortcut" dragdata types, with the former creating new token instances on the control, and the latter creating shortcut icons.
But this is not exposed to programmatic manipulation, or at least I cannot figure out how to do so. (Well, tokens are, but the shortcut is not).
How can we imbed an imagecontrol in one of our own windows? It is my belief other than for things saved in a module, there is no way to programmatically make a window with an image unless the image has been loaded into the images folder. It would be really nice, for example, to have the library modules have images of the monsters, or even some of the items within (who can every remember what a bardiche looks like?) The only way I know to do that is using an icon, which is a very static thing, as there is no way (I know of) to add new icons programmatically.

Trenloe
April 6th, 2014, 20:42
Maybe I just don't understand how to make it work, but I cannot figure out a way to do a setValue or getValue on an image control. We can't programmatically build an image window. The documentation for the image control states:


The control internally supports the "token" and "shortcut" dragdata types, with the former creating new token instances on the control, and the latter creating shortcut icons.

But this is not exposed to programmatic manipulation, or at least I cannot figure out how to do so. (Well, tokens are, but the shortcut is not).
To be clear here - tokens and shortcuts are items placed on an already existing imagecontrol, they do not impact/control the underlying image. The shortcut mentioned in the documentation is not dragging the shortcut of an image onto an imagecontrol and the imagecontrol then uses the image shortcut to build it's underlying image. A shortcut on an imagecontrol is the red pushpins that provide links to campaign objects.


How can we imbed an imagecontrol in one of our own windows? It is my belief other than for things saved in a module, there is no way to programmatically make a window with an image unless the image has been loaded into the images folder. It would be really nice, for example, to have the library modules have images of the monsters, or even some of the items within (who can every remember what a bardiche looks like?) The only way I know to do that is using an icon, which is a very static thing, as there is no way (I know of) to add new icons programmatically.
imagecontrols get their <image><bitmap> data from the DB node they are anchored on. This DB node can be an image in the campaign /images directory or an image stored in a module - both will be stored in the <image> section of the DB. Images can be added to the campaign with the Interface.addImageFile function, which accepts a filename and will move the file into the campaign images directory and make it available in the campaign DB: https://www.fantasygrounds.com/refdoc/Interface.xcp#addImageFile

See the CoreRPG scripts\manager_combat.lua openMap function for an example of opening a new window that has an imagecontrol within the window sheet and specifying the database node to use for controls within the windowclass. i.e. local w = Interface.openWindow("imagewindow", nodeImage.getParent()); Just like any other windowclass with embedded controls that rely on the data in the database you can manipulate the database entry to use images from the campaign images directory or module/s.

In the Idea Informer entry you reference, you mention "We need the ability to set the image programmatically to an arbitrary file location." - setting the location for anything within Fantasy Grounds that is outside of the usual data structure (campaign directory and modules) can be problematic - especially if the source will be distributed as it will rely on everyone using the source to have the required files in the correct locations, a potential recipe for lots of missing data! It is much better to work within the FG data structures (campaign DB and modules) - hence the Interface.addImageFile function to add images on the fly to the campaign directory structure, and the ability to use images defined within the campaign or a module database.

Or, as a different idea, you could use a tokenfield within a window. The Call of Cthulhu ruleset does this to allow a "token" image to be dragged to the appearance tab of the NPC. For example, here I quickly added an appearance graphic to an NPC by dragging the token to the tokenfield entry in the appearance tab of the NPC record:

https://dl.dropboxusercontent.com/u/39085830/Screenshots/Fantasy%20Grounds/NPC%20Appearance%20Image.jpg

Bidmaron
April 6th, 2014, 21:09
OK, I stand informed.
As for dragging tokens to set the appearance, I suppose that works as long as when you build your module you export the token and then delete it from your tokens (so as to keep token bloat from happening).
Any reason you couldn't drag an image onto the appearance? Once you've done so, we can then export that with the module as with any other image?

Trenloe
April 6th, 2014, 21:42
Any reason you couldn't drag an image onto the appearance? Once you've done so, we can then export that with the module as with any other image?
Because "image" is not a dragdata type, whereas token is: https://www.fantasygrounds.com/refdoc/dragdata.xcp

Bidmaron
April 7th, 2014, 01:19
OK, got it, Trenloe. Thanks for the education. I corrected my first post and the wish list.