From 983b6cf9804d0ab2fa187305eb0219a73c15b1dc Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 23 Sep 2008 23:15:25 +0000 Subject: [PATCH] 2008-09-23 16:19 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/hbwhat + /tests + /tests/whatdemo.prg A demo program, very basic, will be expanded in future, together with gtwvt. --- harbour/ChangeLog | 7 ++ harbour/contrib/hbwhat/tests/whatdemo.prg | 117 ++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 harbour/contrib/hbwhat/tests/whatdemo.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 02132c2e3c..3a1ce149d6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,13 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-09-23 16:19 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/hbwhat + + /tests + + /tests/whatdemo.prg + A demo program, very basic, will be expanded in future, together + with gtwvt. + 2008-09-24 00:44 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/hbgtcore.c * harbour/source/rtl/gtsys.c diff --git a/harbour/contrib/hbwhat/tests/whatdemo.prg b/harbour/contrib/hbwhat/tests/whatdemo.prg new file mode 100644 index 0000000000..bc844513c1 --- /dev/null +++ b/harbour/contrib/hbwhat/tests/whatdemo.prg @@ -0,0 +1,117 @@ +//----------------------------------------------------------------------// +// +// WhatDemo.prg +// +// Pritpal Bedi +// +//----------------------------------------------------------------------// + +#Include "inkey.ch" +#Include "winuser.ch" + +//----------------------------------------------------------------------// + +Function Main() + Local nKey + + SetColor( 'N/W' ) + CLS + + DispOutAt( Maxrow(),0, padc( 'F2 New Dialog ESC Exit', maxcol()+1 ), 'W+/R' ) + + do while .t. + nKey := inkey() + + if nKey == K_ESC + Exit + + elseif nKey == K_F2 + TestDyn( VWN_GetActiveWindow() ) + + endif + enddo + + Return( NIL ) + +//----------------------------------------------------------------------// + +Function HB_GtSys() + + REQUEST HB_GT_WVT_DEFAULT + + Return nil + +//----------------------------------------------------------------------// + +Function TestDyn( hWnd ) + Local aDlg + + aDlg := WHT_MakeDlgTemplate( "Sample Dynamic Dialog", ; + WS_CAPTION + 4 + WS_SYSMENU ; + + WS_GROUP + WS_TABSTOP + DS_SETFONT ; + + WS_THICKFRAME + WS_VISIBLE ; + + WS_POPUP, 24, 12, 180, 160 ) + + aDlg := WHT_AddDlgItem( aDlg, 101, 128 , ; //"BUTTON", ; + BS_AUTOCHECKBOX + WS_TABSTOP + WS_CHILD ; + + WS_VISIBLE, ; + 60, 90, 50, 12, ; + "&Check box" ) + + aDlg := WHT_AddDlgItem( aDlg, 1, "BUTTON", ; + BS_DEFPUSHBUTTON + WS_TABSTOP ; + + WS_CHILD + WS_VISIBLE, ; + 106, 112, 44, 14, ; + "Ok" ) + + aDlg := WHT_AddDlgItem( aDlg, 2, 128, ;//"BUTTON", ; + BS_PUSHBUTTON + WS_TABSTOP ; + + WS_CHILD + WS_VISIBLE, ; + 36, 112, 44, 14, ; + "&Cancel" ) + + #ifdef __MODELESS__ + WHT_CreateDialog( , aDlg, hWnd, { | h, m, w, l | MyDlgProc2( h, m, w, l ) } ) + #else + WHT_DialogBox( , aDlg, hWnd, { | h, m, w, l | MyDlgProc2( h, m, w, l ) } ) + #endif + + Return( NIL ) + +//----------------------------------------------------------------------// + +Function MyDlgProc2( hDlg, nMsg, nwParam, nlParam ) + + Do Case + Case nMsg == WM_INITDIALOG + VWN_ShowWindow( hDlg, SW_SHOW ) + Return( 1 ) + + Case nMsg == WM_SYSCOMMAND + If nwParam == SC_CLOSE + #ifdef __MODELESS__ + VWN_DestroyWindow( hDlg ) + #else + VWN_EndDialog( hDlg, IDOK ) + #endif + + Return( 1 ) + EndIf + + Case nMsg == WM_COMMAND + If nwParam == IDOK + #ifdef __MODELESS__ + VWN_DestroyWindow( hDlg ) + #else + VWN_EndDialog( hDlg, IDOK ) + #endif + + Return( 1 ) + EndIf + + EndCase + + Return( 0 ) + +//----------------------------------------------------------------------// +