Balloons

Hi,
I am trying to overwrite the inflate ballon function of a PtText widget.
In the docs they say that you have to set the Pt_ARG_LABEL_BALLOON
resource. I tried to set this resource with a ppointer to my own inflate
routine. But nothing happens. Anybodys got an idea what I am doing wrong?
Regards,
Frank

Frank <nospam@please.com> wrote:

I am trying to overwrite the inflate ballon function of a PtText widget.
In the docs they say that you have to set the Pt_ARG_LABEL_BALLOON
resource. I tried to set this resource with a ppointer to my own inflate
routine. But nothing happens. Anybodys got an idea what I am doing wrong?

By “nothing happens”, do you mean the balloon keeps popping up the old
way, or does it stop popping up?

Wojtek Lerch wrote:

Frank <> nospam@please.com> > wrote:
I am trying to overwrite the inflate ballon function of a PtText widget.
In the docs they say that you have to set the Pt_ARG_LABEL_BALLOON
resource. I tried to set this resource with a ppointer to my own inflate
routine. But nothing happens. Anybodys got an idea what I am doing wrong?

By “nothing happens”, do you mean the balloon keeps popping up the old
way, or does it stop popping up?

The balloon still is popping up the old way and my function is not called!

Frank <nospam@please.com> wrote:

Wojtek Lerch wrote:
Frank <> nospam@please.com> > wrote:
I am trying to overwrite the inflate ballon function of a PtText widget.
In the docs they say that you have to set the Pt_ARG_LABEL_BALLOON
resource. I tried to set this resource with a ppointer to my own inflate
routine. But nothing happens. Anybodys got an idea what I am doing wrong?
By “nothing happens”, do you mean the balloon keeps popping up the old
way, or does it stop popping up?
The balloon still is popping up the old way and my function is not called!

The following program works for me. Can you try it on your system?

#include <stdio.h>
#include <Pt.h>

PtWidget_t *balfun(
PtWidget_t *window, PtWidget_t *widget,
int position, char *text, char *font,
PgColor_t fill_color, PgColor_t text_color
) {
puts( “Balloon called!” );
return PtInflateBalloon( window, widget, position, text, font, fill_color, text_color );
}


int main( void ) {
PtWidget_t *win;
static const PtArg_t args[] = {
Pt_ARG( Pt_ARG_LABEL_BALLOON, balfun, 0 ),
Pt_ARG( Pt_ARG_TEXT_STRING, “here”, 0 ),
Pt_ARG( Pt_ARG_LABEL_FLAGS, ~0u, Pt_SHOW_BALLOON ),
Pt_ARG( Pt_ARG_RESIZE_FLAGS, ~0u, Pt_RESIZE_X_AS_REQUIRED ),
};

PtInit(NULL);

win = PtCreateWidget( PtWindow, Pt_NO_PARENT, 0, 0 );
PtCreateWidget( PtText, win, sizeof(args)/sizeof(args[0]), args );

PtRealizeWidget( win );
PtMainLoop();

return 0;
}

Cheers Wojtek !
As I compared your code to mine I recognized that we did the same thing.
Did some stupid stuff before. My PtSetArg - function was just never
called…
Little embarrassing for me, but thanks for your help!!!
Frank