On Fri, 31 Oct 2008, Pritpal Bedi wrote:

Hi Pritpal,

> I am trying something lile:
> pGT1 := hb_gtCreate( 'WVG' )
> pGT  := hb_gtSelect( pGT1 )
> hb_gtInfo( HB_GTI_PRESPARAMS, { WS_EX_DLGMODALFRAME, NIL, 10, 10, 150, 100,
> pGT, .F. } )
> In hb_gt_wvt_Info()
>   case HB_GTI_PRESPARAMS:
>     PHB_ITEM pSome;
>     pSome = hb_arrayGetPtr( pInfo->pNewVal, HB_GTI_PP_PARENT );

Typo, you should use:
   pSome = hb_arrayGetIemPtr( pInfo->pNewVal, HB_GTI_PP_PARENT );

>     if( hb_itemType( pSome ) & HB_IT_POINTER )
>     {
>          pWVT->pPP->pParentGT = hb_gt_ItemBase( pSome );
>     }

Please remember that each time you call hb_gt_ItemBase() and it returns not
NULL pointer you should free it using hb_gt_BaseFree() to unlock GT for
other threads.
You can also keep GT item in your own item allocated by hb_gtNew().
It will protect releasing GT if in prg code pGT will be out of scope, f.e.
pParentGT can be PHB_ITEM and you can make:

   pWVT->pPP->pParentGT = hb_itemNew( hb_arrayGetIemPtr( pInfo->pNewVal,
                                                         HB_GTI_PP_PARENT ) );
and then when you want to access GT use:

   pGT = hb_gt_ItemBase( pWVT->pPP->pParentGT );
   if( pGT )
   {
      [...do sth with pGT...]
      hb_gt_BaseFree( pGT ); // unlock GT for other threads.
   }

> Then in 
> hb_gt_wvt_CreateWindow( pWVT )
>    PHB_GTWVT pWVTp = HB_GTWVT_GET( pWVT->pPP->pParentGT )
> I get nothing. Where I am wrong?

See above hb_arrayGetPtr() used instead of hb_arrayGetItemPtr().
Anyhow I suggest to change this code and keep pGT handler in PHB_ITEM
structure.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to