Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi,
Just a couple of observations.

You have:
$canvas->set_center_scroll_region(FALSE);

In order to centralise the red bar, I find that I need to specify that as TRUE.

It seems to me that you haven't specified any size for the canvas, and that it would therefore be expected to be the default size of (100, 100).
You have specified a window size of (500, 500) and $window->get_size() does, indeed, return (500, 500).

You might also try the gtk-perl mailing list for some assistance, given that good help from this forum is a little slow in coming.

Update: On re-reading your post, I see that I haven't really told you much that you hadn't already worked out for yourself. Sorry 'bout that.
It does seem that the slight off-centredness that you see is because the red bar is specified to be between 20 and $width-40.
Change that to x2 => ($width - 20) and it should be centred. Alternatively, specify x1 => 40 and you'll also achieve centring (though the red bar will then be shorter by 20).

I don't know how to centre a non-default size canvas. I expected this to work:
$canvas->set_size(400, 100); $canvas->set_center_scroll_region(TRUE); $frame->add($canvas);

but the canvas size is still (100, 100).So I tried:
$canvas->set_center_scroll_region(TRUE); $canvas->set_size(400, 100); $frame->add($canvas);

and the canvas size is then the specified (400, 100) but "centred" for a canvas size of (100, 100) and therefore completely off centre.

Cheers,
Rob

In reply to Re: Can't position Gnome2::Canvas within Gtk2::Frame by syphilis
in thread Can't position Gnome2::Canvas within Gtk2::Frame by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-19 16:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found