STAR TREK 2d20
  1. #1

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

    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?

  2. #2
    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

  3. #3

  4. #4
    Quote Originally Posted by Moon Wizard View Post
    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.
    Last edited by zuilin; October 17th, 2020 at 04:00. Reason: more info

  5. #5
    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.

  6. #6
    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

  7. #7
    Quote Originally Posted by Moon Wizard View Post
    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?

  8. #8
    This one:
    https://fantasygroundsunity.atlassia...ace#findWindow

    Points to this one via a link on the datasource parameter:
    https://fantasygroundsunity.atlassia...windowinstance

    Second paragraph outlines the second parameter.

    Regards,
    JPG

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in