This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How connect between WidgetMessageSendPostOrder() and RectangularButtonMsgProc()

Hi everyone,

when i surf  the code of grlib, there is a place confuzed me.

in the grlib_demo project, 

in the function WidgetMessageSendPostOrder(),

//
// Send the message directly to the widget that has captured pointer
// messages.
//
ulRet = g_pPointerWidget->pfnMsgProc(g_pPointerWidget, ulMessage,
ulParam1, ulParam2);

this step would call the function RectangularButtonMsgProc() ,

but i wonder when the pointer g_pPointerWidget->pfnMsgProc had been initialized as RectangularButtonMsgProc().

It really amazed me.

the  RectangularButtonMsgProc() was only called by RectangularButtonInit(), I didn't see its caller in current project.

Some strange. It's obviously that  I miss something. Could somebody explain that ? Thanks a lot !

BR,

Key

  • Key,

    Please see grlib\pushbutton.c for the initialization of  the function pointer.

      //
        // Use the rectangular push button message handler to process messages to
        // this push button.
        //
        pWidget->sBase.pfnMsgProc = RectangularButtonMsgProc;

    Lali

  • Hi  Lali,

    Thank you  for helping me again !

    I had seen the function RectangularButtonInit() that registered  the callback function RectangularButtonMsgProc(),

    but in the project grlib_demo, didn't find where or when call the function RectangularButtonInit().

    Could you give a hint ?

    Such as CanvasInit(), CheckBoxInit(),ContainerInit() , the functions initialize graphics components, when the main program call them ? 

    It seemed concealed.

    BR,

    Key