Files
harbour-core/harbour/examples/gtwvw/tests/cbtest1.prg
Viktor Szakats a5a304efc2 2009-12-22 03:47 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/gtwvt/gtwvt.c
    % Deleted unnecessary cast.

  * utils/hbmk2/hbmk2.pt_BR.po
    + Uploaded new version received from Vailton Renato. Thanks!

  * utils/hbmk2/hbmk2.hu_HU.po
    + Updated.
    + Added some new translations.

  * utils/hbmk2/hbmk2.prg
    * Minor formatting.
    ! Fixed typo in one of the displayed texts.

  + examples/gtwvw
  + examples/gtwvw/Makefile
  + examples/gtwvw/hbgtwvw.h
  + examples/gtwvw/hbole.h
  + examples/gtwvw/gtwvw.c
  + examples/gtwvw/wvwdraw.c
  + examples/gtwvw/wvwmenu.c
  + examples/gtwvw/wvwstbar.c
  + examples/gtwvw/wvwcheck.c
  + examples/gtwvw/wvwfuncs.c
  + examples/gtwvw/wvwpush.c
  + examples/gtwvw/wvwedit.c
  + examples/gtwvw/wvwtbar.c
  + examples/gtwvw/gtwvw.hbc
  + examples/gtwvw/gtwvw.hbp
  + examples/gtwvw/readme.txt
  + examples/gtwvw/tests
  + examples/gtwvw/tests/wvwtest9.rc
  + examples/gtwvw/tests/prog1.prg
  + examples/gtwvw/tests/prog2.prg
  + examples/gtwvw/tests/dia_excl.ico
  + examples/gtwvw/tests/drawimg.prg
  + examples/gtwvw/tests/vouch1.bmp
  + examples/gtwvw/tests/wvwmouse.prg
  + examples/gtwvw/tests/wvwtest9.hbp
  + examples/gtwvw/tests/hbmk.hbm
  + examples/gtwvw/tests/cbtest1.prg
  + examples/gtwvw/tests/def2.bmp
  + examples/gtwvw/tests/maincoor.prg
  + examples/gtwvw/tests/wvt2wvw.ch
  + examples/gtwvw/tests/cbtest6.prg
  + examples/gtwvw/tests/wvwtest9.prg
  + examples/gtwvw/tests/ebtest7.prg
  + examples/gtwvw/tests/vouch1.gif
  + examples/gtwvw/tests/maximize.prg
  + examples/gtwvw/tests/readme.txt
  + examples/gtwvw/tests/wvwtest9.xml
  + examples/gtwvw/tests/inpfocus.prg
  + examples/gtwvw/tests/prog0.prg
  + examples/gtwvw/docs
  + examples/gtwvw/docs/funclist.txt
  + examples/gtwvw/docs/gtwvw.txt
  + examples/gtwvw/docs/whatsnew.txt
    + Added rudimentary port of GTWVW to Harbour.
      (The source was current xhb CVS repository.)
      The port is very very (very) far from anything else
      than can be found in Harbour, this port involved making
      all the minimum required steps to build and link under
      Harbour, plus some extra cleanups.
    ! Lots of cleanups and fixes.
    + Added Harbour make files (both GNU make and hbmk2)
    + Cleaned tests to avoid multiple symbols and much simpler
      interdependencies.
    ! Removed extra test.dbf and what32 dependency.
    ; TOFIX: Due to public symbol collisions, this GTWVW it's
             probably not possible to use it with gtwin lib.
    ; NOTE: GTWVW is limited to non-UNICODE, non-C++, 32-bit
            Windows (no WinCE) builds, and for a clean compiler
            I had to suppress Harbour standard warning levels.
            Anyway, not basic tests program seems to work,
            although I didn't dig into them very deeply.
            We will see if this contrib turns out to be useful
            or not, and we can decide to drop it or maybe
            moving it to contrib once it has been brought up
            to Harbour standards. Although the code is huge,
            so don't expect to happen this very soon.
2009-12-22 02:50:24 +00:00

124 lines
3.1 KiB
Plaintext

/*
* $Id$
*/
/*
Copyright 2005 Budyanto Dj. <budyanto@centrin.net.id>
A simple example on how to make use of GTWVW's combobox.
This program requires GTWVW.LIB.
Compile: bldwvw cbtest1
*/
#include "inkey.ch"
#include "setcurs.ch"
static s_cQuestion := "Quick survey: What do you think about GTWVW?"
static s_cHint := "Hint: Please be positive..."
static s_aAnswers := {"1-GTWVW is a great library!",;
"2-GT who? I never heard about him",;
"3-Sorry, I don't like it"}
static s_cYourAnswer:="Your response is:"
static s_cThankYou := "Thanks for participating in our survey :-)"
#DEFINE _SECRET_KEY 101010
ANNOUNCE HB_NOSTARTUPWINDOW
proc main
local nMaxWidth, nCBid
local ch,ncursor
setcolor("N/W")
WVW_SetTitle(NIL,"Quick Survey")
WVW_NoClose(NIL)
WVW_SetAltF4Close(.f.)
WVW_SetLineSpacing(NIL,4)
//WVW_SetLSpaceColor(NIL,7)
WVW_cbSetFont(NIL, "Arial", 16)
WVW_pbSetFont(NIL, "Arial", 16)
nMaxWidth := 0
aeval(s_aAnswers, {|x| nMaxWIdth := max(nMaxWidth,len(x))})
setmode(11, nMaxWidth+1+10+2)
CLS
nCursor := setcursor(SC_NONE)
@ 1,1 say s_cQuestion
@ 2,1 say s_cHint
nCBid := wvw_cbCreate(NIL, 4, 1, nMaxWidth, s_aAnswers, ;
{|nWinNum,nId,nEvent,nIndex| ;
CBhandler(nWinNum,nId,nEvent,nIndex, nPBid)})
nPBid := wvw_pbCreate(NIL, 4,1+nMaxWidth+1, 4,1+nMaxWidth+1+10-1, "OK",NIL,;
{||__keyboard(_SECRET_KEY)},{0,0,+2,0})
wvw_cbSetFocus(NIL, nCBid)
wvw_ShowWindow()
nPos := 1
do while (ch:=inkey(0))<>_SECRET_KEY
do case
case ch==K_TAB .or. ch==K_ENTER
if nPos==2 .and. ch==K_ENTER .and. wvw_pbEnable(NIL, nPBid)
keyboard(_SECRET_KEY)
loop
else
nPos++
endif
case ch==K_SH_TAB
nPos--
endcase
if nPos>2
nPos := 1
elseif nPos<1
nPos:=2
endif
do case
case nPos==1
wvw_cbSetFocus(NIL, nCBid)
case nPos==2
wvw_pbSetFocus(NIL, nPBid)
wvw_pbSetStyle(NIL, nPBid, 1) //BS_DEFPUSHBUTTON
endcase
enddo
wvw_cbEnable(NIL, nCBid, .f.)
wvw_pbEnable(NIL, nPBid, .f.)
@ 6,1 say "Your response is:"
@ 7,1 say wvw_cbGetCurText(NIL, nCBid)
@ 9,1 say s_cThankYou
inkey(0)
setcursor(nCursor)
return //main
static function CBhandler(nWinNum,nId,nEvent,nIndex, nPBid)
do case
case nEvent==3 //CBN_SETFOCUS
* none
case nEvent==4 //CBN_KILLFOCUS
* none
if nIndex==0
wvw_pbEnable(nWinNum, nPBid, .t.)
else
wvw_pbEnable(nWinNum, nPBid, .f.)
endif
case nEvent==1 //CBN_SELCHANGE
if !wvw_cbIsDropped(nWinNum, nId)
* nIndex is 0-based
if nIndex==0
wvw_pbEnable(nWinNum, nPBid, .t.)
else
wvw_pbEnable(nWinNum, nPBid, .f.)
endif
wvw_cbSetFocus(nWinNum, nId)
endif
endcase
return NIL