Viewkit menuItem->baseWidget returns NULL

Viewkit menuItem->baseWidget returns NULL

Post by Doug Youn » Tue, 23 Jul 1996 04:00:00




> Hi,

> I have a severe problem with Viewkit 1.2:

> I want to add a callback to a menu item for the enter and leave notify events.
> For now I forget about the events, and just retrieve some value from the
> resource file. This routine looks like:
> The problem is that _fileNewSessionButton->baseWidget() always returns NULL.

> My first guess was that it had to do with the fact that Viewkit menues are
> not build until needed. I tried to use menu()->build(*this), but the
> only result was I had no menubar at all!

I'm not sure why baseWidget() is returning NULL. It should build the
menu and return the widget if necessary. But you can get what you want
by:

1) Calling VkMenu::useWorkProcs(FALSE); before you create your windows.
This disables the delayed build of menus, so the widget will exist right
away, possibly at the cost (small) of some startup time.

2) Update to 6.2. The latest viewkit already supports what I think you
are doing. (Showing help text as the user moves over widgets).

Incidently, I'd use arm and disarm callbacks to detect the user entering
and leaving an item rather than event handlers. That way, gadgets will
work fine.

Doug

 
 
 

Viewkit menuItem->baseWidget returns NULL

Post by Frans van Hoes » Tue, 23 Jul 1996 04:00:00


Hi,

I have a severe problem with Viewkit 1.2:

I want to add a callback to a menu item for the enter and leave notify events.
For now I forget about the events, and just retrieve some value from the
resource file. This routine looks like:

void OneLineHelpLabelClass::addWidget(Widget w) {
    const char *req = VkFormat("%s.helpText", XtName(w));
    XmString helpmsg = (XmString) VkGetResource(theApplication->baseWidget(),
            req, req, XmRXmString, "Sorry No Help");
    XtVaSetValues(_baseWidget, XmNlabelString, helpmsg , (XtPointer)NULL);

Quote:}

It looks up the name of the widget using XtName, and sets the helpstring
via XtVaSetValues so it shows at the bottom of my application. That works fine.

Now I call this routine with:
    _OneLineHelpLabelClass->addWidget(_seekButton);
    _OneLineHelpLabelClass->addWidget(_fileNewSessionButton->baseWidget());
_seekButton is declared as a Widget, and the first call works as expected.
_fileNewSessionButton is a VkMenuItem * and is created with:
    _fileNewSessionButton =  _filePane->addActionWidget("fileNewSessionButton",
            &VkwindowMainWindow::newSessionCallback, (XtPointer) this );
I changed addAction to addActionWidget to make sure it is a widget.

The problem is that _fileNewSessionButton->baseWidget() always returns NULL.

My first guess was that it had to do with the fact that Viewkit menues are
not build until needed. I tried to use menu()->build(*this), but the
only result was I had no menubar at all!

PLEASE, give me a hint of how to solve this.

(the above code is all called from the constructor of a VkwindowMainWindow,
which is a derived class of VkWindow)

- frans

  _______________________________________________________________

    "Hi, my name is Frans, I'm your crazy scientist for today."


                              http://rugmd4.chem.rug.nl/hoesel
  _______________________________________________________________

--

  _______________________________________________________________

    "Hi, my name is Frans, I'm your crazy scientist for today."


                              http://rugmd4.chem.rug.nl/hoesel
  _______________________________________________________________

 
 
 

1. dynamic casting <TJPEGImage*> returns NULL

Hi...,

Any ideas why the dynamic casting returns a NULL jpegimage pointer?

   TMDIChild *Child = dynamic_cast <TMDIChild *>  (ActiveMDIChild);
   TJPEGImage *jpegimage = dynamic_cast
<TJPEGImage*>(Child->Image->Picture->Graphic);

       if (jpegimage) {  // HERE I GOT A NULL jpegimage POINTER
          jpegimage->Assign(Child->Image->Picture->Graphic
          ...
       }

Thanks.

2. Smoothing the edges of images?

3. glxChooseVisual returns NULL

4. Jimmy Newtron and investment?

5. glGetString() always returns (null)

6. 3ds max. New features?

7. wglAllocateMemoryNV() returns NULL if priority=0.5

8. 3d rotation

9. glGetError returns GL_INVALID_OPERATION after wglMakeCurrent NULL

10. gl_vendor returns NULL instead of the vendor name

11. glGetString returns NULL

12. CreateEnhMetafile returns NULL

13. MAX export: (IPhyVertexExport *)GetVertexInterface(iVertex) ALWAYS returns NULL