FG Spreadshirt Swag
  1. #1

    findWindow() syntax to find a panel?

    Trying to figure out how to to locate the windowinstance for a panel using the Interface.findWindow function.

    Have a panel like so:
    Code:
     
      <panel name="shortcuts" modes="host">
        <class>shortcuts_dm</class>
        <bounds>
          <anchored>
            <left>
              <anchor>left</anchor>
              <offset>370</offset>
            </left>
            <top>
              <anchor>top</anchor>
              <offset>90</offset>
            </top>
            <bottom>
              <anchor>bottom</anchor>
              <offset>30</offset>
            </bottom>
            <size>
              <width>67</width>
            </size>
          </anchored>
        </bounds>
      </panel>
    with class definition:
    Code:
     
      <windowclass name="shortcuts_dm">
        <sizelimits>
          <maximum>
            <height>1000</height>
          </maximum>
        </sizelimits>
        <sheetdata>
          <windowreferencecontrol>
            <icon>
              <normal>DesktopIconCharacters</normal>
              <pressed>DesktopIconCharactersDown</pressed>
            </icon>
            <bounds>20,0,47,27</bounds>
            <class>charactersheetlist</class>
            <recordname>charsheet</recordname>
            <tooltip>
              <text>Characters</text>
            </tooltip>
            <nodrag />
            <closetoggle />
          </windowreferencecontrol>
           ...
    </windowclass>
    I'd like to find that panel in order to disable the windowreferencecontrol but findWindow doesn't seem to be locating it.

    I though this would work since the panel class has no database node but it just gives an "invalid parameters passed to findWindow" error:
    Code:
    Interface.findWindow("shortcuts_dm"), nil);
    Also tried:
    Code:
     
    Interface.findWindow("shortcuts_dm"), "");
    and
    Code:
     
    Interface.findWindow("shortcuts_dm"), "nil");
    both of which return nil


    Anyone know how to do this?
    Work Less, Game More!

  2. #2
    Interface.findWindow("shortcuts_dm", ""); should work. I use this all the time for custom windowclass controls not tied to the DB.

  3. #3
    Cheers Joshua.
    Will triple-check my code. Probably some silly mistake like an incorrect uppercase/lowercase character...
    Work Less, Game More!

  4. #4
    Bump. I still can't figure out how to use findWindow to find a panel.

    e.g. trying to find the chat window:
    Code:
     
    if Interface.findWindow("chat", "") then
      print("found chat");
    else
      print("couldnt find chat");
    end

    comes back with "couldnt find chat"...

    Works fine for normal windowclasses that are not bound to a datasource but not for classes used for panels.
    Work Less, Game More!

  5. #5

    Talking

    Aha! Now I see your sneaky bit of coding! And I shall make like a and it for my own nefarious purposes!

    Or in english:
    The onInit function in chat_chat.lua stores a reference to the chat window (self) within the ChatManager.lua script block. Hence, I can access the chat window from anywhere else by caalling a function I have added to ChatManager.lua!
    Work Less, Game More!

Thread Information

Users Browsing this Thread

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

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
  •  
Starfinder Playlist

Log in

Log in