Am 09.01.2012 12:51, schrieb Benoît Minisini: > Le 09/01/2012 09:08, Rolf-Werner Eilert a écrit : >> Here I am definitely understanding something wrong. >> >> I need a graphical object that allows for drawing some sort of >> specialized table that can expand and collapse certain rows like a >> TreeView. So I decided to program that either based on HTML in a >> RichText thing or better everything by myself in a DrawingArea. The >> DrawingArea would have to expand according to the contents and be >> controlled by ScrollBars. Then I found there is a ScrollArea in Gambas3 >> which could do 90 % of the job by itself. >> >> This is my understanding: A ScrollArea should be a DrawingArea which is >> enlarged automagically as soon as you draw beyond its borders and will >> produce ScrollBars for the user to slide the area forth and back below >> the visible frame that confines it on screen. >> >> Do you agree? >> >> Ok, I have a small ScrollArea, say 100 x 100 px. >> >> In Form_Open, I set its Contents to 2500 x 2500 px as from the >> documentation I understand it won't do that by itself (why not?). >> >> It shows two ScrollBars. >> >> I draw a line from 1,1 to 500,500. >> >> When I move the ScrollBars, nothing happens, i. e. the image shows the >> beginning of the line and stands still. This happens in qt (KDE4) as >> well as GTK (LXDE). >> >> The ScrollArea is not cached. I guess if I really have to move it by >> code, I will produce a whole lot of unnecessary Draw events. >> >> But just in case, how would their position be calculated? I would have >> to read the ScrollBar values, but their output is not documented - is it >> percent? Or relative to anything? >> >> (I cannot give you code snippets as this happened on my laptop this >> weekend, and I don't have G3 here in my office yet.) >> >> Really looking forward to your comments! >> >> Rolf >> > > Because when you draw, you need to use the ScrollX and ScrollY to know > how much you must translate what you draw inside the Draw event handler. > > Nothing is physically moved, it is really "just" a DrawingArea with two > scrollbars entirely made in Gambas (the source code is in gb.form if you > are curious). > > Regards, >
Ok, I think I understand: With the help of ScrollX and ScrollY I have to decide at which coordinate within my large drawing I start to draw to 1,1 on the DrawingArea? Rolf ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user