2012-09-11 16:27 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/gtwvg/hbgtwvg.ch
    + Added: constants HB_GTE_CREATED and HB_GTE_CLOSED.

  * contrib/gtwvg/gtwvg.c
  * contrib/gtwvg/gtwvg.h
    + Implemented: two more events fired at PRG code, one when window 
       is created and another when window is closed. The events supply 
       a two element array: 1. Window Handle No 2. Thread Number.
       These events will greatly help develop a rewarding GUI applns.

  * contrib/gtwvg/parthdlr.prg
  * contrib/gtwvg/crt.prg
    + Added: slot :notifierBlock( ... ) SETGET which accepts a block 
       from the application code which pass on designated events back.
This commit is contained in:
Pritpal Bedi
2012-09-11 23:37:10 +00:00
parent 925c99dfed
commit d69236b958
6 changed files with 66 additions and 3 deletions

View File

@@ -16,6 +16,22 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-09-11 16:27 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/gtwvg/hbgtwvg.ch
+ Added: constants HB_GTE_CREATED and HB_GTE_CLOSED.
* contrib/gtwvg/gtwvg.c
* contrib/gtwvg/gtwvg.h
+ Implemented: two more events fired at PRG code, one when window
is created and another when window is closed. The events supply
a two element array: 1. Window Handle No 2. Thread Number.
These events will greatly help develop a rewarding GUI applns.
* contrib/gtwvg/parthdlr.prg
* contrib/gtwvg/crt.prg
+ Added: slot :notifierBlock( ... ) SETGET which accepts a block
from the application code which pass on designated events back.
2012-09-11 13:19 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/gtwvg/hbgtwvg.ch
! Fixed: wrong contant values for HB_GTS_SW_* constants.

View File

@@ -316,6 +316,9 @@ METHOD WvgCrt:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::pGT := hb_gtSelect()
ENDIF
HB_GtInfo( HB_GTI_NOTIFIERBLOCKGUI, {|nEvent, ...| ::notifier( nEvent, ... ) } )
HB_GtInfo( HB_GTI_NOTIFIERBLOCK , {|nEvent, ...| ::notifierBlock( nEvent, ... ) } )
IF ::lModal
::style := WS_POPUP + WS_CAPTION + WS_SYSMENU
IF ::resizable
@@ -347,7 +350,6 @@ METHOD WvgCrt:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
hb_gtInfo( HB_GTI_WINTITLE , ::title )
hb_gtInfo( HB_GTI_RESIZEMODE, iif( ::resizeMode == HB_GTI_RESIZEMODE_ROWS, HB_GTI_RESIZEMODE_ROWS, HB_GTI_RESIZEMODE_FONT ) )
IF ::lModal
hb_gtInfo( HB_GTI_DISABLE, ::pGTp )
ENDIF
@@ -357,7 +359,7 @@ METHOD WvgCrt:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::lHasInputFocus := .t.
ENDIF
HB_GtInfo( HB_GTI_NOTIFIERBLOCKGUI, {|nEvent, ...| ::notifier( nEvent, ... ) } )
// HB_GtInfo( HB_GTI_NOTIFIERBLOCKGUI, {|nEvent, ...| ::notifier( nEvent, ... ) } )
RETURN Self

View File

@@ -468,6 +468,8 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow )
pWVT->pNotifierGUI = NULL;
pWVT->threadNO = hb_threadNO();
return pWVT;
}
@@ -705,7 +707,7 @@ static HB_BOOL hb_gt_wvt_GetCharFromInputQueue( PHB_GTWVT pWVT, int * iKey )
static void hb_gt_wvt_TranslateKey( PHB_GTWVT pWVT, int key, int shiftkey, int altkey, int controlkey )
{
int nVirtKey;
nVirtKey = GetKeyState( VK_MENU );
if( nVirtKey & 0x8000 ) /* alt + key */
{
@@ -2814,6 +2816,15 @@ static void hb_gt_wvt_Exit( PHB_GT pGT )
HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvt_Exit(%p)", pGT));
pWVT = HB_GTWVT_GET( pGT );
if( pWVT && pWVT->hWnd )
{
PHB_ITEM pEvParams = hb_itemNew( NULL );
hb_arrayNew( pEvParams, 2 );
hb_arraySetNInt( pEvParams, 1, ( HB_MAXINT ) ( HB_PTRDIFF ) pWVT->hWnd );
hb_arraySetNI( pEvParams, 2, pWVT->threadNO );
hb_gt_wvt_FireEvent( pWVT, HB_GTE_CLOSED, pEvParams );
}
HB_GTSUPER_EXIT( pGT );
if( pWVT )
@@ -4196,7 +4207,17 @@ static void hb_gt_wvt_Refresh( PHB_GT pGT )
{
#if 1
if( !pWVT->hWnd && pWVT->fInit )
{
hb_gt_wvt_CreateConsoleWindow( pWVT );
if( pWVT->hWnd )
{
PHB_ITEM pEvParams = hb_itemNew( NULL );
hb_arrayNew( pEvParams, 2 );
hb_arraySetNInt( pEvParams, 1, ( HB_MAXINT ) ( HB_PTRDIFF ) pWVT->hWnd );
hb_arraySetNI( pEvParams, 2, pWVT->threadNO );
hb_gt_wvt_FireEvent( pWVT, HB_GTE_CREATED, pEvParams );
}
}
if( pWVT->hWnd )
{

View File

@@ -468,6 +468,8 @@ typedef struct
PHB_ITEM pNotifierGUI; /* Notifier to Wvg*Parts if embedded into a GT Window */
int threadNO; /* Will hold the current THREAD No */
} HB_GTWVT, * PHB_GTWVT;
/*----------------------------------------------------------------------*/

View File

@@ -76,6 +76,8 @@
#define HB_GTE_VSCROLL 16
#define HB_GTE_ANY 17
#define HB_GTE_KEYTOITEM 18
#define HB_GTE_CREATED 19
#define HB_GTE_CLOSED 20
#define HB_GTI_SETFONT 71
#define HB_GTI_PRESPARAMS 72

View File

@@ -105,6 +105,10 @@ CLASS WvgPartHandler
DATA oOwner
DATA nStatus INIT 0
/* Application Level Notifier */
DATA sb_notifier
METHOD notifierBlock( ... ) SETGET
ENDCLASS
/*----------------------------------------------------------------------*/
@@ -254,6 +258,22 @@ METHOD WvgPartHandler:setParent( oWvg )
RETURN oOldXbp
/*----------------------------------------------------------------------*/
METHOD WvgPartHandler:notifierBlock( ... )
LOCAL a_:= hb_AParams()
IF ! Empty( a_ ) .AND. HB_ISBLOCK( a_[ 1 ] )
::sb_notifier := a_[ 1 ]
ELSEIF ! Empty( a_ ) .AND. HB_ISBLOCK( ::sb_notifier ) .AND. HB_ISNUMERIC( a_[ 1 ] ) .AND. HB_ISARRAY( a_[ 2 ] )
Eval( ::sb_notifier, a_[ 1 ], a_[ 2 ], Self )
ENDIF
RETURN NIL
/*----------------------------------------------------------------------*/
/*
This will be called by the WvgCRT() console FOR various events TO be propogated TO child controls
*/