[lazarus] Label mystery solved probably...

Michael Van Canneyt Michael.VanCanneyt at wisa.be
Fri Apr 23 04:25:51 EDT 1999




On Fri, 23 Apr 1999, Cliff Baeseman wrote:

> Michael Van Canneyt wrote:
> 
> 
> I tried the code you sent and cannot get it to work I have tried every
> thing I could think of.
> 
> No matter what kind of widget i pass to gtk_label(pgtkwidget) I get a nill
> result.
> 
> I am at a loss over this one. I would really hate to blast a object and
> recreate it just to change the caption.

[CUT]

A had a look at this. You probably typed this from memory.
Of course it doesn't work. The parentheses are wrong, so I gave a wrong
translation !!

> > >
> > > gtk_label_set(GTK_LABEL(GTK_BIN(mywidget)) -> child),'new text')
only 3 '(' and 4 ')' !!

Probably, it must be
  gtk_label_set(GTK_LABEL(GTK_BIN(mywidget) -> child),'new text')

in that case, the translation is:

Var Gb,Child : PGtkWidget; // or whatever
    pc : pchar;

   gb:=gtk_bin(mywidget);
   child:=gtk_label(gb^.Child);
   gtk_label_set(child,'new text');

I'm not surprised you always got nil :)

This is, BTW, in perfect agreement with my other mail: GTKButton doesn't
descend from label, it HAS a label: The child !

So now it should work.

Michael.






More information about the Lazarus mailing list