Julian Carr Posted August 9, 2021 Share Posted August 9, 2021 Is there any way to expand or collapse a widget separator group using VS? For example the LABEL line group below... Thanks! Quote Link to comment
Peter Vandewalle Posted August 9, 2021 Share Posted August 9, 2021 Yes there is. The PIO must be event-enabled. I'm doing this in Python, but it should also work in Vectorscript. In the Event 5 (kObjOnInitXProperties) routine, include these 3 lines: Python: _bResult = vs.SetObjPropVS(8, True) # kObjXPropHasUIOverride _bResult = vs.SetObjPropCharVS(81, vs.Chr(2)) # kWidgetGroupMode, kWidgetGroupAutomatic object_info_palet(_sPIOName) Vectorscript: bResult = SetObjPropVS(8, TRUE); {* kObjXPropHasUIOverride *} bResult = SetObjPropCharVS(81, Chr(2)); {* kWidgetGroupMode, kWidgetGroupAutomatic *} ObjectInfoPalet(sPIOName); The last line calls these procedures. At least that's how I do it. Python: def object_info_palet(_sPIOName): _iPIOID = 100 _iPIOID = insert_separator(_iPIOID, _sPIOName, "Global", 0) _iPIOID = insert_parameter(_iPIOID, _sPIOName, "LineLength", 1) _iPIOID = insert_parameter(_iPIOID, _sPIOName, "Diepte", 1) def insert_separator(_iID, _sPIOName, _sParameter, _iIndent): _bResult, _sTmp = vs.GetLocalizedPluginParameter(_sPIOName, _sParameter) if _bResult: _bResult = vs.vsoAddWidget(_iID, 100, _sTmp) _bResult = vs.vsoAppendWidget(100, _iID, _sTmp, 0) vs.vsoWidgetSetIndLvl(_iID, _iIndent) return _iID+1 def insert_parameter(_iID, _sPIOName, _sParameter, _iIndent): _bResult, _sTmp = vs.GetLocalizedPluginParameter(_sPIOName, _sParameter) if _bResult: _bResult = vs.vsoAddParamWidget(_iID, _sParameter, "") _bResult = vs.vsoAppendParamWidget(_iID, _sTmp, 0) vs.vsoWidgetSetIndLvl(_iID, _iIndent) return _iID+1 Vectorscript: PROCEDURE ObjectInfoPalet; VAR iPIOID: INTEGER; BEGIN iPIOID := 100; iPIOID := InsertSeparator(iPIOID, sPIOName, 'Global', 0); iPIOID := InsertParameter(iPIOID, sPIOName, 'LineLength', 1); iPIOID := InsertParameter(iPIOID, sPIOName, 'Depth', 1); ... END; FUNCTION InsertSeparator(iID: INTEGER; sPIO, sField: STRING; iIndent: INTEGER): INTEGER; VAR bResult: BOOLEAN; sTmp: STRING; BEGIN bResult := GetLocalizedPluginParameter(sPIO, sField, sTmp); IF bResult THEN BEGIN bResult := vsoAddWidget(iID, 100, sTmp); bResult := vsoAppendWidget(100, iID, sTmp, 0); vsoWidgetSetIndLvl(iID, iIndent) END; InsertSeparator := iID + 1; END; FUNCTION InsertParameter(iID: INTEGER; sPIO, sField: STRING; iIndent: INTEGER): INTEGER; VAR bResult: BOOLEAN; sTmp: STRING; BEGIN bResult := GetLocalizedPluginParameter(sPIO, sField, sTmp); IF bResult THEN BEGIN bResult := vsoAddParamWidget(iID, sField, ''); bResult := vsoAppendParamWidget(iID, sTmp, 0); vsoWidgetSetIndLvl(iID, iIndent); END; InsertParameter := iID + 1; END; I hope the Vectorscript is correct, I do more Python these days. Quote Link to comment
Julian Carr Posted August 9, 2021 Author Share Posted August 9, 2021 Thanks Peter. Actually I know how to add a separator. The question was, it there a way to expand or collapse a whole separator group to achieve the same result as if you manually clicked the little black triangle on the left of the separator row? Quote Link to comment
Peter Vandewalle Posted August 10, 2021 Share Posted August 10, 2021 Sorry for my misunderstanding. I don’t think there is a way to script the collapsing. Quote Link to comment
Julian Carr Posted August 10, 2021 Author Share Posted August 10, 2021 No worries Peter. Thanks for your noble attempt! 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.