Thread: Binding Images in Controls
-
April 28th, 2017, 03:52 #31
You need to give us a more information - like some code you're actually using - maybe a skeleton extension or something we can play with to get it working. At the moment you're drip feeding us information and it's impossible for us to give true guidance.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
April 28th, 2017, 09:32 #32
The code I'm using looks nearly identical to the reference manual code Moon pointed to earlier in this thread. It would be very difficult to make a skeleton extension, but possible. But here is the code that it used here; not much to really look at.
Code:function embedImage(dropNode) local win = createWindowWithClass("imageryTest", "id-00002"); local ctrl = win.createControl("imagery", "image"); local w, h = ctrl.getImageSize(); Debug.console("getDatabaseNode()"); Debug.console(getDatabaseNode()); Debug.console("win.getDatabaseNode()"); Debug.console(win.getDatabaseNode()); Debug.console("win.children"); Debug.console(DB.getChildren(win.getDatabaseNode(), "")); Debug.console("ctrl"); Debug.console(ctrl); Debug.console("starting w"); Debug.console(w); Debug.console("starting h"); Debug.console(h); end
Code:<template name="imagery"> <imagecontrol> <anchored position="insidetopleft" /> <indicators availability="blank" locked="blank" loading="blank" zoom="blank" shortcuts="blank" /> <invisible /> <disabled /> </imagecontrol> </template>
Last edited by Nickademus; April 28th, 2017 at 09:35.
I never claimed to be sane. Besides, it's more fun this way.
-
April 28th, 2017, 14:53 #33
Assuming your image is stored in the campaign database at image.id-00002 ? i.e. It is a normal campaign image?
Then your createWindowWithClass("imageryTest", "id-00002"); needs to refer to image.id-00002, that is: createWindowWithClass("imageryTest", "image.id-00002");
This is what I was trying to point out before.
Just using "id-00002" for the image database reference will create a DB node at id-00002 in the XML root, because this is an absolute database node identifier. Check your campaign XML, I bet you'll see a DB node of "id-00002" right off the root.
I'm guessing you're getting confused between relative and absolute database references? See "Node Identifiers" here: https://www.fantasygrounds.com/modguide/database.xcpLast edited by Trenloe; April 28th, 2017 at 14:55.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
April 28th, 2017, 15:02 #34
Or, if you want to use a relative identifier put a period in front: createWindowWithClass("imageryTest", ".id-00002")
This will reference a db node relative to the <datasource> of the windowlist. For example, if the windowlist has <datasource>image</datasource> then using ".id-00002" (a relative identifier) would reference image.id-00002 as the absolute database identifier (which I believe is what you need).Last edited by Trenloe; April 28th, 2017 at 15:04.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
April 28th, 2017, 22:17 #35
Yes it is.This is interesting. It's not how the wiki describes the behavior of the <datasource> of a window. According to it the datasource of a windowlist or subwindow is automatically relative.
A database identifier forming the base from which the actual data source is derived. For top level windows the identifier is relative to the root node of the database, for subwindows and windowlists it is relative to the containing control.
EDIT: Yeah, it seems to be getting to the image now. It would seem I was misled by the description of the <datasource>...Last edited by Nickademus; April 28th, 2017 at 22:20.
I never claimed to be sane. Besides, it's more fun this way.
-
April 28th, 2017, 22:33 #36Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
April 28th, 2017, 22:48 #37
Yeah, sometimes it feels like I'm grasping at straws using the wiki.
I never claimed to be sane. Besides, it's more fun this way.
-
April 28th, 2017, 22:54 #38
The command you used is here: https://www.fantasygrounds.com/refdo...indowWithClass It specifies "The data node identifier path..." - these are documented under "node identifiers" here: https://www.fantasygrounds.com/modguide/database.xcp Your debug statements were pretty much telling you that you weren't accessing the right nodes and going to a root of "id-0002" rather than "image.id-00002", as I eluded to also. Believe what they were telling you, rather than second guessing!
Last edited by Trenloe; April 29th, 2017 at 00:45.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
April 30th, 2017, 02:38 #39
Changed to this and it works fine. The image is showing up where and I it's supposed to. Switch over to the local client and the same lua file code throws a console error:
createWindowWithClass: Unable to create target named nodeI never claimed to be sane. Besides, it's more fun this way.
-
April 30th, 2017, 03:19 #40
More than likely the image hasn't been shared with the player, so it can't be accessed. Either share the image or make it public using code on the GM side: https://www.fantasygrounds.com/refdo....xcp#setPublic
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks