Re: How to use XControls?
- Posted by Patrick Barnes <mrtrick at gmail.com> Jan 27, 2005
- 487 views
I've been working on fixing Autosize to handle this properly... All you have to do is change 'findParentWindow' to 'findParent', and change the error check below it to check for '<= 0', and it should work. I made a quick demo for this, and encountered a problem for tab controls though...
without warning include win32Lib.ew include autosize.ew --(You have to make the changes to autosize described above) constant win = create( Window, "Demo 5 - Hierarchical Autosizing", 0, Default, Default, 0, 0, 0 ) setClientRect(win, 400,400) constant tab = create( TabControl, "", win, 10,10, 180,180, 0), tab1 = create( TabItem, "Tab 1", tab, 0,0,0,0,0), b1 = create( Button, "B", tab1, 8, 20, 24, 24, 0), b2 = create( Button, "B", tab1, 150, 150, 24, 24, 0) constant group = create( Group, "Group 1", win, 210, 210, 180, 180, 0), b3 = create( Button, "B", group, 8, 15, 24, 24, 0), b4 = create( Button, "B", group, 150, 150, 24, 24, 0) attach_control( tab, {TL, MM} ) attach_control( b1, TL ) attach_control( b2, BR ) attach_control( group, {MM, BR} ) attach_control( b3, TL ) attach_control( b4, BR ) WinMain( win,Normal )
The buttons in the group move correctly, but the buttons in the tab do not. The TabControl picks up the resize events, but it seems the TabItems do not. The parent of the button is the TabItem, not the TabControl. I could work around this by testing if the parent is a TabItem, and if so getting *its* parent, but it seems like a bit of a kludge. Any suggestions as to making it work for things in Tabs? (and, presumably, any Xcontrols that are like this) On Thu, 27 Jan 2005 18:56:47 +1100, Tony Steward <tony.steward at gmail.com> wrote: > Ok a short term solution is I have modified Autosize so I pass the > window id that the cotrol is on to Autosize manually. And it works > great, That is a general solution, I might make this an overloaded function... it's not quite as elegant as the way it's currently done, so I wouldn't make it the norm. Thanks for your suggestions... -- MrTrick