MikePohatu / TsGui

Custom GUIs in ConfigMgr
GNU General Public License v3.0
47 stars 5 forks source link

Hide or disable GuiOption based on a variable. #16

Closed bohnanza22 closed 1 year ago

bohnanza22 commented 1 year ago

Primarily I want to enable or disable GuiOptions based on a variable collected with a NoUI option. I am not sure if there is a way to do this currently, nothing I try seems to work. I am currently using TSGUI 1.5.1.1. But if v2 has this ability I will upgrade to that version.

MikePohatu commented 1 year ago

Sorry not sure how I missed this issue coming in. Did you get this working? You should be able to do this using the Groups and Toggles feature. You might need to post a sample of your config so I can see what you're trying to do. Feel free to contact me via the 20road.com contact page if email is easier.

Cheers, Mike

MikePohatu commented 1 year ago

This can be done with Groups and Toggles. Add a toggle to the NoUIOption and then assign the group to control you want to turn on and off. Example xml:

<TsGui LiveData="TRUE">
    <Height>250</Height>
    <Width>300</Width>

    <HardwareEval />

    <Heading>
        <Title>TsGui</Title>
        <Text>Task Sequence GUI base config</Text>
    </Heading>

    <Page>
        <Row>
            <Column>
                <Formatting>
                    <LeftCellWidth>110</LeftCellWidth>
                    <RightCellWidth>160</RightCellWidth>
                </Formatting>

                <GuiOption Type="ComputerName">
                    <Group>Group_TEST</Group>
                </GuiOption>

                <GuiOption Type="CheckBox" ID="CheckTest">
                    <Variable>CheckTest</Variable>
                    <Label>CheckTest</Label>
                    <HAlign>right</HAlign>
                </GuiOption>
            </Column>
        </Row>
    </Page>

    <!-- ***No User Interface section***  -->
    <NoUI>
        <NoUIOption Variable="NoUIOption_TEST" >
            <SetValue>
                <Query Type="LinkTo">CheckTest</Query>
            </SetValue>
            <Toggle Group="Group_TEST">
                <Enabled>TRUE</Enabled>
                <Disabled>FALSE</Disabled>
            </Toggle>
        </NoUIOption>

    </NoUI>
</TsGui>