class PtDivider PtContainer { divider_flags; // flag (Pt_ARG_DIVIDER_FLAGS) divider_offset; // short (Pt_ARG_DIVIDER_OFFSET) divider_sizes; // PhPoint array (Pt_ARG_DIVIDER_SIZES) }
This widget is a container that makes adjustable rows or columns out of its child widgets, such as PtButtons or PtPanes. Its instance variables let you control how or whether the children get resized, and to find their relative positions.
![]() | For detailed information, please refer to PtDivider in the Photon documentation. |
| Constant | Description |
|---|---|
| Pt_DIVIDER_NORESIZE | Generates the callback without resizing children. |
| Pt_DIVIDER_RESIZE_BOTH | ON, the default, resizes the widgets on either side of the handle. OFF moves the immediately right (or bottom) children and resizes the immediately left (or top) child and the far right (or bottom) child. |
| Pt_DIVIDER_INVISIBLE | Hides the drag outline. Used with Pt_DIVIDER_NORESIZE. |
| Pt_DIVIDER_CASCADE | Internal informational bit. |
The following callbacks are associated with this widget:
| Callback | Description |
|---|---|
| Pt_CB_DIVIDER_DRAG | This callback is generated after each drag event the widget receives. |
| Pt_CB_DIVIDER_SETRESOURCES | This callback is generated when the divider resources are set. |
This example, ex_PtDivider.g, is included in the product distribution.
#!/usr/cogent/bin/phgamma
/*
* This example loads a PtDivider that holds three
* buttons arranged vertically.
*/
require_lisp("PhotonWidgets.lsp");
require_lisp("PhabTemplate.lsp");
PtInit(nil);
/* This function lets a button control the divider resize
* feature (on or off), and makes the label on the button
* change accordingly.
*/
function toggle_resize(button, division)
{
if((button.flags & Pt_SET) != 0)
{
button.text_string = "Resizing\nis switched\nOFF";
division.divider_flags = Pt_DIVIDER_NORESIZE;
}
else
{
button.text_string = "Resizing\nis switched\nON";
division.divider_flags = cons(Pt_DIVIDER_NORESIZE, nil);
}
}
wfile = PhabReadWidgetFile (string(_os_, "-WidgetFiles/wgt/divider.wgtw"));
window = PhabCreateWidgets(wfile, nil, nil);
win = PhabLookupWidget(window,#divider,nil);
div = PhabLookupWidget(window,#MainDivider,nil);
tbut = PhabLookupWidget(window,#DivButton2,nil);
exitbut = PhabLookupWidget(window,#DivButton3,nil);
div.divider_flags = Pt_DIVIDER_INVISIBLE;
PtAttachCallback(tbut, Pt_CB_ACTIVATE, `toggle_resize(@tbut, @div));
PtAttachCallback(exitbut, Pt_CB_ACTIVATE, #exit_program(1));
PtRealizeWidget(win);
/*
* Assign an offset, and then print the offset and sizes.
*/
div.divider_offset = -10;
pretty_princ("Offset: ",div.divider_offset,"\n");
pretty_princ("Sizes: ",div.divider_sizes,"\n");
PtMainLoop();
Copyright © 1995-2006 by Cogent Real-Time Systems, Inc. All rights reserved.