For information: I use Ada as programming language, The Windowing software is Gtk and GtkAda.
I have a drawing on a drawing area that sometimes not fits witkin my window, not even if I use full screen. Therefore I need to have a scrolled area. I use the enclosed code to get such a window but the scrollbars always cannot move so a part of my drawing cannot been seen. What must I add to my program, and what must I do when in a running program the range for the scrollbars must be altered?
Gtk_New (MainWindow.Scrolledwindow);
Set_Policy (MainWindow.Scrolledwindow, Policy_Always, Policy_Always);
Set_Shadow_Type (MainWindow.Scrolledwindow, Shadow_None);
Set_Placement (MainWindow.Scrolledwindow, Corner_Top_Left);
Gtk_New (MainWindow.View_Port);
Gtk_New (MainWindow.DrawingArea);
MainWindow.Scrolledwindow.Add(MainWindow.View_Port);
MainWindow.View_Port.Add(MainWindow.DrawingArea);
Pack_Start
(MainWindow.Main_Box1,
MainWindow.Scrolledwindow,
Expand => True,
Fill => True,
Padding => 0);
I think you can omit the view port widget and replace it with just a box. As @lb90, stated, you can set the size of the drawing area using
Set_Size_Request
. This seems to do the trick:main.adb
demo.ads
demo-main_window.ads
demo-main_window.adb