[wxPython-users] (Yet another) sizer question
Frank Millman
frank at chagford.com
Tue Jun 6 06:16:47 PDT 2006
Peter Damoc wrote:
> On 6/6/06, Frank Millman <frank at chagford.com> wrote:
>> ...
>>I was hoping that, if I drag the left-hand border to the left, the left
pane
>>would get bigger, and the right pane would stay the same. In fact, it is
>>still the right pane that gets bigger, and the left pane stays the same.
>>
>>I think that this is how the native control works. For example, if I try
>>this with Windows Explorer, it behaves in the same way.
>>
>>Is it possible to achieve what I want? To do so, I would need to detect
that
>>the left-hand border was being dragged, and then calculate a new position
>>for the sash, but I have not seen an event that gives this information.
>>
>>The question is academic - I doubt if I would actually go to these lengths
-
>>but it would be interesting to know if it is possible.
>>
>>Any suggestions?
>>
>>Thanks
>>
>>Frank
>You can do anything you want! Impossible is nothing.
>Think about it like this... you can implement an algorithm that will
compute sizes for the panels and use the available
>API to create the visual representation that you need. All you have to do
is bind event handlers to the relevant events >(size changes in frame, move,
etc) and then track the values that you need like let's say size of the
frame plus position >of the frame using local variables. Monitoring changes
in both size and position you can take a decision on how to change >the
inner panels sizes and then use the SplitterWindow API to put the splitter
in its right position.
>
>Peter
Hi Peter
In principle I agree with you. However, I am still not sure how I would put
my particular idea into practice.
You can increase the width of a frame by dragging the left-hand border to
the left, or by dragging the right-hand border to the right. My idea is
that, if you drag a splitter window to the left, the left panel must grow
and the right panel must remain static, and vice versa.
I know that EVT_SIZE notifies you of a change in size, but it does not tell
you how the change occurred. Is there any way that you can distinguish
between the two scenarios? Thinking aloud, I guess you could store the
position of the frame, and compare it with the new position after resizing.
>From that you should be able to deduce what the user actually did.
Can you think of an easier way to achieve this?
Thanks
Frank
More information about the wxpython-users
mailing list