[gtkada] Images do not move with widget

Rick Duley rickduley at gmail.com
Sun Jul 12 12:32:58 CEST 2009


Thanks Dmitry.  I found that my application would have the arrow images in
the buttons _if_ I copied the image folder from the Keypad development
folder into the Application development folder.  That meant that the image
was not embedded in the button so back to the brewing board.

I now have  Key_Button defined as the private type:


47 *type* Gtk_Key_Button_Record *is
*48    *new* Gtk.Button.Gtk_Button_Record *with
*49       *record
*50          Label : Gtk.Label.Gtk_Label;
51          Image_Access : Gtk.Image.Gtk_Image;
52          Box : Gtk.Box.Gtk_HBox;
53          Row : Positive;
54          Column : Positive;
55       *end* *record*;

I have set the image in the record thus:

59    *-- Set Icon if Image /= null.*
60    *if* Image */=* *null* *then
*61       *-- Save the image as Gtk_Image_Record addressed by Image_Access.
*62       New_Key_Button.Image_Access *:=* *new* Gtk.Image.Gtk_Image_Record;
63       New_Key_Button.Image_Access.*all* *:=* Image.*all*;
64
65       *-- Put image in box.*
66       Gtk.Box.Pack_Start (In_Box *=>* New_Key_Button.Box,
67       Child *=>* New_Key_Button.Image_Access,
68       Expand *=>* TRUE,
69       Fill *=>* TRUE,
70       Padding *=>* 4);
71    *end* *if*; *-- Image /= null*

**

*87*    *-- Put the box in the button.
*88    Add (Container *=>* New_Key_Button,
89         Widget *=>* New_Key_Button.Box);



By my reckoning, line 62 allocates memory to Image_Access.  Line 63 copies
the data from the memory addressed by the parameter Image to the memory
addressed by Image_Access.  Therefore the button should always see the
image.  Not so! :(  I still have the same problem that the image does not
appear unless the development folder includes the image folder.

Still at square one.  Why does my image not travel with the button?  The
label allocated to the button in the same box travels okay.

-- 
Rick Duley
North Perth,
Western Australia
http://rickduley.webs.com
                                     .-_|\
                                    /     \
                              perth *_.-._/
                                         v
aussie : 0409 106 049
o'seas : +61 409 106 049
--------------------------------------------
"Wise men profit more from fools
     than fools from wise men;
for the wise shun the mistakes of fools
      but fools do not imitate
                the successes of the wise."
                   Marcus Cato (234-149 BC)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/gtkada/attachments/20090712/02d5d843/attachment.htm 


More information about the gtkada mailing list