Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 1999-04

How to cast the label of a GTKwidget

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt
to Cliff Baeseman: I have run into a very difficult problem and wonder if anyone else has run into this.…
Cliff Baeseman wrote 8 lines
Hi everyone, I have run into a very difficult problem and wonder if anyone else has run into this. using gtk I have created a button widget using gtk_button_new_with_label('my button'); Now lets say for instance I wish to change the caption on this button. If I where using c i could just cast the button as a gtk_label(button) since most of the objects including button decends from label and then use gtk_label_set() to change the text on the button.

This is erroneous: button does NOT descend from label. It HAS a label, as a child, as I remember from the gtk manual. So the typecast is invalid...

Michael.

Cliff Baeseman

Hi everyone,

I have run into a very difficult problem and wonder if anyone else has run into this.

using gtk I have created a button widget using gtk_button_new_with_label('my button');

Now lets say for instance I wish to change the caption on this button. If I where using c i could just cast the button as a gtk_label(button) since most of the objects including button decends from label and then use gtk_label_set() to change the text on the button.

I am using some casting in gtk now but this allways returns nil? gtk_label(button). The button does exist because I can see it on the window and check of the button assignment is showing ok.

I have also tried this with other decendant widgets. If the widget that I cast is in fac a label the cast will work and the label will be set.

How can I cast these widgets.

Cliff Baeseman

Show quoted text 5 lines
snapshots: reminder -latest win32 + ide updates now on tflily /snapshot NB these snapshots are daily where possible, see /snapshot/*.txt readme files for latest versions & status _______________________________________________ fpc-pascal maillist - http://vekoll.saturnus.vein.hu/mailman/listinfo/fpc-pascal