[top] [up] [next]

Sizers


A panel window redraws and resizes itself when necessary, but a panel window relies on an instance of the class sizer to calculate the new size. There are three types of sizers:

For most panel windows a sizer instance of the class sizerClient is used, it ensures that a panel window completely fills a client area (=area inside a window, this area does not include the border, title- and menu bar) of a frame window.

With the fixed and percent sizers it is possible to set the alignment attribute, this attribute determines on which side of a frame the panel should be placed, it is possible to have a panel 'stick' to the left, top, bottom or right side of a frame window. See also the method sizer::putAlignment/1.

sizerFixed example
    Panel1 new_obj panel,
    Panel1<-create(T, true),
    S1 new_obj sizerFixed,         %Create a fixed sizer
    S1<-putAlignment(bottom),    %Set the alignment of the sizer, it will stick to the bottom
    S1<-putNumPixels(30, true),  %The panel will be 30 pixels high
    Panel1<-putSizer(S1),
sizerPercent example
    Panel2 new_obj panel,
    Panel2<-create(T, true),
    S2 new_obj sizerPercent,
    S2<-putAlignment(left),               %The panel will stick to the left side of the frame
    S2<-putPercentage(30, true),     %Width of the panel isl 30% of the width of the frame
    Panel2<-putSizer(S2),
sizerClient example
Panel3 new_obj panel,
Panel3<-create(T, true),   
S3 new_obj sizerClient,    %Create a sizer for the remaining client area
Panel3<-putSizer(S3),       %Associate sizer with the panel

There is an example called 'sizers' that demonstrates all three types of sizers in a single frame window. The source of the example is located in the subfolder 'examples\sizers\' of the folder of Trinc-Prolog.

[top] [up] [next]

 

info@trinc-prolog.com