PxPlus User Forum

Twitter Twitter Twitter

Author Topic: *wingrp  (Read 795 times)

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
*wingrp
« on: March 10, 2021, 02:56:19 AM »
Is there a tool to define a group for *wingrp on the fly?

Loren Doornek

  • Gold Member
  • ****
  • Posts: 85
    • View Profile
Re: *wingrp
« Reply #1 on: March 10, 2021, 08:06:34 AM »
I'm not aware of a utility, but I've done this is a few programs.  The groups used by *wingrp are really just a string of data.  The first 3 characters is the number of controls in the group, and this is followed by a series of 3-character strings which are the BIN value of the controls.  Following this is a string of data representing screen items without a control number (like lines/frames/labels), which are a little different.

Groups are created in *winproc.dsp in the DEF_GRP section, and you can use that to figure out how the group string is created.  You can also see how it is used in *wingrp.

If you're just trying to create a group that has controls in it (ie: buttons, checkboxes, dropboxes, etc.), below is a simplified program that shows how to do that.

One caveat:  If you're using Nomads, it's probably best to have the group defined on the panel by default with at least one control, since Nomads does keep track of the group names.  You should be able to modify the group after that without a problem.

0010 BEGIN
0020 PRINT 'CS'
0030 LET test1.ctl=10; BUTTON test1.ctl,@(0,0,10,2)="Test1"
0040 LET test2.ctl=20; BUTTON test2.ctl,@(10,0,10,2)="Test2"
0050 LET grp$="000"
0060 LET ctlnum=test1.ctl,tp=0; GOSUB DEF_GRP
0070 LET ctlnum=test2.ctl,tp=0; GOSUB DEF_GRP
0080 LET test.grp$=grp$
0090 PRINT @(0,5),'CE',"Group created"; WAIT 2
0100 PRINT @(0,5),'CE',"Hide Group..."; CALL "*wingrp;hide",test.grp$; WAIT 2
0110 PRINT @(0,5),'CE',"Show Group..."; CALL "*wingrp;show",test.grp$; WAIT 2
0120 PRINT @(0,5),'CE',"Disable Group..."; CALL "*wingrp;disable",test.grp$; WAIT 2
0130 PRINT @(0,5),'CE',"Enable Group..."; CALL "*wingrp;enable",test.grp$; WAIT 2
0140 END
0150 !
0160 DEF_GRP:
0170 LET grpct=NUM(grp$(1,3))
0180 LET _g$=BIN(ctlnum,2)+BIN(_tp,1)
0190 LET grp$=STR(grpct+1:"000")+grp$(4,grpct*6)+HTA(_g$)
0200 RETURN