Files
harbour-core/harbour/tests/gtwin.prg
Przemyslaw Czerpak 1ad4e9c53a 2008-10-24 12:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rtl/gtxwc/gtxwc.c
    * added hack for problems with some XLIB versions in heavy stress
      MT tests

  * harbour/include/hbapigt.h
  * harbour/source/vm/thread.c
    * added parameter to hb_gtAlloc() C function

  * harbour/include/hbapigt.h
  * harbour/source/rtl/hbgtcore.c
    + added hb_gtCreate() and hb_gtSwap() C functions
    + added new .prg functions:
         HB_GTCREATE( <cGtName> ) -> <pGT>
         HB_GTSELECT( <pGT> ) -> <pPrevGT>
      Using this functions is possible to create many console window
      if GT supports such possibilities (f.e. GTXWC or GTWVT) even in
      single thread programs and switch between them.

  * harbour/source/rtl/box.c
    ! fixed one of recent DISPBOX() modifications - it should use:
      hb_gtBoxEx() instead of hb_gtDrawBox() to set cursor position.

  + harbour/tests/gtwin.prg
    + added demonstration/test code for using more then one console window
      also in single thread programs.
2008-10-24 10:00:30 +00:00

66 lines
1.4 KiB
Plaintext

/*
* $Id$
*/
/*
* Harbour Project source code:
* demonstration/test code for using more then one console window.
* It needs GT driver which supports such functionality, i.e.
* GTWVT in MS-Windows or GTXWC in XWindow.
*
* Copyright 2008 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* www - http://www.harbour-project.org
*
*/
#include "box.ch"
#ifdef __PLATFORM__WINDOWS
REQUEST HB_GT_WVT_DEFAULT
#define THREAD_GT "WVT"
#else
REQUEST HB_GT_STD_DEFAULT
#define THREAD_GT "XWC"
#endif
proc main()
local pGT, pGT1, pGT2
? "This is small test for using more then one console window."
? "It needs GT which supports such functionality i.e. GTWVT in"
? "MS-Windows or GTXWC in XWindow"
wait
? "Create two new GTs:"
pGT1 := hb_gtCreate( THREAD_GT )
? "1 =>", pGT1
pGT2 := hb_gtCreate( THREAD_GT )
? "2 =>", pGT1
pGT := hb_gtSelect( pGT1 )
SetColor( "W+/R" )
dispBox( 10, 10, 20, 50, B_DOUBLE + " " )
?? "This test is shown in 1-st GT window"
hb_gtSelect( pGT2 )
SetColor( "W+/B" )
dispBox( 15, 30, 20, 70, B_DOUBLE + " " )
?? "This test is shown in 2-nd GT window"
hb_gtSelect( pGT )
? "New console window should be visible now"
wait
? "Destroy 1-st window..."
pGT1 := NIL
?? "done"
wait
? "Destroy 2-nd window..."
pGT2 := NIL
?? "done"
wait "Press any key to exit"
return