[Gambas-user] r5490, did you clean up too much ?
Bruce
bbruen at ...2308...
Sun Jan 6 09:23:22 CET 2013
OK, I have been playing with this all day.
What is happening in _Split.Layout does not make sense.
I modified my original demo to add some debugs which is attached.
And here is the output(with #comments):
Run 0 : Before anything the config file is manually set to
MainSplitter=[5,5,5]
Run 1 : Hsplit layout not touched
=================================
FMain.Form_Open.13: ---- values as read using
Settings["FMain/MainSplitter"] ----
FMain.Form_Open.14: Directly read Layout numbers: 5 5
5
FMain.Form_Open.15: Direct Left part %age: 33.3333333333333
FMain.Form_Open.16: Direct Middle part %age: 33.3333333333333
FMain.Form_Open.17: Direct Right part %age: 33.3333333333333
FMain.Form_Open.21: ---- values AFTER the layout has been set (using
MainSplitter.Layout = iDirect ----
FMain.Form_Open.22: MainSplitter.Layout numbers: 2 2
2
FMain.Form_Open.23: MainSplitter.Layout Left part %age: 33.3333333333333
FMain.Form_Open.24: MainSplitter.Layout Middle part %age:
33.3333333333333
FMain.Form_Open.25: MainSplitter.Layout Right part %age:
33.3333333333333
FMain.Form_Close.34:
FMain.Form_Close.35: Actual Layout numbers: 284 284 284
FMain.Form_Close.36: Left part %age: 33.3333333333333
FMain.Form_Close.37: Middle part %age: 33.3333333333333
FMain.Form_Close.38: Right part %age: 33.3333333333333
FMain.Form_Close.42: ---- values read back in from the config file AFTER
the Settings.Write ----
FMain.Form_Close.43: Saved Layout numbers: 284 284 284
FMain.Form_Close.44: Left part %age: 33.3333333333333
FMain.Form_Close.45: Middle part %age: 33.3333333333333
FMain.Form_Close.46: Right part %age: 33.3333333333333
Run 2 : Left part shrunk just a little bit
==========================================
FMain.Form_Open.13: ---- values as read using
Settings["FMain/MainSplitter"] ----
FMain.Form_Open.14: Directly read Layout numbers: 284 284
284
FMain.Form_Open.15: Direct Left part %age: 33.3333333333333
FMain.Form_Open.16: Direct Middle part %age: 33.3333333333333
FMain.Form_Open.17: Direct Right part %age: 33.3333333333333
FMain.Form_Open.21: ---- values AFTER the layout has been set (using
MainSplitter.Layout = iDirect ----
FMain.Form_Open.22: MainSplitter.Layout numbers: 2 2
2
FMain.Form_Open.23: MainSplitter.Layout Left part %age: 33.3333333333333
FMain.Form_Open.24: MainSplitter.Layout Middle part %age:
33.3333333333333
FMain.Form_Open.25: MainSplitter.Layout Right part %age:
33.3333333333333
# Here we just move the left part a little bit to the left
FMain.Form_Close.34:
FMain.Form_Close.35: Actual Layout numbers: 252 314 284
FMain.Form_Close.36: Left part %age: 29.6470588235294
FMain.Form_Close.37: Middle part %age: 36.9411764705882
FMain.Form_Close.38: Right part %age: 33.4117647058824
FMain.Form_Close.42: ---- values read back in from the config file AFTER
the Settings.Write ----
FMain.Form_Close.43: Saved Layout numbers: 252 314 284
FMain.Form_Close.44: Left part %age: 29.6470588235294
FMain.Form_Close.45: Middle part %age: 36.9411764705882
FMain.Form_Close.46: Right part %age: 33.4117647058824
Run 3 : Left part shrunk almost to the point where the horizontal scroll
appears
================================================================================
FMain.Form_Open.13: ---- values as read using
Settings["FMain/MainSplitter"] ----
FMain.Form_Open.14: Directly read Layout numbers: 252 314
284
FMain.Form_Open.15: Direct Left part %age: 29.6470588235294
FMain.Form_Open.16: Direct Middle part %age: 36.9411764705882
FMain.Form_Open.17: Direct Right part %age: 33.4117647058824
FMain.Form_Open.21: ---- values AFTER the layout has been set (using
MainSplitter.Layout = iDirect ----
FMain.Form_Open.22: MainSplitter.Layout numbers: 2 2
2
FMain.Form_Open.23: MainSplitter.Layout Left part %age: 33.3333333333333
FMain.Form_Open.24: MainSplitter.Layout Middle part %age:
33.3333333333333
FMain.Form_Open.25: MainSplitter.Layout Right part %age:
33.3333333333333
# Note: The layout is actually some approximation of the ratios as held
in the config file
# This I do not understand. I would expect [30,37,33] which = 100 but
instead I get [2,2,2]
# User shrinks the left part to just wider than the point at which the
horizontal scroll
# bar appears in the left hand treeview
FMain.Form_Close.34:
FMain.Form_Close.35: Actual Layout numbers: 71 494 286
FMain.Form_Close.36: Left part %age: 8.34312573443008
FMain.Form_Close.37: Middle part %age: 58.0493537015276
FMain.Form_Close.38: Right part %age: 33.6075205640423
FMain.Form_Close.42: ---- values read back in from the config file AFTER
the Settings.Write ----
FMain.Form_Close.43: Saved Layout numbers: 71 494 286
FMain.Form_Close.44: Left part %age: 8.34312573443008
FMain.Form_Close.45: Middle part %age: 58.0493537015276
FMain.Form_Close.46: Right part %age: 33.6075205640423
Run 4: Check we can still grab the resizer
==========================================
FMain.Form_Open.13: ---- values as read using
Settings["FMain/MainSplitter"] ----
FMain.Form_Open.14: Directly read Layout numbers: 71 494
286
FMain.Form_Open.15: Direct Left part %age: 8.34312573443008
FMain.Form_Open.16: Direct Middle part %age: 58.0493537015276
FMain.Form_Open.17: Direct Right part %age: 33.6075205640423
FMain.Form_Open.21: ---- values AFTER the layout has been set (using
MainSplitter.Layout = iDirect ----
FMain.Form_Open.22: MainSplitter.Layout numbers: 0 4
2
FMain.Form_Open.23: MainSplitter.Layout Left part %age: 0
FMain.Form_Open.24: MainSplitter.Layout Middle part %age:
66.6666666666667
FMain.Form_Open.25: MainSplitter.Layout Right part %age:
33.3333333333333
# No, the left part has dissappeared and even though the numbers read
back in out of the config file
# are "correct as saved", when the layout is set it is reclculated to a
different set of ratios.
# Again these ratios are approximations of the ratios specified in the
config file
# Also, having now read the DoLayout code of the _Split class, I see
that the control in the left hand
# part is now hidden.
# I would have expected, from the _Split.DoLayout code [8,58,34] but why
[0,4,2]
# re _Split.DoLayout(Value)
# @ ~line 177 iTotal=sum of all values passed to DoLayout i.e. 71+494
+286 = 851
# @ ~line 187 W (for the lh part) = Value[I] * WMax / iTotal i.e.
71*panelwidth/851 = 71*567/851 = 47
# ( and the other 2 parts will be 494*567/851=329 and 286*567/851=190,
so WTotal=47+329+190=566
What is going on here?
???
Bruce
-------------- next part --------------
A non-text attachment was scrubbed...
Name: splitterconfig-0.0.2.tar.gz
Type: application/x-compressed-tar
Size: 5482 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20130106/0a4d0fb7/attachment.bin>
More information about the User
mailing list