Re: Creating widgets at runtime
- From: Bob Caryl <bob fis-cal com>
- To: Chris Vine <chris cvine freeserve co uk>
- Cc: gtkmm-list gnome org
- Subject: Re: Creating widgets at runtime
- Date: Wed, 13 Sep 2006 07:00:37 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I believe that andypaxo is referring to widgets created dynamically
during program execution in response to user input:
>>> I'm trying to add widgets to a program at runtime (as a simple example,
>>> adding buttons to an HBox in response to user input).
as opposed to widgets purposefully coded during program design and
created at program startup; hence, to andypaxo, the where of widget
memory allocation is not as important as to the how of dynamic creation.
Bob Caryl
Chris Vine wrote:
> On Saturday 09 September 2006 07:16, andypaxo wrote:
>> I have a little experience with gtkmm, but just trying something new at the
>> moment...
>>
>> I'm trying to add widgets to a program at runtime (as a simple example,
>> adding buttons to an HBox in response to user input). However I'm not
>> getting very far.
>>
>> Having tried several approaches and having scoured the internet and the
>> docs for some time, I am getting nowhere.
>>
>> WARNING: There's a high probability that I'm really over-complicating
>> things here
>> (You most likely don't want to read this bit!)
>> - My first thought was to simply declare a new button in a method and add
>> it to the HBox as you would with a member variable button, but nothing
>> appears
>> - My second thought was to create a std::vector containing
>> Glib::RefPtr<Gtk::Button> objects (in order to hold onto the button after
>> the method call had ended);
>> However, there seems to be no way to add the RefPtr object to an HBox
>> (and no way to add a plain button to a vector)
>>
>> So, if anyone knows a way to generate widgets at runtime, it would be great
>> to hear it,
>
> How is it possible to generate or construct a widget except at runtime? The
> idea of a compile-time widget is quite entertaining.
>
> Possibly by a runtime widget you meant a widget allocated on the heap rather
> then a local or static object. But as gtkmm is a wrapper for GTK+, and GTK+
> allocates all its objects on the heap, even a local or static gtkmm object
> has most of its memory on the heap.
>
> Chris
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
iD8DBQFFB/LkuCj6XIbb5UIRAhCeAJ9jzK9x2Xl0UMKc9Baqif15JxbQiACgmuDZ
TIzRMPXBBe+3xwtaxh4ht8s=
=5qU3
-----END PGP SIGNATURE-----
begin:vcard
fn:Robert Caryl
n:Caryl;Robert
org:Fiscal Systems, Inc.
adr:;;102 Commerce Circle;Madison;AL;35758;USA
email;internet:bob fis-cal com
title:Senior Software Design Engineer
tel;work:356-772-8920 X108
x-mozilla-html:TRUE
url:http://www.fis-cal.com
version:2.1
end:vcard
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]