Прикольно, на расстановку и пристыковку трачу больше времени чем в других средах (уже привыкать начал, но). Свойство Align - такое нужное дело, а его нет.
Ну, Мартин сразу "tlayouter" сделал - на самые извращенные расстановки и выравнивания.
Кста, сетка в лазаре (лин) у меня так прикольно работает. Закачаться мона... Такие тормоза при выводе данных.
Наверное, сетка к датасету привязана и синхронно с ним заполняется. В МСЕ тоже тормоза были - пока не засунулми заполнение грида между "dataset.DisableControls" & "dataset.EnableControls".
Добавлено спустя 10 минут 29 секунд:Краткое описание лэйаутера-а:
- Код: Выделить всё
tlayouter
* a tspacer descendant designed to (auto)resize or/and move
its contained widgets acc to some size/positon dependencies
* may have GUI look, frame caption etc switched off by default
* layouters may be nested to achieve copmplex layouts
Each layout change/assignment is divided into performing 2 consequent stages :
Stage 1:
- if {lao_placex OR lao_placey} :
= if {plo_scalesize in optionslayout} then
* widgets with "osk_nopropwith" unset in their "optionsskin" are h-scaled
in the proportion of change of tlayouter's clientwidth
* widgets with "osk_nopropheight" unset in their "optionsskin" are v-scaled
in the proportion of change of tlayouter's clientheight
For h-resized layouter, the effect looks like :
|--Widget__1---Widget__2--| => the initial look
|--Widget_1--Widget_2--| => the layouter gets narrower
|---Widget___1---Widget___2---| => the layouter gets wider
*** both widget sizes & margins are affected ***
*** Widget_N may generally situate on different y-levels ***
otherwise :
= if lao_scalewidth in optionslayout :
* widgets with "osk_nopropwith" unset in their "optionsskin" enters in the mode
( not applied until the layouter resizes! ) when they are h-scaled in the proportion
as far as clientwidth of the tlayouter changes, then stages 2 & 3 are reapplied
For h-resized layouter, the effect looks like :
|--Single____widget????| => the initial look
|--Single__widget???| => the layouter gets narrower
|--Single_______widget?????| => the layouter gets wider
* also, if {lao_scaleleft in optionslayout} then left margins of the widgets
with unset "optionsskin.osk_nopropleft" resize too otherwise retain
= if lao_scaleheight in optionslayout :
* widgets with "osk_nopropheight" unset in their "optionsskin" enters in the mode
( not applied until the layouter resizes! ) when they are v-scaled in the proportion
as far as clientheight of the tlayouter changes, then stages 2 & 3 are reapplied
* also, if {lao_scaletop in optionslayout} then top margins of the widgets
with unset "optionsskin.osk_noproptop" resize too otherwise retain
*** only widget sizes & margins not distances between them are affected ***
Stage 2:
Widgets may be auto resized against themselves not the layouter
in 5 consequent steps using the following options:
- if plo_syncmaxautosize in place_options :
= all widgets are autosized then their client areas are
syncronized to the clientareas of the highest and the widest of the widget
* calls "msegui.syncmaxautosize"
- if plo_syncpaintwidth in place_options :
= the paintwidths of all widgets are synchronized to the widget
with the widest outer frame width ( ex. width of "frame.caption" )
* mainly makes sense if "lao_alignx" set and {align_glue = wam_start or wam_end} ( see below )
when the widgets will be adjusted in order to fit into
the inner client width of tlayouter:
x-aligh level
V
| Widget_1 the_widest_frame_caption1|
| Widget_2 norm_frame_caption2 |
| Widget_N wider_frame_captionN |
here, the effect is shown for "cp_right" frame captions
// otherwise syncronizes to the outer ( of the frame except its caption ) width
// of the Z-top widget
* calls "msegui.syncpaintwidth"
* paintwidth is the outer width
- if plo_syncpaintheight in place_options :
= the paintheights of all widgets are synchronized to the widget
with the highest outer frame width ( ex. width of "frame.caption" ).
* mainly makes sense if lao_aligny set and {align_glue = wam_start or wam_end} ( see below )
the widgets will be adjusted in order to fit into
the inner client height of tlayouter :
+------------------------------+
| The_ |
| tallest_ taller_ |
| frame_ frame_ frame_ |
| caption caption2 captionN |
| |
| Widget1 Widget_2 Widget_N |<== y-align level
here, the effect is shown for "cp_topleft" frame captions
// otherwise syncronizes to the outer ( of the frame except its caption )
// height of the Z-top widget
* calls "msegui.syncpaintheight"
- plo_synccaptiondistx in place_options :
= causes all widgets to have the widest common room for their cp_(left/right)* frame captions
* calls "msegui.synccaptiondistx"
- plo_synccaptiondisty in place_options :
= causes all widgets to have the highest common room for their cp_(top/bottom)* frame captions
* calls "msegui.synccaptiondisty"
Stage 3:
the widgets may be (re)arranged/sized against the layouter & between the widgets :
There're 2 modes of such (re)arrangement which can be partially ( orthogonally ) combined ( see later ):
1) the place(ment) mode ( lao_place* in optionslayout ) :
- widgets are placed at some distances between each other, possibly with some margins,
rooms of invisible widgets ( having visible=false) are also allocated
unless "plo_noinvisible in place_options"
* the widgets are placed in the order of decreasing their "widgetrect.x/y" coordinates before alignment
* the inter-widget distances and the side margins ( if apllied ) in both dimentions
are identical and limited between "place_mindist" and "place_maxdist"
= if {lao_placex in optionslayout} and
{place_mode <> wam_none}
then the following relevant settings aplly :
* non-limiting value of "place_maxdist" :
# |Widget_1------Widget_2------Widget_3|
* non-limiting value of "place_maxdist" and
{plo_propmargin in place_options} :
# |---Widget_1---Widget_2---Widget_3---|
* limiting value of "place_maxdist" and
{place_mode = wam_start} :
# |Widget_1----Widget_2----Widget_3????|
* limiting value of "place_maxdist" and
{place_mode = wam_start} and
{plo_propmargin in place_options} :
# |---Widget_1---Widget_2---Widget_3???|
* limiting value of "place_maxdist" and
{place_mode = wam_end} :
# |??????Widget_1---Widget_2---Widget_3|
* limiting value of "place_maxdist" and
{place_mode = wam_end} and
{plo_propmargin in place_options} :
# |???Widget_1---Widget_2---Widget_3---|
* limiting value of "place_maxdist" and
{place_mode = wam_center} :
# |???Widget_1---Widget_2---Widget_3???|
* limiting value of "place_maxdist" and
{plo_endmargin in place_options} :
# |Widget_1----Widget_2----Widget_____3|,
or
# |Widget_1----Widget_____2----Widget_3|,
or
# |Widget_____1----Widget_2----Widget_3|,
here, the most left amongst widgets having both [an_left,an_right] set is expanded
otherwise the most right widget ( Widget_3 in the example )
* limiting value of "place_maxdist" and
{place_mode = wam_end} and
{plo_propmargin in place_options} and
{plo_endmargin in place_options} :
# |--Widget_1--Widget_____2--Widget_3--|,
The legend:
limiting value
of "place_maxdist" : such value which produce
some visuall effect on the layouter
"----" : distance ( = number of minuses, limited by place_maxdis )
"????" : some remaining space ( = number of questmarks )
"Widget_1" : widget of the original size
"Widget__..__1" : (auto)resized widget
= if {lao_placey in optionslayout} and
{place_mode <> wam_none}
then the things are handled in the same manner as with "lao_placex"
but for the vertical "top2bottom" direction of placement instead of
the horizontal "left2right" one
2) the align(ment) mode ( optionslayout.lao_align* ) :
- widgets are gathered into a visual group to a dedicated "leader" widget of the layout
( set by "align_leader" and defaults to the lowest in Z-Order = twidget.widgets[0] )
the leader stays in place while the others :
= if lao_alignx in optionslayout ( the hor alignment mode ):
* if align_mode = wam_start : snap their left borders to the left border of leader
* else if align_mode = wam_end : snap their right borders to the right border of leader
* else if align_mode = wam_center : snap their v-axes to the v-axis of leader
after that,
= if lao_aligny in optionslayout ( the vert alignment mode ):
* if align_mode = wam_start : snap their top borders to the top border of leader
* else if align_mode = wam_end : snap their bottom borders to the bottom border of leader
* else if align_mode = wam_center : snap their h-axes to the h-axis of leader
- after that, the whole widget group can be aligned within the layouter:
= if align_glue = wam_start
* if lao_alignx in optionslayout:
# the left extent of group snaps to the left border of layouter
# if {plo_synpaintwidth in place_option} then the widgets of group may be h-squeezed so that not to extrude beyond the layouter
( as if they have both left & right anchors unset )
* if lao_aligny in optionslayout:
# the top extent of group snaps to the top border of layouter
# if {plo_synpaintheight in place_option} then the widgets of group may be v-squeezed so that not to extrude beyond the layouter
( as if they have both top & bottom anchors unset )
= else if align_glue = wam_end
* if lao_alignx in optionslayout:
# the right extent of group snaps to the right border of layouter
# if {plo_synpaintwidth in place_option} then the widgets of group may ne h-squeezed so that not to extrude beyond the layouter
( as if they have both left & right anchors unset )
* if lao_aligny in optionslayout:
# the bottom extent of group snaps to the bottom border of layouter
# if {plo_synpaintheight in place_option} then the widgets of group may be v-squeezed so that not to extrude beyond the layouter
( as if they have both top & bottom anchors unset )
= else if align_glue = wam_center
* if lao_alignx in optionslayout: the v-axis of group snaps to the v-axis of layouter
* if lao_aligny in optionslayout: the h-axis of group snaps to the h-axis of layouter
Mutually exclusive settings:
* only one of "align_mode" can be choosen
* only one of "glue_mode" can be choosen
* "optionslayout.lao_alignx" & "optionslayout.lao_placex"
* "optionslayout.lao_aligny" & "optionslayout.lao_placey"
V-alignment ( optionslayout.lao_aligny ) may be combined
with h-placement ( optionslayout.lao_placex ), and
h-alignment ( optionslayout.lao_alignx ) may be combined
with v-placement ( optionslayout.lao_placey )
!!! The effects of the above described { resizing / placement / alignment } are irreversible.
So, the only way to revert is to set "wan_none" then to revert manually !!!
============================
The external interface :
TWidget stuff:
- name
- anchors
- bounds
- color
- enabled
- visible
- <face> : see {any face}
- <frame> : see {any frame}
- hint
- helpcontext
- tag
- taborder
- cursor
- optionswidget
- optionsskin
- popupmenu
twidget's event handlers:
- on(de)activate
- onbeforeupdateskin
- onafterupdateskin
- onchildscaled
- onfontheightdelta
- on(de)focus
- onenter
- onmove
- onpopup
- onresize
- onshowhint
align_glue :
( outer anchoring mode for widget group, in the align mode )
- wam_none
- wam_start
- wan_center
- wm_end
align_leader :
the widget ( incl another spacer, splitter or layouter ) against which the aligment applies ( the reference widget )
align_mode :
( inner anchoring mode within widget group, in the align mode )
- wam_none
- wam_start
- wan_center
- wm_end
// Place mode:
place_mindist, place_maxdist:
- in the place(ment) mode, limits distance between widgets
( these distance once calclated also define side margins if aplicable )
place_mode:
( outer anchoring mode for widget group, in the place mode )
- wam_none
- wam_start
- wan_center
- wm_end
place_options:
- plo_endmargin
= to resize a widget so that it "eats" extra space if it occurs
* only applicable in the place mode, with a limiting value of "place_maxdist" and:
1) {place_mode <> wam_none}
or
2) {place_mode = wam_end} and {plo_propmargin in place_options}
For the exact look, see above
- plo_propmargin
= виджеты расставляются теснее так, чтобы образовались отступы перед и после,
причем расстояние между центрами виджетов было бы таким же,
как и растояние между серединами крайних виджетов и соотв. границами зоны расстановки
- plo_syncmaxautosize
= see above
- plo_synccaptiondistx
= see above
* affects widgets with opposite cp_left/right set as well
* the minimal before-adjustment "captiondist" amongst all widgets limits "captiondist" for each of the widget
* don't set cfo_captiondistouter here !
- plo_synccaptiondisty
= see above
* affects also widgets with opposite cp_top/bottom set
* the minimal before-adjustment "captiondist" amongst all widgets limits "captiondist" for each of the widget
! here, don't set "cfo_captiondistouter" for affected widgets !
- plo_syncpaintwidth
= see above
- plo_syncpaintheight
= see above
- plo_scalesize
= see above
dist_left, dist_right, dist_top, dist_bottom :
= margins between most outer edge the layouter and
the corresponding linked widget
* see "tspacer" for detail
linkleft,linkright,linktop,linkbottom : see "tspacer"
options:
- spao_glueright, spao_gluebottom:
= set the adjustment dependencies between the layouter an its link_* widgets
* see "tspacer" for more details
// which mode of widget placement to apply - see above
optionslayout:
- lao_alignx
- lao_aligny
- lao_placex
- lao_placey
- lao_scalewidth
- lao_scaleheight
- lao_scaleleft
- lao_scaletop
* lao_place* & lao_align* can't be combined for one direction
optionsscale:
* cause the layouter to provide full space for the widgets as long as they expand/shrink/move
- osc_expandx
= allocates more h-space if needed
- osc_shrinkx
= removes extra h-space if occured
- osc_expandy
= allocates more v-space if needed
- osc_shrinky
= removes extra v-space if occured
- osc_invisishrinkx
= fully h-collapses the layouter if "visible=false" ( run-time only )
- osc_invisishrinky
= fully v-collapses the layoter if "visible=false" ( run-time only )
optionsskin:
= see <any widget>
Methods:
constructor create(aowner: tcomponent); override;