PtPanelGroup - deactivate certain panels

Hi,

is there a way to deactivate certain panels in a PanelGroup (e.g. panel 1 and 3 are selectable, but panel 2 isn’t)?
For a button i would just clear the Pt_SELECTABLE Flag, but unfortunately it is cleared already for the panes in the PanelGroup.

Thanx in advanced,

Smee

Hi,

One way to do this is to create a Panel Switching callback and do something like this:

int panelSwitching( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
     short *panel;
     PtPanelGroupCallback_t *pgcb;

     PtGetResource( ABW_MainPanelGroup, Pt_ARG_PG_CURRENT_INDEX, &panel, 0 );  // This is the current panel
     pgcb = (PtPanelGroupCallback_t *)(cbinfo->cbdata);  // This is the call-back info with the selected panel

     if (*panel == 0)  // Use this if panel 2 is not selectable from panel 0 only
     {
          if (pgcb->new_panel_index == 2)
          {
              return (Pt_END);   // prevent the switch
          }
      }

     return (Pt_CONTINUE);
}

got it workin’, thanks

next question: is the a way to alter the font of “deactivated” panels (i.e. have their title written in a light gray in stead of black)?

Haven’t found a good way of altering the font on “deactivated” panels, yet. The application that I’m working on may require this feature, so I’m still looking into it. Will post when I have more info. In the meantime, if you find a way to do this, let me know!

Well,

I found something, although this isn’t the best way:
When the Pt_PG_USE_PANEL_COLORS in the Pt_ARG_PG_FLAGS is set, each panel can have its own color (Pt_ARG_FILL_COLOR from the panel is used). So at least you can make deactivated panels appear diffrent from the activatable ones.

The help also says that the panel Title text will change its color according to Pt_ARG_COLOR. But this feature behaves strange in my app: It only works when a panel after (i.e. with a higher index) the one with changed Pt_AGR_COLOR is selected. (Sounds strange, I know. Just try it and you’ll see what I mean.)

Hi Smee,

 I was also playing with Pt_PG_USE_PANEL_COLORS, but it didn't seem to work as advertised inside of PhAB.  Too bad there isn't a way to access the PtTab widget itself inside of a PtPanelGroup...

Have you tried this…

You can deactivate a panel by removing it from the panel group by doing this:

PtUnrealizeWidget( UnwantedPanelName );

Then when you want it back again, just use PtRealizeWidget() on the same panel name.

It’s not the same as changing the color of an deactivated panel, but it works.