* GtkAda Scrollbars
@ 2019-12-24 7:36 L Dries
2019-12-25 16:49 ` Dmitry A. Kazakov
0 siblings, 1 reply; 4+ messages in thread
From: L Dries @ 2019-12-24 7:36 UTC (permalink / raw)
I am trying to create a program using a "drawingarea". In some cases the
drawing is to large for the window so I want to use scrollbars but I can
get these correct. If I use the policy "Always" the scrollbars cannot
move. I used scrolbars in a textview and that worked correctly. I think
that I have done something wrong. So below a part of the code I used.
Gtk_New (MainWindow.Scrolledwindow);
Set_Policy(MainWindow.Scrolledwindow,Policy_Automatic,Policy_Automatic);
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.DrawingArea);
Pack_Start
(MainWindow.Main_Box1,
MainWindow.Scrolledwindow,
Expand => True,
Fill => True,
Padding => 0);
--
L. Dries
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GtkAda Scrollbars
2019-12-24 7:36 GtkAda Scrollbars L Dries
@ 2019-12-25 16:49 ` Dmitry A. Kazakov
2019-12-30 10:09 ` L Dries
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry A. Kazakov @ 2019-12-25 16:49 UTC (permalink / raw)
On 2019-12-24 08:36, L Dries wrote:
> I am trying to create a program using a "drawingarea". In some cases the
> drawing is to large for the window so I want to use scrollbars but I can
> get these correct.
Gtk_Drawing_Area must process the event "draw" in order to redraw itself
according to the allocation area and the current cairo context. Moving
sliders of the scrolled window would ultimately send "draw" down to its
drawing area child.
For an example of using Gtk_Drawing_Area for drawing various shapes see
AICWL:
http://www.dmitry-kazakov.de/ada/aicwl.htm
The base type for all instruments is Gtk_Layered_Record derived from
Gtk_Drawing_Area_Record.
Merry Christmas!
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GtkAda Scrollbars
2019-12-25 16:49 ` Dmitry A. Kazakov
@ 2019-12-30 10:09 ` L Dries
2019-12-30 10:58 ` Dmitry A. Kazakov
0 siblings, 1 reply; 4+ messages in thread
From: L Dries @ 2019-12-30 10:09 UTC (permalink / raw)
To: Dmitry A. Kazakov
Op 25-12-2019 om 17:49 schreef Dmitry A. Kazakov:
> On 2019-12-24 08:36, L Dries wrote:
>
>> I am trying to create a program using a "drawingarea". In some cases
>> the drawing is to large for the window so I want to use scrollbars but
>> I can get these correct.
>
> Gtk_Drawing_Area must process the event "draw" in order to redraw itself
> according to the allocation area and the current cairo context. Moving
> sliders of the scrolled window would ultimately send "draw" down to its
> drawing area child.
>
> For an example of using Gtk_Drawing_Area for drawing various shapes see
> AICWL:
>
> http://www.dmitry-kazakov.de/ada/aicwl.htm
>
> The base type for all instruments is Gtk_Layered_Record derived from
> Gtk_Drawing_Area_Record.
>
> Merry Christmas!
>
I cannot find any reference in this answer to the problem I have because
for instance the scrollbars cannot move if even shown.
In the meantime I found on Internet references which suggest that the
drawing area is in principle not a scrollable item so it should be
inside a viewport. I have done so but my problem doesnot disappear. It
looks to me now that the viewport or the drawingarea must have a size
indication, so how to set initiate or even during runtime alter the size
so that I get a scrollable drawing
--
L. Dries
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GtkAda Scrollbars
2019-12-30 10:09 ` L Dries
@ 2019-12-30 10:58 ` Dmitry A. Kazakov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry A. Kazakov @ 2019-12-30 10:58 UTC (permalink / raw)
On 2019-12-30 11:09, L Dries wrote:
> Op 25-12-2019 om 17:49 schreef Dmitry A. Kazakov:
>> On 2019-12-24 08:36, L Dries wrote:
>>
>>> I am trying to create a program using a "drawingarea". In some cases
>>> the drawing is to large for the window so I want to use scrollbars
>>> but I can get these correct.
>>
>> Gtk_Drawing_Area must process the event "draw" in order to redraw
>> itself according to the allocation area and the current cairo context.
>> Moving sliders of the scrolled window would ultimately send "draw"
>> down to its drawing area child.
>>
>> For an example of using Gtk_Drawing_Area for drawing various shapes
>> see AICWL:
>>
>> http://www.dmitry-kazakov.de/ada/aicwl.htm
>>
>> The base type for all instruments is Gtk_Layered_Record derived from
>> Gtk_Drawing_Area_Record.
>>
>> Merry Christmas!
>>
> I cannot find any reference in this answer to the problem I have because
> for instance the scrollbars cannot move if even shown.
That is likely because it has the size less than the client area of the
scroll window. The parent widget queries its children for the desirable
size. See
Get_Request_Mode
Get_Preferred_Height
Get_Preferred_Height_For_Width
etc
You might wish to override them for your widget derived from drawing
area because the default behavior is that the parent tells the child
what the size must be. There are variations from any size, minimal size
up to fixed size. Finally, at the end of the size negotiation process
you get the signal "size_allocate" which tells the widget about its
final size (until first resize). There you can allocate memory, prepare
other size-dependent stuff etc.
See the Height-for-width Geometry Management section in
https://developer.gnome.org/gtk3/stable/GtkWidget.htm
for detailed information how the widget size is maintained.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-12-30 10:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-24 7:36 GtkAda Scrollbars L Dries
2019-12-25 16:49 ` Dmitry A. Kazakov
2019-12-30 10:09 ` L Dries
2019-12-30 10:58 ` Dmitry A. Kazakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox