Re: gtkmm-list Digest, Vol 195, Issue 6



Hi,
It sounds like you're confusing "there is no programmatic limit on the size of the scrollable area" with an infinitely scrollable area.  The easy solution is to simply make the window maybe 10x as big as you'll ever need, but even then somebody somewhere will find the limit sooner or later.  I'd suggest you might have more durability if you start with an arbitrary sized window, and then use a signal handler to increase it whenever the adjustment reaches one or other end of its range. 

ian

On Mon, Aug 24, 2020 at 12:00 AM <gtkmm-list-request gnome org> wrote:
Send gtkmm-list mailing list submissions to
        gtkmm-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.gnome.org/mailman/listinfo/gtkmm-list
or, via email, send a message with subject or body 'help' to
        gtkmm-list-request gnome org

You can reach the person managing the list at
        gtkmm-list-owner gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gtkmm-list digest..."


Today's Topics:

   1. Help on Gtk::Layout and Gtk::ScrolledWindow (josephenry)


----------------------------------------------------------------------

Message: 1
Date: Sat, 22 Aug 2020 13:53:03 +0000
From: josephenry <josephenry protonmail com>
To: "gtkmm-list gnome org" <gtkmm-list gnome org>
Subject: Help on Gtk::Layout and Gtk::ScrolledWindow
Message-ID:
        <O3vEg-e4OzbVREMkWCDqoALlVOtodRQ5qiUCFk5X8kSU1pURT86P8Uso-_s01KnEDo9xOidafeZBKG7Rb9WY2WZ65rueCZGRM5SyeYCqjww=@protonmail.com>

Content-Type: text/plain; charset="utf-8"

Hi,

I am learning Gtk+ with gtkmm and my goal is to create a node based interface for visual programming. I started a thread on the Gnome discourse : [https://discourse.gnome.org/t/project-guidance-node-based-ui/](https://discourse.gnome.org/t/project-guidance-node-based-ui/4019)

Basically what I want is to have my custom node widgets on a "canvas" so I can be able to move them by dragging them. If anyone knows Blender's node editor, it should also be possible to pan with middle mouse button and also zoom.

The Gtk::Layout component seems the right one when it comes to put nodes at specific location on the interface. I also want to draw a custom grid so this so the documentation seems adapted :

Infinite scrollable area containing child widgets and/or custom drawing.

Now the "infinite scrollable area" concept interest me because I want to be able to move on the node tree. The documentation says that I can just put the layout into a Gtk::ScrolledWindow and it supports scrolling natively.

I am struggling to understand how it works with the Gtk::Adjustments, do I need to create them when I instantiate a Gtk::ScrolledWindow? Or are they are controlled by the Gtk::Layout child?

This is a small example to make it work (compile it with g++ gtk_layout.cpp -o gtk_layout `pkg-config gtkmm-3.0 --cflags --libs`):

#include

<

gtkmm.h

>

int

main

(

int

argc

,

char

*

argv

[])

{

auto

app

=

Gtk

::

Application

::

create

(

argc

,

argv

,

"

org.gtkmm.example

"

)

;

Gtk

::

Window window

;

Gtk

::

ScrolledWindow scrolled_window

(

Gtk

::

Adjustment

::

create

(

0

,

0

,

5000

),

Gtk

::

Adjustment

::

create

(

0

,

0

,

5000

))

;

Gtk

::

Layout layout

;

Gtk

::

Button button

(

"

Hello World!

"

)

;

layout

.

put

(

button

,

100

,

100

)

;

scrolled_window

.

set_policy

(

Gtk

::

POLICY_ALWAYS

,

Gtk

::

POLICY_ALWAYS

)

;

scrolled_window

.

add

(

layout

)

;

window

.

add

(

scrolled_window

)

;

window

.

show_all

()

;

return

app

->

run

(

window

)

;

}

How can I get an infinite scrollable area?

Thanks in advance

Joseph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.gnome.org/archives/gtkmm-list/attachments/20200822/53f89101/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


------------------------------

End of gtkmm-list Digest, Vol 195, Issue 6
******************************************


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]