Setup Factory 10

DlgSelectPackages.UpdateDisplay

DlgSelectPackages.UpdateDisplay

This is the first topic This is the last topic  

DlgSelectPackages.UpdateDisplay

This is the first topic This is the last topic  

OverviewExamples

DlgSelectPackages.UpdateDisplay (

number ControlID )

Example 1

DlgSelectPackages.UpdateDisplay(CTRL_SELECT_PACKAGE_TREE);

Updates the packages control.

Example 2

-- Get the properties of the first catagory

tProps = DlgSelectPackages.GetCategoryProperties(CTRL_SELECT_PACKAGE_TREE, CTRL_CATEGORY_001);

 

-- If it was expanded, collapse it, otherwise expand it

DlgSelectPackages.SetCategoryProperties(CTRL_SELECT_PACKAGE_TREE, CTRL_CATEGORY_001, {Expanded = not tProps.Expanded});

 

-- Update the display

DlgSelectPackages.UpdateDisplay(CTRL_SELECT_PACKAGE_TREE);

This example toggles the expanded state of a package category.

Example 3

if(e_CtrlID == CTRL_SELECT_PACKAGE_TREE) then

   -- the control message is from the select packages tree...

   -- if an item's state changed (i.e. a package was turned on or off),

   if(e_MsgID == MSGID_ONSTATECHANGED) and (e_Details.nCtrlID == CTRL_CATEGORY_001 or e_Details.nCtrlID == CTRL_CATEGORY_002) then

       -- an item's state has changed, and the item is either the first or the second package category

       if e_Details.nCtrlID == CTRL_CATEGORY_001 then

           -- the first package category's state changed

           tProps = DlgSelectPackages.GetCategoryProperties(CTRL_SELECT_PACKAGE_TREE, CTRL_CATEGORY_001);

               if tProps.State > 1 then

                   -- state is indeterminate or unchecked. Set state to unchecked, set other category's state to checked

                   DlgSelectPackages.SetCategoryProperties(CTRL_SELECT_PACKAGE_TREE, CTRL_CATEGORY_001, {State=2});

                   DlgSelectPackages.SetCategoryProperties(CTRL_SELECT_PACKAGE_TREE, CTRL_CATEGORY_002, {State=1});

               else

                   -- is checked, uncheck other one

                   DlgSelectPackages.SetCategoryProperties(CTRL_SELECT_PACKAGE_TREE, CTRL_CATEGORY_001, {State=1});

                   DlgSelectPackages.SetCategoryProperties(CTRL_SELECT_PACKAGE_TREE, CTRL_CATEGORY_002, {State=2});

               end

       elseif e_Details.nCtrlID == CTRL_CATEGORY_002 then

           -- the second package category's state changed

           tProps = DlgSelectPackages.GetCategoryProperties(CTRL_SELECT_PACKAGE_TREE, CTRL_CATEGORY_001);

           if tProps.State > 1 then

               -- state is indeterminate or unchecked.  set state to unchecked, set other category's state to checked

               DlgSelectPackages.SetCategoryProperties(CTRL_SELECT_PACKAGE_TREE, CTRL_CATEGORY_002, {State=2});

               DlgSelectPackages.SetCategoryProperties(CTRL_SELECT_PACKAGE_TREE, CTRL_CATEGORY_001, {State=1});

           else

               -- is checked, uncheck other one

               DlgSelectPackages.SetCategoryProperties(CTRL_SELECT_PACKAGE_TREE, CTRL_CATEGORY_002, {State=1});

               DlgSelectPackages.SetCategoryProperties(CTRL_SELECT_PACKAGE_TREE, CTRL_CATEGORY_001, {State=2});

           end

       end

       -- update the package display

       DlgSelectPackages.UpdateDisplay(CTRL_SELECT_PACKAGE_TREE);

   end

end

In a packages control with two categories, if the first category is checked, the second will be unchecked.  If the first is unchecked, the second will be checked. This action script is meant to be located on the On Ctrl Message event.

Note: Please note that this example does not take into account categories which are indeterminate. The first two categories will either be set to checked, or unchecked.

See also: Related Actions


Learn More: Indigo Rose Software - Setup Factory - Buy Now - Contact Us