Resizing controls

I’m considering porting my app to Xojo:

  1. It would seem that Xojo is moving to a new framework. The new SQLiteDatabase framework seems to have fewer properties and methods. Is this how it will be for the desktop, too? I like that the existing framework has ErrorCode and ErrorMessage properties, for example. Will these go away in the long run?

  2. Resizing controls. The app’s window will need a couple of list boxes, an HTML Viewer, a toolbar, and a couple of text areas. I’d like these to fill the window area, but be resizable - have grab handles that allow the user to make (say) the HTML viewer bigger at the expense of (say) a list box. I’ve not come across anything yet that indicates this might be possible. Have I overlooked something?

I use Einhugur’s WindowSplitter, and I think there are a number of free splitters that don’t have the full features of Einhugurs offering.

This is possible, but it will require you to program the way the ListBox and the HTMLViewer interact.

Michele, I think a splitter is all he needs, no? ListBox on the left and the HTMLViewer on the right and splitter in the middle. The Einhugur Windowsplitter needs about 3 lines of code to handle resizing as he described.

It could if he uses only two controls. It becomes slightly more complex if he has more than an HTMLViewer and a ListBox.

@Tim Streater : It would greatly help if you could post a schematic of the window layout.

I’ve got one app with 5 controls horizontally laid out with 4 splitters in between. Each splitter controls the size of the controls one each side of it. Now if he wanted to proportionally resize the rest, he would just refigure the percentages and set the other 4 programmatically.

What he wants to obtain would be extremely simple with iOS or RubberViewsWE Auto Layout, where you set the distance at which a control can be to another, and can make its size relative as well.

In Desktop, that does not exist (yet). So having controls resize relative to each other requires coding that relationship. It is not extremely difficult, but it gets more complex as the number of controls grow. There another important question, he wants to have a handle on a control to resize it. And that requires yet another piece of code to make it work.

Hence my suggestion to have an idea of what he plans to do before actually posting any code.

This is what the app looks like at present:

http://www.iletter.org.uk

Sorry for the delay in replying - I was watching Dr Who on iPlayer.

Time well spent :wink:

OK. It still does not tell me what you want to do exactly, but here is a small project that demonstrates the basic principle.

relatives.xojo_binary_project

The HTMLViewer on the left can be resized by clicking and dragging the small rectangle at the bottom corner (the handle). As you resize the HTMLViewer, the Listbox on the right grows and shrinks accordingly.

The principle is that when the click occurs, the X and Y position within the rectangle are recorded in the Window properties Rx and Ry.

In HTMLViewer Open the property distance records the distance between the two controls. In ListBox Open ListBoxRight is set as well, to know where it stops on the right.

Everything happens in the Rectangle MouseDrag event. As the mouse is dragged, the program makes sure the position of the mouse remains constant relative to Rx and Ry by moving the rectangle accordingly. Then the right and bottom of the HTMLViewer are set relative to the rectangle, and finally, the left and width of the Listbox are set relative to the HTMLViewer right side.

As your program emulates the Eudora interface, maybe you want the same kind of thing vertically, but the principle remains.

Thanks for the link; I’d already found something called imSplitter in another thread, which seems fairly simple and may do what I want, if I can understand it. In my app at present I use JavaScript and some events to solve a similar problem of needing draggable separators to resize areas. It’ll be a case of getting to grips with various concepts that I’ve avoided so far. Figuring that out will stand me in good stead for the rest of the app anyway and may suggest different ways of doing things elsewhere in the app.

I know that email clients are somewhat old hat, but it’s fun anyway.