PDA

View Full Version : Any way to get position of a character portrait (in the top left screen list)?



zuilin
October 16th, 2020, 19:17
Is there any way to find the coordinates of a particular character portrait in the portrait "list" on the top of the desktop? I have the character ID, I was thinking maybe using Interface.findWindow but I don't know (and can't figure out from CoreRPG or 5E code) what the windowclass is for it.

Thoughts? Suggestions?

Moon Wizard
October 16th, 2020, 21:27
The window is named "characterlist"; and each character within the list is one control named <"ctrl_" .. sIdentity>. It's a generic control that doesn't display anything directly; but instead uses widgets to display portrait, color, name, etc.

Regards,
JPG

zuilin
October 17th, 2020, 02:57
Excellent! Thanks!

zuilin
October 17th, 2020, 03:37
The window is named "characterlist"; and each character within the list is one control named <"ctrl_" .. sIdentity>. It's a generic control that doesn't display anything directly; but instead uses widgets to display portrait, color, name, etc.

Regards,
JPG

So.... characterlist even has a function (in characterlist.lua) to find the correct control (findControlForIdentity(v)), but I'm really struggling trying to figure out how to get a pointer to the characterlist window itself, using Interface.findWindow, without knowing the window's datasource. In fact, from all the code I've looked at in CoreRPG, it doesn't seem to have a direct link to a database entry...it's a weird window from what I can tell as it's backed by a table maybe? and not a DB node. I can't tell, because nowhere in the Desktop code can I find where the characterlist window itself is actually created. I've found panel definitions and such, but if it's created in the normal way, I can't figure it out.

Once I have the window, I'm sure I can reference the correct portrait's control using <"ctrl_"...sIdentity> or even the function I found in characterlist.lua to find the control, but I need the window first. And I'm totally stuck. -sigh-

Any more suggestions how I can get a pointer to that characterlist window in my own code?

Thanks again. Sorry for the trouble.

zuilin
October 17th, 2020, 04:43
Oh. My. Gosh.


local theCharacterListWindow = Interface.findWindow("characterlist","");

Who knew you could put "" as the second parameter? (@Moon Wizard - Perhaps you could put a note in the Wiki entry that you can find panels in the UI, like "characterlist" or "chat" by using "" as the second parameter. Maybe even list the standard panels there for posterity.)

Sorry for all the crazy posts above.

Moon Wizard
October 17th, 2020, 05:32
All top-level windows (including panels) are uniquely defined by a window class and a database path. An empty database path is used to indicate a sourceless window (i.e. not connected to database); which most panels are. There are other top level windows that are sourceless (color picker, portrait picker, options, etc.)

Regards,
JPG

zuilin
October 17th, 2020, 06:59
All top-level windows (including panels) are uniquely defined by a window class and a database path. An empty database path is used to indicate a sourceless window (i.e. not connected to database); which most panels are. There are other top level windows that are sourceless (color picker, portrait picker, options, etc.)

Regards,
JPG

Is that documented somewhere in the dev doc wiki and I just missed it?

Moon Wizard
October 17th, 2020, 08:15
This one:
https://fantasygroundsunity.atlassian.net/wiki/spaces/FGU/pages/4096375/Interface#findWindow

Points to this one via a link on the datasource parameter:
https://fantasygroundsunity.atlassian.net/wiki/spaces/FGU/pages/4096479/windowinstance

Second paragraph outlines the second parameter.

Regards,
JPG