I am writing 2-3 Trees application in Lazarus for my school project.
Everything's done, now playing with GUI (I get the same number of points for good GUI as I do for a good etc. Insert function, which is weird but nvm).
When I have like 10+ nodes in the tree, my 300*200 image size just isn't large enough.
I would like to have an TImage component which would be like 300*200 on the TForm, but it would be like 10000 * 10000 really and you could scroll in it.
Is it even possible?
Thanks
EDIT TO MAKE THE QUESTION CLEARER
A 2-3 Tree is a data structure. When drawn on a paper to see how it works, it looks like this http://www.cosc.canterbury.ac.nz/research/RG/alg/tree23.gif
As a real noobie in lazarus/delphi (have to do it in lazarus) a use this code to draw it (even if I doubt u need it to answer my question):
procedure TStrom.Paint(Image: TImage);
var C: TCanvas;
procedure Paint1(V: TNode; Width, X, Y: integer); begin
if V.L <> nil then //left child begin C.MoveTo(X, Y); C.LineTo(X - Width div 3, Y + 50); Paint1(V.L, Width div 3, X - Width div 3, Y + 50); end; if V.S <> nil then //middle child begin C.MoveTo(X, Y); C.LineTo(X + Width div 3, Y + 50); Paint1(V.S, Width div 3, X + Width div 3, Y + 50); end; if V.P <> nil then //right child begin C.MoveTo(X, Y); C.LineTo(X + Width div 3 + Width div 3, Y + 50); Paint1(V.P, Width div 3, X + Width div 3 + Sirka div 3, Y + 50); end; if V.isLeaf then begin C.Ellipse(X - 15, Y - 15, X + 15, Y + 15); C.TextOut(X - 3, Y - 8, IntToStr(V.Info1)); end else begin C.Rectangle(X - 15, Y - 15, X + 15, Y + 15); C.TextOut(X - 7, Y - 8, IntToStr(V.Info1)); C.Rectangle(X + 15, Y - 15, X + 50, Y + 15); if V.Info2 <> 0 then C.TextOut(X + 27, Y - 8, IntToStr(V.Info2)); end;
The draw function works well, but some (most) of the nodes at the height of 3+ are drawn on other nodes, so it looks bad. The node is sitting on another node and is not 20 pixels next to it.
I thought I'd make the image where the tree is painted real big, but it would be in a small "panel". Like this: the TImage would really be 1000*1000, but in the form you could see only a little part of it. In this part there'd be horizontal and vertical scrollbars, so you could scroll through the image and see what's painted in the sections. (Like when you scroll through a web browser to see the bottom of the page :) )
We are not permitted to use any other code, just built in lazarus components. (nor are we permitted to create new components -> have no idea why)
While I'm still curious about how this could be done, it's no longer necessary for my application ( installed a second monitor to see if it'd help and it wouldn't, so I guess I'd dig through my paint method a bit :-) )