Something like a Sheet / Tab to Overlay Groups of Controls

… but not a sheet/tab control.
we have a large number of controls, mostly in groups, on an existing tab control that are hidden/unhidden depending on what the user selects.
Maintenance of these controls is a PITA and it’s really fugly from a dev view (snippet for an idea).
image

I don’t want to put a sheet on a sheet as I can’t get the tabs to hide or dissapear sufficiently to make it look neat, the tab and shadows always show.
Does anyone have any suggestions that may point me in a direction - I’d like to separate the controls onto ‘pages’ like tabs, and hide the unnecessary pages. This will make maintenance and coding much easier.
Andrew

Have you tried using GROUPs

Use a SHEET with the WIZARD attribute.

At Design time its nice to have Tabs to make it easy to flip between so I usually put Tabs BELOW:

image


At runtime set ?Sheet{PROP:Wizard}=True to hide the Tabs as shown below. You can pick WIZARD in the Designer Props to help fit it as you desire, but I would always set it at runtime as it is so easy to leave the Tabs showing.

Use Select(?TabXxxx) to display it, or Hide all but the 1 tab you want to see.

image


Select NoSheet or ?Sheet{PROP:NoSheet}=True to remove the 3D Border:

image

You can play with everything Sheet and Tabs using my tool:

3 Likes

Another way is to design all your Groups Off Window. Then move them into place at runtime and resize the Window to hide the extra space.

I do this in the below window. One of the Yellow groups on the far right is moved into Spot 1. The Green Group is for Sheets and is moved over Edges Group.

At runtime after moving the Group and resizing. This window is from my Window Preview Class.

image

image


In Clarion if you SetPosition(?Group,...) it will not move the child controls so you’ll need code like:

GroupMoveChildren  PROCEDURE(LONG FrmGrp, LONG ToGrp, LONG XAdjust=0, LONG YAdjust=0)
DX LONG,AUTO  !Destination (To), then Delta
DY LONG,AUTO
FX LONG,AUTO
FY LONG,AUTO
Ndx LONG,AUTO
ChildFEQ LONG,AUTO
  CODE
  GETPOSITION(ToGrp,DX,DY) ; DX+=XAdjust ; DY+=YAdjust
  GETPOSITION(FrmGrp,FX,FY)
  SETPOSITION(FrmGrp,DX,DY) ! Message('To AT( ' & DX &','& DY &'||From  AT( ' & FX &','& FY &'||Delta AT( ' & DX-FX &','& DY-FY) 
  DX -= FX ; DY -= FY
  LOOP Ndx=1 TO 999
     ChildFEQ=FrmGrp{PROP:Child,Ndx} ; IF ~ChildFEQ THEN BREAK.
     GETPOSITION(ChildFEQ,FX,FY)
     SETPOSITION(ChildFEQ,FX+DX,FY+DY) ! IF Ndx=1 THEN  Message('Idx 1 To From  AT( ' & FX &','& FY &'||TO AT( ' & DX+FX &','& DY+FY) .
  END
  RETURN

Note that this does not move GROUP’s inside of GROUP’s. I know I’ve done that before so probably call recursively.

Edit: There are also Child controls for OPTION, SHEET and TAB. I would not check PROP:Type instead I would simply check IF {PROP:Child,Ndx} <> 0 .

I wrote this one when Bernie was asking for the same thing about 20-25 years ago or so :slight_smile:

MoveParentControl  Procedure(Long pParentFEQ,Long pXShift,Long pYShift,Byte pMoveType=0)
XOffset  Long
YOffset  Long
OldXPos  Long
OldYPos  Long
NewXPos  Long
NewYPos  Long

  Itemize,Pre(MoveType)
Shift    Equate(0)
Move     Equate(1)
  end

Ndx      Long
ChildFEQ Long
Hidden   Byte

  Code

  Hidden = pParentFEQ{PROP:Hide}
  Hide(pParentFEQ)
  OldXPos = pParentFEQ{PROP:XPos}
  OldYPos = pParentFEQ{PROP:YPos}
  Case pMoveType
  of MoveType:Shift
    NewXPos = OldXPos + pXShift
    NewYPos = OldYPos + pYShift
    XOffset = pXShift
    YOffset = pYShift
  of MoveType:Move
    NewXPos = pXShift
    NewYPos = pYShift
    XOffset = NewXPos - OldXPos
    YOffset = NewYPos - OldYPos
  end
  pParentFEQ{PROP:XPos} = NewXPos
  pParentFEQ{PROP:YPos} = NewYPos
  Ndx = 0
  Loop
    Ndx += 1
    ChildFEQ = pParentFEQ{PROP:Child,Ndx}
    If NOT ChildFEQ then break.
    MoveParentControl(ChildFEQ,XOffSet,YOffset,0)
  end
  If NOT Hidden
    Unhide(pParentFEQ)
  end

While I prefer SETPOSITION() as less code than PROP:AT’s in my testing only PROP:AT’s worked with PROP:DerferMove active so are a better way. In this case the Group is HIDE so not an issue.

Thanks very much Carl. I hadn’t considered using the Wizard property (haven’t had the need to use it at all).

I’m still migrating to C11 (I’ve done it once, 95+% success) and am preparing to do so again very soon, at which time I’ll take a look at the tools.

(My) overnight, I thought I might redesign the form. It’s been like that for over 15 or 20 years, a refresh might be in order - along with a bunch of other windows and forms that are a bit stale.

Thanks again for the enlightenment.

Andrew.