Author Topic: POINTERS  (Read 1029 times)

thrushitha

  • Full Member
  • ***
  • Posts: 26
POINTERS
« on: July 08, 2011, 03:05:56 am »
With respect to  below code, wat does *PGTR_DRAWFUNC SIGNIFY?

 typedef void (*PGTR_DRAWFUNC)(void *, EVENT);

typedef struct
   {
   GXT xb;              /* Touch area (key or menu inner area) upper left corner (absolute) */
   GYT yb;
   GXT xe;
   GYT ye;
   SGUCHAR flags;               
   SGUCHAR tickcnt;               
   SGINT state;                 
   GCOLOR color_close;           
   PGTR_DRAWFUNC draweventfunc; 
   GTE_DRAWDESC  drawdesc;
   } GTE, *PGTE;




AWAITING UR REPLY, THANX IN ADVANCE:-)

administrator

  • Administrator
  • Full Member
  • *****
  • Posts: 69
Re: POINTERS
« Reply #1 on: July 10, 2011, 07:33:48 am »
With respect to  below code, wat does *PGTR_DRAWFUNC SIGNIFY?

 typedef void (*PGTR_DRAWFUNC)(void *, EVENT);

typedef struct
   {
   GXT xb;              /* Touch area (key or menu inner area) upper left corner (absolute) */
   GYT yb;
   GXT xe;
   GYT ye;
   SGUCHAR flags;               
   SGUCHAR tickcnt;               
   SGINT state;                 
   GCOLOR color_close;           
   PGTR_DRAWFUNC draweventfunc; 
   GTE_DRAWDESC  drawdesc;
   } GTE, *PGTE;

AWAITING UR REPLY, THANX IN ADVANCE:-)

The struct GTE can accept a function pointer. In otherwords, it would be a call back function.

If you want to fill in the struct correctly, then first need to implement a function with the same signature like below:

void MyDrawingEvent(void *vp, EVENT event)
{
    // Here  is your drwaing event code.

}

void main()
{
    GTE gte;
    gte.draweventfunc = MyDrawingEvent;  // Note that MyDrawingEvent is function. Its pointer is address to gte.draweventfunc

}

Like us on http://facebook.softwareandfinance.com

thrushitha

  • Full Member
  • ***
  • Posts: 26
Re: POINTERS
« Reply #2 on: July 10, 2011, 09:43:08 pm »
thank u so much, I understood well now, :)

thrushitha

  • Full Member
  • ***
  • Posts: 26
Re: POINTERS
« Reply #3 on: July 10, 2011, 09:44:45 pm »
i understood. thanx again :)

 


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1