1. #1
    New Member Follow User Gallery
    Join Date
    May 2017
    Location
    Munich
    Posts
    29

    Default Questions about [SubToolGetStatus]

    Hi!
    So I took a look into [SubToolGetStatus] especially in combinations with folders and I am a bit confused. What I learned sofar is that the topmost Subtool in a folder holds the status of the folder (just like with boolean groups). This is great news, as I first was concerned the possibility to hide folder in the prefs, would create a nightmare to track.
    Other Subtools in a folder don’t seem to have a special “is part of folder” flag though and this is where my confusion starts.
    A Subtool that is part of a groups and gets hidden by the parent folder remains it’s status (e.g 17) although being not visible. I assume this was done to be able to restore the correct visibility of the content of the folder.
    It makes [SubToolGetStatus] an unreliable source though, when looking through the complete Subtool list. I now have a list where a status of 17 can mean a Subtool outside a folder is visible, yet also be invisible to the user (although technically visible) inside of a hidden folder.
    This in combination with the fact, that the status holds not information about Polypaint, feels like unused potential.
    The status is easy to use (no name check->few lines), so it could be a slick all purpose solution. From what I have learned so far, it seems to make things more complicated though, as I now might need to check for the modifier and the status as well, to get the complete state of a Subtool.

    Should I be mistaken and I simply need to wait a little longer for the documentation that will shed light on all my questions, please let me know !

  2. #2
    New Member Follow User Gallery
    Join Date
    May 2017
    Location
    Munich
    Posts
    29

    Default

    I did a bit more digging and with the help of F@celessm!ndz on discord, we managed to come up with a solution that allows to track a Subtool's visibility state using [SubtoolGetFolderIndex]. Which means I can now can start working with the new features .

    For the curious:


    [IButton, "Subtool visible?", ,
    [VarSet,STStatus,[SubtoolGetStatus]]
    [VarSet,STFolderIndex,[SubtoolGetFolderIndex]]

    [If,(STFolderIndex > -1), //part of a folder
    [If,(STStatus&2), //head of the folder
    [If,(STStatus&1),
    [Note,"Visible head of folder"]
    ,
    [Note,"Invisible head of folder"] ]
    ,
    [If,(STStatus&1), //member of the folder
    [Note,"Visible in a folder"]
    ,
    [Note,"Invisible in a folder"] ] ] ] [If,(STFolderIndex == -1), //not part of a folder
    [If,(STStatus&1),
    [Note,"Visible"]
    ,
    [Note,"Invisible"]
    ]]]

  3. #3
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Yeah, here's my version:

    [RoutineDef, SubToolIsVisible,
    [VarSet, isVisible, 0]
    [VarSet,actIndex,[SubToolGetActiveIndex]]
    [VarSet,st,[subtoolgetstatus,actIndex]]
    [VarSet,fInd,[subtoolgetfolderindex,actIndex]]
    [If,(fInd > -1),//it's in a folder
    [VarSet,stFld,[subtoolgetstatus,fInd]]//get folder visibility
    [If,([Val,stFld]&0x2 == 0x2)&&([Val,st]&0x1 == 0x1),
    [VarSet,isVisible,1]
    ]
    , //else no folder
    [If,([Val,st]&0x1 == 0x1),
    [VarSet,isVisible,1]
    ]
    ]
    , isVisible]



    The above code could easily be adjusted to take an index instead of the subtool needing to be selected. (A big advantage with SubToolGetStatus over previous methods.)

Posting Permissions

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