2017-09-12 10:19 UTC Viktor Szakats (vszakats users.noreply.github.com)

* contrib/gtwvg/class.prg
  * contrib/gtwvg/menubar.prg
  * contrib/gtwvg/paint.prg
  * contrib/gtwvg/tests/_activex.prg
  * contrib/gtwvg/tests/_dyndlgs.prg
  * contrib/gtwvg/tests/_modal.prg
  * contrib/gtwvg/tests/_tbrowse.prg
  * contrib/gtwvg/tests/_utils.prg
  * contrib/gtwvg/tests/_wvtcls.prg
  * contrib/gtwvg/tests/_xbp.prg
  * contrib/gtwvg/tests/demowvg.prg
  * contrib/gtwvg/tests/demowvg1.prg
  * contrib/gtwvg/tests/demoxbp.prg
  * contrib/hbhttpd/core.prg
  * contrib/hbhttpd/tests/eshop.prg
  * contrib/hbhttpd/widgets.prg
  * contrib/hbtip/thtml.prg
  * src/debug/dbgtobj.prg
  * src/rdd/hbsix/sxini.prg
  * src/rtl/hbi18n2.prg
  * src/rtl/tbrowse.prg
  * utils/hbtest/rt_array.prg
    * sync with 3.4 fork (no change in functionality)
This commit is contained in:
Viktor Szakats
2017-09-12 10:19:32 +00:00
parent 25e0853a49
commit 15795f6330
23 changed files with 1013 additions and 976 deletions

View File

@@ -7,6 +7,31 @@
Entries may not always be in chronological/commit order. Entries may not always be in chronological/commit order.
See license at the end of file. */ See license at the end of file. */
2017-09-12 10:19 UTC Viktor Szakats (vszakats users.noreply.github.com)
* contrib/gtwvg/class.prg
* contrib/gtwvg/menubar.prg
* contrib/gtwvg/paint.prg
* contrib/gtwvg/tests/_activex.prg
* contrib/gtwvg/tests/_dyndlgs.prg
* contrib/gtwvg/tests/_modal.prg
* contrib/gtwvg/tests/_tbrowse.prg
* contrib/gtwvg/tests/_utils.prg
* contrib/gtwvg/tests/_wvtcls.prg
* contrib/gtwvg/tests/_xbp.prg
* contrib/gtwvg/tests/demowvg.prg
* contrib/gtwvg/tests/demowvg1.prg
* contrib/gtwvg/tests/demoxbp.prg
* contrib/hbhttpd/core.prg
* contrib/hbhttpd/tests/eshop.prg
* contrib/hbhttpd/widgets.prg
* contrib/hbtip/thtml.prg
* src/debug/dbgtobj.prg
* src/rdd/hbsix/sxini.prg
* src/rtl/hbi18n2.prg
* src/rtl/tbrowse.prg
* utils/hbtest/rt_array.prg
* sync with 3.4 fork (no change in functionality)
2017-09-11 20:36 UTC Viktor Szakats (vszakats users.noreply.github.com) 2017-09-11 20:36 UTC Viktor Szakats (vszakats users.noreply.github.com)
* contrib/hbwin/hbwin.hbp * contrib/hbwin/hbwin.hbp
* contrib/hbwin/wapi_winbase.c -> contrib/hbwin/wapi_winbase_1.c * contrib/hbwin/wapi_winbase.c -> contrib/hbwin/wapi_winbase_1.c

View File

@@ -222,13 +222,13 @@ METHOD WvtDialog:Create()
LOCAL aPalette, i, j LOCAL aPalette, i, j
::oldToolTipActive := wvt_SetToolTipActive( .T. ) ::oldToolTipActive := wvt_SetToolTipActive( .T. )
IF ::nTooltipWidth != nil IF ::nTooltipWidth != NIL
wvt_SetToolTipWidth( ::nTooltipWidth ) wvt_SetToolTipWidth( ::nTooltipWidth )
ENDIF ENDIF
IF ::nTooltipBkColor != nil IF ::nTooltipBkColor != NIL
wvt_SetToolTipBkColor( ::nTooltipBkColor ) wvt_SetToolTipBkColor( ::nTooltipBkColor )
ENDIF ENDIF
IF ::nTooltipTextColor != nil IF ::nTooltipTextColor != NIL
wvt_SetToolTipTextColor( ::nTooltipTextColor ) wvt_SetToolTipTextColor( ::nTooltipTextColor )
ENDIF ENDIF
@@ -268,7 +268,7 @@ METHOD WvtDialog:Create()
IF ! Empty( ::aObjects[ i ]:aPaint ) IF ! Empty( ::aObjects[ i ]:aPaint )
FOR j := 1 TO Len( ::aObjects[ i ]:aPaint ) FOR j := 1 TO Len( ::aObjects[ i ]:aPaint )
wvg_SetPaint( ::cPaintBlockID, ::nPaintID++, ; wvg_SetPaint( ::cPaintBlockID, ::nPaintID++, ;
::aObjects[ i ]:aPaint[ j, 1 ], ::aObjects[ i ]:aPaint[ j, 2 ] ) ::aObjects[ i ]:aPaint[ j ][ 1 ], ::aObjects[ i ]:aPaint[ j ][ 2 ] )
NEXT NEXT
ENDIF ENDIF
NEXT NEXT
@@ -531,7 +531,7 @@ METHOD WvtDialog:Inkey()
IF ::nCurObj > 0 IF ::nCurObj > 0
IF ! Empty( ::aDialogKeys ) IF ! Empty( ::aDialogKeys )
IF ( n := AScan( ::aDialogKeys, {| e_ | e_[ 1 ] == ::nKey } ) ) > 0 IF ( n := AScan( ::aDialogKeys, {| e_ | e_[ 1 ] == ::nKey } ) ) > 0
Eval( ::aDialogKeys[ n, 2 ], Self, ::oCurObj ) Eval( ::aDialogKeys[ n ][ 2 ], Self, ::oCurObj )
ENDIF ENDIF
ENDIF ENDIF
@@ -540,7 +540,7 @@ METHOD WvtDialog:Inkey()
IF ::lEventHandled IF ::lEventHandled
IF ::oCurObj:nChildren > 0 IF ::oCurObj:nChildren > 0
FOR i := 1 to ::oCurObj:nChildren FOR i := 1 to ::oCurObj:nChildren
IF AScan( ::oCurObj:aChildren[ i, OBJ_CHILD_EVENTS ], ::nKey ) > 0 IF AScan( ::oCurObj:aChildren[ i ][ OBJ_CHILD_EVENTS ], ::nKey ) > 0
::oCurObj:NotifyChild( i, ::nKey, ::oCurObj ) ::oCurObj:NotifyChild( i, ::nKey, ::oCurObj )
ENDIF ENDIF
NEXT NEXT
@@ -571,7 +571,7 @@ METHOD WvtDialog:MouseOver()
mCol >= o:nLeft .AND. mCol <= o:nRight } ) mCol >= o:nLeft .AND. mCol <= o:nRight } )
::nObjOver := nObj ::nObjOver := nObj
::oObjOver := iif( nObj > 0, ::aObjects[ nObj ], nil ) ::oObjOver := iif( nObj > 0, ::aObjects[ nObj ], NIL )
IF nObj > 0 IF nObj > 0
::aObjects[ nObj ]:nmRow := mRow ::aObjects[ nObj ]:nmRow := mRow
::aObjects[ nObj ]:nmCol := mCol ::aObjects[ nObj ]:nmCol := mCol
@@ -879,9 +879,9 @@ METHOD WvtObject:Destroy()
::hFont := NIL ::hFont := NIL
ENDIF ENDIF
IF ::hPopup != nil IF ::hPopup != NIL
wvt_DestroyMenu( ::hPopup ) wvt_DestroyMenu( ::hPopup )
::hPopup := nil ::hPopup := NIL
ENDIF ENDIF
RETURN NIL RETURN NIL
@@ -890,16 +890,16 @@ METHOD WvtObject:CreatePopup()
LOCAL i, nID LOCAL i, nID
IF ! Empty( ::aPopup ) .AND. ::hPopup == nil IF ! Empty( ::aPopup ) .AND. ::hPopup == NIL
::hPopup := wvt_CreatePopupMenu() ::hPopup := wvt_CreatePopupMenu()
FOR i := 1 TO Len( ::aPopup ) FOR i := 1 TO Len( ::aPopup )
ASize( ::aPopup[ i ], 3 ) ASize( ::aPopup[ i ], 3 )
nID := ::nPopupItemID++ nID := ::nPopupItemID++
::aPopup[ i, 3 ] := nID ::aPopup[ i ][ 3 ] := nID
wvt_AppendMenu( ::hPopup, MF_ENABLED + MF_STRING, nID, ::aPopup[ i, 1 ] ) wvt_AppendMenu( ::hPopup, MF_ENABLED + MF_STRING, nID, ::aPopup[ i ][ 1 ] )
NEXT NEXT
ENDIF ENDIF
@@ -909,7 +909,7 @@ METHOD WvtObject:ShowPopup()
LOCAL lRet := .F., nRet, n, aPos LOCAL lRet := .F., nRet, n, aPos
IF ::hPopup != nil IF ::hPopup != NIL
aPos := wvt_GetCursorPos() aPos := wvt_GetCursorPos()
nRet := wvt_TrackPopupMenu( ::hPopup, TPM_CENTERALIGN + TPM_RETURNCMD, ; nRet := wvt_TrackPopupMenu( ::hPopup, TPM_CENTERALIGN + TPM_RETURNCMD, ;
@@ -918,8 +918,8 @@ METHOD WvtObject:ShowPopup()
IF ( n := AScan( ::aPopup, {| e_ | e_[ 3 ] == nRet } ) ) > 0 IF ( n := AScan( ::aPopup, {| e_ | e_[ 3 ] == nRet } ) ) > 0
lRet := .T. lRet := .T.
IF HB_ISBLOCK( ::aPopup[ n, 2 ] ) IF HB_ISBLOCK( ::aPopup[ n ][ 2 ] )
Eval( ::aPopup[ n, 2 ] ) Eval( ::aPopup[ n ][ 2 ] )
ENDIF ENDIF
ENDIF ENDIF
ENDIF ENDIF
@@ -1090,23 +1090,23 @@ METHOD WvtBrowse:NotifyChild( nIndex, nKey, oCurObj )
LOCAL xData, i LOCAL xData, i
IF nIndex > 0 .AND. nIndex <= Len( ::aChildren ) IF nIndex > 0 .AND. nIndex <= Len( ::aChildren )
IF HB_ISBLOCK( ::aChildren[ nIndex, OBJ_CHILD_DATABLOCK ] ) IF HB_ISBLOCK( ::aChildren[ nIndex ][ OBJ_CHILD_DATABLOCK ] )
xData := Eval( ::aChildren[ nIndex, OBJ_CHILD_DATABLOCK ] ) xData := Eval( ::aChildren[ nIndex ][ OBJ_CHILD_DATABLOCK ] )
ENDIF ENDIF
Eval( ::aChildren[ nIndex, OBJ_CHILD_REFRESHBLOCK ], ; Eval( ::aChildren[ nIndex ][ OBJ_CHILD_REFRESHBLOCK ], ;
::aChildren[ nIndex, OBJ_CHILD_OBJ ], ; ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ], ;
::aChildren[ nIndex, OBJ_CHILD_OBJ ]:oParent:cPaintBlockID, ; ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ]:oParent:cPaintBlockID, ;
::aChildren[ nIndex, OBJ_CHILD_OBJ ]:oBrw, ; ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ]:oBrw, ;
nKey, ; nKey, ;
xData ) xData )
IF ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:nChildren > 0 IF ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ]:nChildren > 0
/* Pretend IF focus is current on this object */ /* Pretend IF focus is current on this object */
Eval( ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:bOnFocus, ::aChildren[ nIndex, OBJ_CHILD_OBJ ] ) Eval( ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ]:bOnFocus, ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ] )
FOR i := 1 to ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:nChildren FOR i := 1 to ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ]:nChildren
::aChildren[ nIndex, OBJ_CHILD_OBJ ]:NotifyChild( i, nKey, ::aChildren[ nIndex, OBJ_CHILD_OBJ ] ) ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ]:NotifyChild( i, nKey, ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ] )
NEXT NEXT
/* Restore previous environments */ /* Restore previous environments */
@@ -1149,7 +1149,7 @@ METHOD WvtBrowse:SetTooltip()
::RestSettings() ::RestSettings()
ENDIF ENDIF
IF cTip != nil IF cTip != NIL
::Tooltip := cTip ::Tooltip := cTip
ENDIF ENDIF
@@ -1271,7 +1271,7 @@ METHOD WvtStatusBar:SetPanels( aPanels )
AAdd( ::aPanels, oPanel ) AAdd( ::aPanels, oPanel )
IF aPanels != nil IF aPanels != NIL
FOR i := 1 TO Len( aPanels ) FOR i := 1 TO Len( aPanels )
IF ::oParent:MaxCol() > aPanels[ i ] IF ::oParent:MaxCol() > aPanels[ i ]
oPanel := WvtPanel():New( ::oParent, ++nID, ::nTop, aPanels[ i ] ) oPanel := WvtPanel():New( ::oParent, ++nID, ::nTop, aPanels[ i ] )
@@ -2002,11 +2002,11 @@ METHOD WvtGets:Create()
FOR i := 1 TO Len( ::aGetList ) FOR i := 1 TO Len( ::aGetList )
__defaultNIL( @::aGetList[ i, 7 ], "N/W*,N/W*,,,N/GR*" ) __defaultNIL( @::aGetList[ i ][ 7 ], "N/W*,N/W*,,,N/GR*" )
__defaultNIL( @::aGetList[ i, 5 ], {|| .T. } ) __defaultNIL( @::aGetList[ i ][ 5 ], {|| .T. } )
__defaultNIL( @::aGetList[ i, 6 ], {|| .T. } ) __defaultNIL( @::aGetList[ i ][ 6 ], {|| .T. } )
AAdd( ::GetList, Get():New( ::aGetList[ i, 1 ], ::aGetList[ i, 2 ], {| v | iif( PCount() == 0, ::aGetList[ i, 3 ], ::aGetList[ i, 3 ] := v ) }, "::aGetList[ i, 3 ]", ::aGetList[ i, 7 ] ) ) AAdd( ::GetList, Get():New( ::aGetList[ i ][ 1 ], ::aGetList[ i ][ 2 ], {| v | iif( PCount() == 0, ::aGetList[ i ][ 3 ], ::aGetList[ i ][ 3 ] := v ) }, "::aGetList[ i ][ 3 ]", ::aGetList[ i ][ 7 ] ) )
::GetList[ i ]:Display() ::GetList[ i ]:Display()
::PaintBlock( i ) ::PaintBlock( i )
@@ -2022,13 +2022,13 @@ METHOD WvtGets:PaintBlock( nIndex )
LOCAL nLen, bPaint LOCAL nLen, bPaint
nLen := Len( Transform( ::aGetList[ nIndex, 3 ], ::aGetList[ nIndex, 4 ] ) ) nLen := Len( Transform( ::aGetList[ nIndex ][ 3 ], ::aGetList[ nIndex ][ 4 ] ) )
bPaint := {|| wvt_DrawBoxGet( ::aGetList[ nIndex, 1 ], ::aGetList[ nIndex, 2 ], nLen ) } bPaint := {|| wvt_DrawBoxGet( ::aGetList[ nIndex ][ 1 ], ::aGetList[ nIndex ][ 2 ], nLen ) }
AAdd( ::aPaint, { bPaint, ; AAdd( ::aPaint, { bPaint, ;
{ WVT_BLOCK_GETS, ::aGetList[ nIndex, 1 ] - 1, ::aGetList[ nIndex, 2 ] - 1, ; { WVT_BLOCK_GETS, ::aGetList[ nIndex ][ 1 ] - 1, ::aGetList[ nIndex ][ 2 ] - 1, ;
::aGetList[ nIndex, 1 ] - 1, ::aGetList[ nIndex, 2 ] + nLen } } ) ::aGetList[ nIndex ][ 1 ] - 1, ::aGetList[ nIndex ][ 2 ] + nLen } } )
RETURN Self RETURN Self
@@ -3009,8 +3009,8 @@ METHOD wvtMenu:DelItem( nItemNum )
LOCAL lResult := .F. LOCAL lResult := .F.
IF nItemNum > 0 .AND. nItemNum <= ::NumItems() IF nItemNum > 0 .AND. nItemNum <= ::NumItems()
IF ::aItems[ nItemNum, WVT_MENU_TYPE ] == MF_POPUP IF ::aItems[ nItemNum ][ WVT_MENU_TYPE ] == MF_POPUP
::aItems[ nItemNum, WVT_MENU_MENUOBJ ]:Destroy() ::aItems[ nItemNum ][ WVT_MENU_MENUOBJ ]:Destroy()
ENDIF ENDIF
IF ( lResult := wvt_DeleteMenu( ::hMenu, nItemNum - 1, MF_BYPOSITION ) ) /* Remember ZERO base */ IF ( lResult := wvt_DeleteMenu( ::hMenu, nItemNum - 1, MF_BYPOSITION ) ) /* Remember ZERO base */
@@ -3064,9 +3064,9 @@ METHOD wvtMenu:FindMenuItemById( nId )
IF ! Empty( nId ) IF ! Empty( nId )
x := ::NumItems() x := ::NumItems()
DO WHILE x > 0 .AND. Empty( aResult ) DO WHILE x > 0 .AND. Empty( aResult )
IF ::aItems[ x, WVT_MENU_TYPE ] == MF_POPUP IF ::aItems[ x ][ WVT_MENU_TYPE ] == MF_POPUP
aResult := ::aItems[ x, WVT_MENU_MENUOBJ ]:FindMenuItemById( nId ) aResult := ::aItems[ x ][ WVT_MENU_MENUOBJ ]:FindMenuItemById( nId )
ELSEIF ::aItems[ x, WVT_MENU_IDENTIFIER ] == nId ELSEIF ::aItems[ x ][ WVT_MENU_IDENTIFIER ] == nId
aResult := ::aItems[ x ] aResult := ::aItems[ x ]
ENDIF ENDIF
x-- x--

View File

@@ -214,8 +214,8 @@ METHOD WvgMenuBar:delItem( nItemNum )
LOCAL lResult := .F. LOCAL lResult := .F.
IF nItemNum > 0 .AND. nItemNum <= ::numItems() IF nItemNum > 0 .AND. nItemNum <= ::numItems()
IF ::aMenuItems[ nItemNum, WVT_MENU_TYPE ] == MF_POPUP IF ::aMenuItems[ nItemNum ][ WVT_MENU_TYPE ] == MF_POPUP
::aMenuItems[ nItemNum, WVT_MENU_MENUOBJ ]:Destroy() ::aMenuItems[ nItemNum ][ WVT_MENU_MENUOBJ ]:Destroy()
ENDIF ENDIF
IF ( lResult := wvg_DeleteMenu( ::hMenu, nItemNum - 1, MF_BYPOSITION ) ) /* Remember ZERO base */ IF ( lResult := wvg_DeleteMenu( ::hMenu, nItemNum - 1, MF_BYPOSITION ) ) /* Remember ZERO base */
@@ -336,11 +336,11 @@ METHOD WvgMenuBar:findMenuItemById( nId )
x := ::numItems() x := ::numItems()
DO WHILE x > 0 .AND. Empty( aResult ) DO WHILE x > 0 .AND. Empty( aResult )
IF ::aMenuItems[ x, WVT_MENU_TYPE ] == MF_POPUP IF ::aMenuItems[ x ][ WVT_MENU_TYPE ] == MF_POPUP
aResult := ::aMenuItems[ x, WVT_MENU_MENUOBJ ]:findMenuItemById( nId ) aResult := ::aMenuItems[ x ][ WVT_MENU_MENUOBJ ]:findMenuItemById( nId )
ELSEIF ::aMenuItems[ x, WVT_MENU_IDENTIFIER ] == nId ELSEIF ::aMenuItems[ x ][ WVT_MENU_IDENTIFIER ] == nId
aResult := { x, ::aMenuItems[ x, WVT_MENU_ACTION ], ::sl_itemSelected, Self } aResult := { x, ::aMenuItems[ x ][ WVT_MENU_ACTION ], ::sl_itemSelected, Self }
ENDIF ENDIF
x-- x--
@@ -357,10 +357,10 @@ METHOD WvgMenuBar:findMenuPosById( nId )
x := ::numItems() x := ::numItems()
DO WHILE x > 0 .AND. Empty( nPos ) DO WHILE x > 0 .AND. Empty( nPos )
IF ::aMenuItems[ x, WVT_MENU_TYPE ] == MF_POPUP IF ::aMenuItems[ x ][ WVT_MENU_TYPE ] == MF_POPUP
nPos := ::aMenuItems[ x, WVT_MENU_MENUOBJ ]:findMenuPosById( nId ) nPos := ::aMenuItems[ x ][ WVT_MENU_MENUOBJ ]:findMenuPosById( nId )
ELSEIF ::aMenuItems[ x, WVT_MENU_IDENTIFIER ] == nId ELSEIF ::aMenuItems[ x ][ WVT_MENU_IDENTIFIER ] == nId
nPos := x nPos := x
ENDIF ENDIF
@@ -405,7 +405,11 @@ METHOD WvgMenuBar:disableItem( nItemNum )
METHOD WvgMenuBar:getItem( nItemNum ) METHOD WvgMenuBar:getItem( nItemNum )
IF HB_ISNUMERIC( nItemNum ) .AND. nItemNum > 0 .AND. nItemNum <= Len( ::aMenuItems ) IF HB_ISNUMERIC( nItemNum ) .AND. nItemNum > 0 .AND. nItemNum <= Len( ::aMenuItems )
RETURN { ::aMenuItems[ nItemNum, 3 ], ::aMenuItems[ nItemNum, 4 ], ::aMenuItems[ nItemNum, 5 ], ::aMenuItems[ nItemNum, 6 ] } RETURN { ;
::aMenuItems[ nItemNum ][ 3 ], ;
::aMenuItems[ nItemNum ][ 4 ], ;
::aMenuItems[ nItemNum ][ 5 ], ;
::aMenuItems[ nItemNum ][ 6 ] }
ENDIF ENDIF
RETURN NIL RETURN NIL

View File

@@ -73,48 +73,48 @@ FUNCTION WvtPaintObjects()
FOR i := 1 TO nBlocks FOR i := 1 TO nBlocks
lExe := .T. lExe := .T.
IF aBlocks[ i, 3 ] != NIL .AND. ! Empty( aBlocks[ i, 3 ] ) IF aBlocks[ i ][ 3 ] != NIL .AND. ! Empty( aBlocks[ i ][ 3 ] )
/* Check parameters against tlbr_ depending upon the /* Check parameters against tlbr_ depending upon the
type of object and attributes contained in aAttr */ type of object and attributes contained in aAttr */
DO CASE DO CASE
CASE aBlocks[ i, 3, 1 ] == WVT_BLOCK_GRID_V CASE aBlocks[ i ][ 3 ][ 1 ] == WVT_BLOCK_GRID_V
b := aBlocks[ i, 3, 6 ] b := aBlocks[ i ][ 3 ][ 6 ]
IF Len( b:aColumnsSep ) == 0 IF Len( b:aColumnsSep ) == 0
lExe := .F. lExe := .F.
ELSE ELSE
nLeft := b:aColumnsSep[ 1 ] nLeft := b:aColumnsSep[ 1 ]
nRight := b:aColumnsSep[ Len( b:aColumnsSep ) ] nRight := b:aColumnsSep[ Len( b:aColumnsSep ) ]
IF !( tlbr_[ 1 ] <= aBlocks[ i, 3, 4 ] .AND. ; /* top < bottom */ IF tlbr_[ 1 ] > aBlocks[ i ][ 3 ][ 4 ] .OR. ; /* top > bottom */
tlbr_[ 3 ] >= aBlocks[ i, 3, 2 ] .AND. ; /* bootm > top */ tlbr_[ 3 ] < aBlocks[ i ][ 3 ][ 2 ] .OR. ; /* bottom < top */
tlbr_[ 2 ] <= nRight + 1 .AND. ; /* left < right */ tlbr_[ 2 ] > nRight + 1 .OR. ; /* left > right */
tlbr_[ 4 ] >= nLeft - 2 ) /* right > left */ tlbr_[ 4 ] < nLeft - 2 /* right < left */
lExe := .F. lExe := .F.
ENDIF ENDIF
ENDIF ENDIF
CASE aBlocks[ i, 3, 1 ] == WVT_BLOCK_GETS CASE aBlocks[ i ][ 3 ][ 1 ] == WVT_BLOCK_GETS
IF !( tlbr_[ 1 ] <= aBlocks[ i, 3, 4 ] .AND. ; /* top < bott */ IF tlbr_[ 1 ] > aBlocks[ i ][ 3 ][ 4 ] .OR. ; /* top > bottom */
tlbr_[ 3 ] >= aBlocks[ i, 3, 2 ] .AND. ; /* bootm > top */ tlbr_[ 3 ] < aBlocks[ i ][ 3 ][ 2 ] .OR. ; /* bottom < top */
tlbr_[ 2 ] <= aBlocks[ i, 3, 5 ] .AND. ; /* left < righ */ tlbr_[ 2 ] > aBlocks[ i ][ 3 ][ 5 ] .OR. ; /* left > right */
tlbr_[ 4 ] >= aBlocks[ i, 3, 3 ] ) /* right > left */ tlbr_[ 4 ] < aBlocks[ i ][ 3 ][ 3 ] /* right < left */
lExe := .F. lExe := .F.
ENDIF ENDIF
OTHERWISE OTHERWISE
/* If refreshing rectangle's top is less than objects' bottom */ /* If refreshing rectangle's top is less than objects' bottom
/* and left is less than objects' right */ * and left is less than objects' right
/* */ */
IF !( tlbr_[ 1 ] <= aBlocks[ i, 3, 4 ] .AND. ; /* top <= bottom */ IF tlbr_[ 1 ] > aBlocks[ i ][ 3 ][ 4 ] .OR. ; /* top > bottom */
tlbr_[ 3 ] >= aBlocks[ i, 3, 2 ] .AND. ; /* bootm >= top */ tlbr_[ 3 ] < aBlocks[ i ][ 3 ][ 2 ] .OR. ; /* bottom < top */
tlbr_[ 2 ] <= aBlocks[ i, 3, 5 ] .AND. ; /* left < right */ tlbr_[ 2 ] > aBlocks[ i ][ 3 ][ 5 ] .OR. ; /* left > right */
tlbr_[ 4 ] >= aBlocks[ i, 3, 3 ] ) /* right > left */ tlbr_[ 4 ] < aBlocks[ i ][ 3 ][ 3 ] /* right < left */
lExe := .F. lExe := .F.
ENDIF ENDIF
ENDCASE ENDCASE
ENDIF ENDIF
IF lExe IF lExe
Eval( aBlocks[ i, 2 ] ) Eval( aBlocks[ i ][ 2 ] )
ENDIF ENDIF
NEXT NEXT
ENDIF ENDIF
@@ -145,17 +145,17 @@ FUNCTION wvg_SetPaint( cID, nAction, xData, aAttr )
IF xData != NIL IF xData != NIL
IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0
IF ( n1 := AScan( t_paint_[ n, 2 ], {| e_ | e_[ 1 ] == nAction } ) ) > 0 IF ( n1 := AScan( t_paint_[ n ][ 2 ], {| e_ | e_[ 1 ] == nAction } ) ) > 0
oldData := t_paint_[ n, 2, n1, 2 ] oldData := t_paint_[ n ][ 2 ][ n1 ][ 2 ]
t_paint_[ n, 2, n1, 2 ] := xData t_paint_[ n ][ 2 ][ n1 ][ 2 ] := xData
t_paint_[ n, 2, n1, 3 ] := aAttr t_paint_[ n ][ 2 ][ n1 ][ 3 ] := aAttr
ELSE ELSE
AAdd( t_paint_[ n, 2 ], { nAction, xData, aAttr } ) AAdd( t_paint_[ n ][ 2 ], { nAction, xData, aAttr } )
ENDIF ENDIF
ELSE ELSE
AAdd( t_paint_, { cID, {} } ) AAdd( t_paint_, { cID, {} } )
n := Len( t_paint_ ) n := Len( t_paint_ )
AAdd( t_paint_[ n, 2 ], { nAction, xData, aAttr } ) AAdd( t_paint_[ n ][ 2 ], { nAction, xData, aAttr } )
ENDIF ENDIF
ENDIF ENDIF
@@ -166,7 +166,7 @@ FUNCTION wvg_GetPaint( cID )
LOCAL n LOCAL n
IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0
RETURN t_paint_[ n, 2 ] RETURN t_paint_[ n ][ 2 ]
ENDIF ENDIF
RETURN {} RETURN {}
@@ -176,9 +176,9 @@ FUNCTION wvg_DelPaint( cID, nAction )
LOCAL xData, n1, n LOCAL xData, n1, n
IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0
IF ( n1 := AScan( t_paint_[ n, 2 ], {| e_ | e_[ 1 ] == nAction } ) ) > 0 IF ( n1 := AScan( t_paint_[ n ][ 2 ], {| e_ | e_[ 1 ] == nAction } ) ) > 0
xData := t_paint_[ n, 2, n1, 2 ] xData := t_paint_[ n ][ 2 ][ n1 ][ 2 ]
t_paint_[ n, 2, n1, 2 ] := {|| .T. } t_paint_[ n ][ 2 ][ n1 ][ 2 ] := {|| .T. }
ENDIF ENDIF
ENDIF ENDIF
@@ -362,7 +362,7 @@ FUNCTION wvt_AddDlgItem( aDlg, nTop, nLeft, nRows, nCols, aOffSet, ;
nH := nRows nH := nRows
ENDIF ENDIF
aDlg[ 1, 4 ]++ /* item count */ aDlg[ 1 ][ 4 ]++ /* item count */
AAdd( aDlg[ 2 ], iif( HB_ISNUMERIC( nHelpId ), nHelpId, 0 ) ) AAdd( aDlg[ 2 ], iif( HB_ISNUMERIC( nHelpId ), nHelpId, 0 ) )
AAdd( aDlg[ 3 ], iif( HB_ISNUMERIC( nExStyle ), nExStyle, 0 ) ) AAdd( aDlg[ 3 ], iif( HB_ISNUMERIC( nExStyle ), nExStyle, 0 ) )

View File

@@ -1,9 +1,9 @@
/* /* Pritpal Bedi <bedipritpal@hotmail.com> */
* Pritpal Bedi <bedipritpal@hotmail.com>
*/
#include "inkey.ch" #include "inkey.ch"
#include "setcurs.ch"
#include "hbgtinfo.ch" #include "hbgtinfo.ch"
#include "hbver.ch"
// The function has to be called via hb_threadStart( {|| ExecuteActiveX( nActiveX ) } ) // The function has to be called via hb_threadStart( {|| ExecuteActiveX( nActiveX ) } )
@@ -13,15 +13,17 @@ FUNCTION ExecuteActiveX( nActiveX, xParam )
LOCAL oListBox, oStatic2, oDA LOCAL oListBox, oStatic2, oDA
LOCAL oPanel, oPanel1, oPanel2 LOCAL oPanel, oPanel1, oPanel2
// LOCAL cVarA := "Test A", cVarB := "Test B" #if 0
// LOCAL aState := {"not selected", "selected", "undefined"} LOCAL oCheck, oRadio, oMLE, cText
LOCAL cVarA := "Test A", cVarB := "Test B"
LOCAL aState := { "not selected", "selected", "undefined" }
#endif
LOCAL aParts := {} LOCAL aParts := {}
// LOCAL oCheck, oRadio, oMLE, cText
HB_SYMBOL_UNUSED( xParam ) HB_SYMBOL_UNUSED( xParam )
HB_SYMBOL_UNUSED( oCom ) HB_SYMBOL_UNUSED( oCom )
// --------------------------- Dialog -------------------------------\\ // --- Dialog ---
#if 1 #if 1
oCrt := WvgDialog():new( , , { 30, 30 }, { 800, 600 }, , .T. ) oCrt := WvgDialog():new( , , { 30, 30 }, { 800, 600 }, , .T. )
oCrt:closable := .T. oCrt:closable := .T.
@@ -36,13 +38,13 @@ FUNCTION ExecuteActiveX( nActiveX, xParam )
oDA := oCrt:drawingArea oDA := oCrt:drawingArea
// --------------------------- Menu --------------------------------\\ // --- Menu ---
ActiveXBuildMenu( oCrt, @oStatic, @oStatic2 ) ActiveXBuildMenu( oCrt, @oStatic, @oStatic2 )
// --------------------------- ToolBar -----------------------------\\ // --- ToolBar ---
oTBar := BuildWvgToolBar( oDA, nActiveX ) oTBar := BuildWvgToolBar( oDA )
// --------------------------- StatusBar ---------------------------\\ // --- StatusBar ---
oSBar := WvgStatusBar():new( oDA ):create( , , , , , .T. ) oSBar := WvgStatusBar():new( oDA ):create( , , , , , .T. )
oSBar:panelClick := {| oPanel | Wvg_MessageBox( , oPanel:caption ) } oSBar:panelClick := {| oPanel | Wvg_MessageBox( , oPanel:caption ) }
oPanel := oSBar:getItem( 1 ) oPanel := oSBar:getItem( 1 )
@@ -52,17 +54,17 @@ FUNCTION ExecuteActiveX( nActiveX, xParam )
oPanel2 := oSBar:addItem() oPanel2 := oSBar:addItem()
oPanel2:caption := "Click on any part!" oPanel2:caption := "Click on any part!"
// --------------------------- Static ------------------------------\\ // --- Static ---
oStatic := WvgStatic():new( oDA ) oStatic := WvgStatic():new( oDA )
oStatic:type := WVGSTATIC_TYPE_TEXT oStatic:type := WVGSTATIC_TYPE_TEXT
oStatic:options := WVGSTATIC_TEXT_CENTER oStatic:options := WVGSTATIC_TEXT_CENTER
oStatic:caption := Chr( 13 ) + "Implemented Xbase++ Parts" oStatic:caption := Chr( 13 ) + "Implemented Xbase++ Parts"
oStatic:create( , , { 0, oTBar:currentSize()[ 2 ] + 3 }, { 120, oCrt:currentSize()[ 2 ] - ; oStatic:create( , , { 0, oTBar:currentSize()[ 2 ] + 3 }, { 120, oCrt:currentSize()[ 2 ] - ;
oTBar:currentSize()[ 2 ] - oSBar:currentSize()[ 2 ] - 4 }, , .T. ) oTBar:currentSize()[ 2 ] - oSBar:currentSize()[ 2 ] - 4 }, , .T. )
oStatic:setColorBG( RGB( 198, 198, 198 ) ) oStatic:setColorBG( RGB( 198, 198, 198 ) )
#if 0 // panel #if 0 // panel
// --------------------------- Static + Radio + Checkbox ----------\\ // --- Static + Radio + Checkbox ---
oStatic2 := WvgStatic():New( oCrt, , { 150, 150 }, { 500, 310 }, , .F. ) oStatic2 := WvgStatic():New( oCrt, , { 150, 150 }, { 500, 310 }, , .F. )
// oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME // oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME
oStatic2:exStyle += WS_EX_WINDOWEDGE oStatic2:exStyle += WS_EX_WINDOWEDGE
@@ -138,39 +140,39 @@ FUNCTION ExecuteActiveX( nActiveX, xParam )
oMLE:setData() oMLE:setData()
#endif #endif
// --------------------------- ListBox -----------------------------\\ // --- ListBox ---
oListBox := WvgListBox():new() oListBox := WvgListBox():new()
oListBox:create( oStatic, , { 5, 55 }, { 107, 380 } ) oListBox:create( oStatic, , { 5, 55 }, { 107, 380 } )
oListBox:setColorFG( RGB( 218, 61, 34 ) ) oListBox:setColorFG( RGB( 218, 61, 34 ) )
AAdd( aParts, "XbpDialog" ) AAdd( aParts, "XbpDialog" )
AAdd( aParts, "XbpMenuBar" ) AAdd( aParts, "XbpMenuBar" )
AAdd( aParts, "XbpToolBar" ) AAdd( aParts, "XbpToolBar" )
AAdd( aParts, "XbpStatusBar" ) AAdd( aParts, "XbpStatusBar" )
AAdd( aParts, "XbpStatic" ) AAdd( aParts, "XbpStatic" )
AAdd( aParts, "XbpTreeView" ) AAdd( aParts, "XbpTreeView" )
AAdd( aParts, "XbpActiveX" ) AAdd( aParts, "XbpActiveX" )
AAdd( aParts, "XbpListBox" ) AAdd( aParts, "XbpListBox" )
AAdd( aParts, "XbpPushButton" ) AAdd( aParts, "XbpPushButton" )
AAdd( aParts, "XbpCheckBox" ) AAdd( aParts, "XbpCheckBox" )
AAdd( aParts, "XbpRadioButton" ) AAdd( aParts, "XbpRadioButton" )
AAdd( aParts, "Xbp3State" ) AAdd( aParts, "Xbp3State" )
AAdd( aParts, "XbpSLE" ) AAdd( aParts, "XbpSLE" )
AAdd( aParts, "XbpMLE" ) AAdd( aParts, "XbpMLE" )
AAdd( aParts, "DataRef" ) AAdd( aParts, "DataRef" )
AEval( aParts, {| e | oListBox:addItem( e ) } ) AEval( aParts, {| e | oListBox:addItem( e ) } )
oListBox:itemSelected := {|| Wvg_MessageBox( , oListBox:getCurItem() ) } oListBox:itemSelected := {|| Wvg_MessageBox( , oListBox:getCurItem() ) }
oListBox:setData( 3 ) oListBox:setData( 3 )
// --------------------------- PushButton --------------------------\\ // --- PushButton ---
oXbp := WvgPushButton():new( oStatic ) oXbp := WvgPushButton():new( oStatic )
oXbp:caption := "Hide" oXbp:caption := "Hide"
oXbp:create( , , { 20, 440 }, { 80, 30 } ) oXbp:create( , , { 20, 440 }, { 80, 30 } )
oXbp:activate := {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } oXbp:activate := {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) }
// --------------------------- TreeView ---------------------------\\ // --- TreeView ---
oTree := WvgTreeView():new( oDA, , { oCrt:currentSize()[ 1 ] - 160, oTBar:currentSize()[ 2 ] + 3 }, ; oTree := WvgTreeView():new( oDA, , { oCrt:currentSize()[ 1 ] - 160, oTBar:currentSize()[ 2 ] + 3 }, ;
{ 160, oCrt:currentSize()[ 2 ] - ; { 160, oCrt:currentSize()[ 2 ] - ;
oTBar:currentSize()[ 2 ] - oSBar:currentSize()[ 2 ] - 4 }, , .T. ) oTBar:currentSize()[ 2 ] - oSBar:currentSize()[ 2 ] - 4 }, , .T. )
@@ -201,7 +203,7 @@ FUNCTION ExecuteActiveX( nActiveX, xParam )
oTree:setData( oItem2 ) oTree:setData( oItem2 )
// --------------------------- Misc Config ------------------------\\ // --- Misc Config ---
oTBar:buttonClick := {| oBtn | iif( oBtn:caption == "Hide", oStatic:hide(), NIL ), ; oTBar:buttonClick := {| oBtn | iif( oBtn:caption == "Hide", oStatic:hide(), NIL ), ;
iif( oBtn:caption == "Show", oStatic:show(), NIL ), ; iif( oBtn:caption == "Show", oStatic:show(), NIL ), ;
iif( oBtn:caption == "Tools", oStatic2:show():toFront(), NIL ), ; iif( oBtn:caption == "Tools", oStatic2:show():toFront(), NIL ), ;
@@ -210,7 +212,7 @@ FUNCTION ExecuteActiveX( nActiveX, xParam )
oDA:resize := {|| ResizeDialog( oCrt, oTBar, oSBar, oStatic, oCom, oTree ) } oDA:resize := {|| ResizeDialog( oCrt, oTBar, oSBar, oStatic, oCom, oTree ) }
#if 1 #if 1
// --------------------------- Active-X ---------------------------\\ // --- Active-X ---
oCom := BuildActiveXControl( nActiveX, oDA ) oCom := BuildActiveXControl( nActiveX, oDA )
IF HB_ISOBJECT( oCom ) IF HB_ISOBJECT( oCom )
oCrt:sendMessage( WM_SIZE, 0, 0 ) oCrt:sendMessage( WM_SIZE, 0, 0 )
@@ -340,7 +342,7 @@ STATIC FUNCTION BuildActiveXControl( nActiveX, oDA )
CASE nActiveX == 3 CASE nActiveX == 3
hb_gtInfo( HB_GTI_WINTITLE, "file://" + hb_DirBase() + "myharu.pdf" ) hb_gtInfo( HB_GTI_WINTITLE, "file://" + hb_DirBase() + "myharu.pdf" )
oCom:CLSID := "file://" + hb_DirBase() + "myharu.pdf" oCom:CLSID := "file://" + hb_DirBase() + "myharu.pdf"
oCom:mapEvent( 269, {|| QOut( " E X P L O R E R - 2 6 9" ) } ) oCom:mapEvent( 269, {|| QOut( "EXPLORER-269" ) } )
CASE nActiveX == 4 CASE nActiveX == 4
hb_gtInfo( HB_GTI_WINTITLE, "RM Chart [ <F12> Attributes <F11> Next Charts ]" ) hb_gtInfo( HB_GTI_WINTITLE, "RM Chart [ <F12> Attributes <F11> Next Charts ]" )
@@ -348,7 +350,7 @@ STATIC FUNCTION BuildActiveXControl( nActiveX, oDA )
// RMChart does not have event interface. // RMChart does not have event interface.
// Trying to set it generates GPF. // Trying to set it generates GPF.
// Please download RMChart.ocx from http://www.rmchart.com/ . It is free in everysense. // Please download RMChart.ocx from https://web.archive.org/web/20090205114428/rmchart.com/ . It is free in every sense.
CASE nActiveX == 5 CASE nActiveX == 5
hb_gtInfo( HB_GTI_WINTITLE, "Image Viewer" ) hb_gtInfo( HB_GTI_WINTITLE, "Image Viewer" )
@@ -368,9 +370,9 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam )
// After :CREATE() Messages // After :CREATE() Messages
IF nActiveX == 1 IF nActiveX == 1
hb_gtInfo( HB_GTI_WINTITLE, iif( Empty( xParam ), "http://hbide.vouch.info", xParam ) ) hb_gtInfo( HB_GTI_WINTITLE, iif( Empty( xParam ), hb_Version( HB_VERSION_URL_BASE ), xParam ) )
oCom:AddressBar := .T. oCom:AddressBar := .T.
oCom:Navigate( iif( Empty( xParam ), "http://hbide.vouch.info", xParam ) ) oCom:Navigate( iif( Empty( xParam ), hb_Version( HB_VERSION_URL_BASE ), xParam ) )
ELSEIF nActiveX == 4 ELSEIF nActiveX == 4
ConfigureRMChart( oCom ) ConfigureRMChart( oCom )
@@ -408,7 +410,7 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam )
oCom:RMCStyle := 2 oCom:RMCStyle := 2
oCom:RMCUserWatermark := "Vouch" oCom:RMCUserWatermark := "Vouch"
oCom:Region( 1 ):SetProperties( 5.0, 5.0, -5.0, -5.0 ) oCom:Region( 1 ):SetProperties( 5, 5, -5, -5 )
oCom:Draw( .T. ) oCom:Draw( .T. )
ENDIF ENDIF
@@ -427,137 +429,143 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam )
hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Stacked Bars" ) hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Stacked Bars" )
// SetMode( 30, 100 ) // SetMode( 30, 100 )
sData += "00003600|00004450|000051|000061|000073|00008-6972|00009412|00011Tahoma|100011|10" sData := ;
sData += "0035|1000410|10005-5|10006-5|1000911|100101|100111|100181|100200|1002150000|1002" "00003600|00004450|000051|000061|000073|00008-6972|00009412|00011Tahoma|100011|10" + ;
sData += "211|100238|100331|100341|100356|100378|100411|100468|100484|100494|10051-6972|10" "0035|1000410|10005-5|10006-5|1000911|100101|100111|100181|100200|1002150000|1002" + ;
sData += "052-16777216|10053-1828|100541|100558|10056-16777216|10057-16777216|10060-167772" "211|100238|100331|100341|100356|100378|100411|100468|100484|100494|10051-6972|10" + ;
sData += "16|10061-16777216|1006315|10064-32|100652|10066-16776961|10180this is the footer" "052-16777216|10053-1828|100541|100558|10056-16777216|10057-16777216|10060-167772" + ;
sData += "|10181Example of stacked bars|10182Apples*Pears*Cherries*Strawberries|10183 $|10" "16|10061-16777216|1006315|10064-32|100652|10066-16776961|10180this is the footer" + ;
sData += "184This is an optional axis text, sized 9 points and bold\9b|10187Label Nr. 1*La" "|10181Example of stacked bars|10182Apples*Pears*Cherries*Strawberries|10183 $|10" + ;
sData += "bel Nr. 2*Label Nr. 3*Label Nr. 4*Label Nr. 5*Label Nr. 6|10196This is an option" "184This is an optional axis text, sized 9 points and bold\9b|10187Label Nr. 1*La" + ;
sData += "al label axis text|110011|110023|110033|110045|110055|11006-1|1100923|110131|110" "bel Nr. 2*Label Nr. 3*Label Nr. 4*Label Nr. 5*Label Nr. 6|10196This is an option" + ;
sData += "14-1|110171|11019-16777077|1102111|110221|110236|1105310000*10000*16000*12000*20" "al label axis text|110011|110023|110033|110045|110055|11006-1|1100923|110131|110" + ;
sData += "000*10000|120011|120023|120033|120045|120055|12006-1|1200927|120131|12014-1|1201" "14-1|110171|11019-16777077|1102111|110221|110236|1105310000*10000*16000*12000*20" + ;
sData += "71|12019-16751616|1202111|120221|120236|120535000*7000*4000*15000*10000*10000|13" "000*10000|120011|120023|120033|120045|120055|12006-1|1200927|120131|12014-1|1201" + ;
sData += "0011|130023|130033|130045|130055|13006-1|1300982|130131|13014-1|130171|13019-838" "71|12019-16751616|1202111|120221|120236|120535000*7000*4000*15000*10000*10000|13" + ;
sData += "8608|1302111|130221|130236|1305310000*3000*12000*10000*5000*20000|140011|140023|" "0011|130023|130033|130045|130055|13006-1|1300982|130131|13014-1|130171|13019-838" + ;
sData += "140033|140045|140055|14006-1|1400925|140131|14014-1|140171|14019-4684277|1402111" "8608|1302111|130221|130236|1305310000*3000*12000*10000*5000*20000|140011|140023|" + ;
sData += "|140221|140236|140535000*9000*12000*6000*10000*5000" "140033|140045|140055|14006-1|1400925|140131|14014-1|140171|14019-4684277|1402111" + ;
"|140221|140236|140535000*9000*12000*6000*10000*5000"
CASE s_nTurn == 2 CASE s_nTurn == 2
hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Floating Bars" ) hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Floating Bars" )
// SetMode( 20, 90 ) // SetMode( 20, 90 )
sData += "00003550|00004300|000051|000073|00008-2894893|00009412|00011Tahoma|100011|100035" sData := ;
sData += "|100045|10005-5|10006-5|1000911|100101|100111|100131|100181|100201|1002113|10022" "00003550|00004300|000051|000073|00008-2894893|00009412|00011Tahoma|100011|100035" + ;
sData += "13|100238|100331|100341|100356|100378|100411|100468|100482|10052-16777216|10053-" "|100045|10005-5|10006-5|1000911|100101|100111|100131|100181|100201|1002113|10022" + ;
sData += "1120086|100544|100555|10056-16777216|10057-16777216|10060-16777216|10061-1677721" "13|100238|100331|100341|100356|100378|100411|100468|100482|10052-16777216|10053-" + ;
sData += "6|1006316|10064-5383962|100652|10066-16777011|10181Birth of a Killer App|10182Sc" "1120086|100544|100555|10056-16777216|10057-16777216|10060-16777216|10061-1677721" + ;
sData += "hedule*Reality|10187Design*Development*Testing*Bug Fixing*Documentation*Marketin" "6|1006316|10064-5383962|100652|10066-16777011|10181Birth of a Killer App|10182Sc" + ;
sData += "g|1020104/01*04/02*04/03*04/04*04/05*04/06*04/07*04/08*04/09*04/10*04/11*04/12*0" "hedule*Reality|10187Design*Development*Testing*Bug Fixing*Documentation*Marketin" + ;
sData += "5/01|110011|110026|110044|110101|110131|11019-6751336|1102111|110221|1102312|110" "g|1020104/01*04/02*04/03*04/04*04/05*04/06*04/07*04/08*04/09*04/10*04/11*04/12*0" + ;
sData += "531*3*4*6*6*4*7*4*9*3*10*3|120011|120026|120044|120101|120132|12019-47872|120211" "5/01|110011|110026|110044|110101|110131|11019-6751336|1102111|110221|1102312|110" + ;
sData += "1|120221|1202312|120531*.5*1.5*10.5*12*1*12*1*12.5*.5*2*11" "531*3*4*6*6*4*7*4*9*3*10*3|120011|120026|120044|120101|120132|12019-47872|120211" + ;
"1|120221|1202312|120531*.5*1.5*10.5*12*1*12*1*12.5*.5*2*11"
CASE s_nTurn == 3 CASE s_nTurn == 3
hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Four Regions" ) hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Four Regions" )
// SetMode( 40, 120 ) // SetMode( 40, 120 )
sData += "00003700|00004500|000054|000061|000071|00008-984833|00009412|00011Tahoma|100011|" sData := ;
sData += "100032|100042|10005348|10006248|1000910|100101|100111|100181|100200|10021100|100" "00003700|00004500|000054|000061|000071|00008-984833|00009412|00011Tahoma|100011|" + ;
sData += "2211|100238|100331|100341|100355|100378|100481|100491|10051-984833|10052-1677721" "100032|100042|10005348|10006248|1000910|100101|100111|100181|100200|10021100|100" + ;
sData += "6|10053-657956|100541|100558|10056-16777216|10057-16777216|10060-16777216|10061-" "2211|100238|100331|100341|100355|100378|100481|100491|10051-984833|10052-1677721" + ;
sData += "16777216|10187Label 1*Label 2*Label 3*Label 4*Label 5|110011|110021|110031|11004" "6|10053-657956|100541|100558|10056-16777216|10057-16777216|10060-16777216|10061-" + ;
sData += "6|110056|11006-1|110091|110131|11014-1|110171|1102111|110221|110235|1105330*40*7" "16777216|10187Label 1*Label 2*Label 3*Label 4*Label 5|110011|110021|110031|11004" + ;
sData += "0*60*20|200011|20003352|200042|20005-2|20006248|2000910|200101|200111|200181|200" "6|110056|11006-1|110091|110131|11014-1|110171|1102111|110221|110235|1105330*40*7" + ;
sData += "200|20021100|2002211|200238|200331|200341|200355|200378|200484|200491|20051-9848" "0*60*20|200011|20003352|200042|20005-2|20006248|2000910|200101|200111|200181|200" + ;
sData += "33|20052-16777216|20053-657956|200544|200555|20056-16777216|20057-16777216|20060" "200|20021100|2002211|200238|200331|200341|200355|200378|200484|200491|20051-9848" + ;
sData += "-16777216|20061-16777216|20187Label 1*Label 2*Label 3*Label 4*Label 5|210011|210" "33|20052-16777216|20053-657956|200544|200555|20056-16777216|20057-16777216|20060" + ;
sData += "023|210033|210045|210055|21006-1|210091|210101|210131|21014-1|210171|2102111|210" "-16777216|20061-16777216|20187Label 1*Label 2*Label 3*Label 4*Label 5|210011|210" + ;
sData += "221|210235|2105320*10*15*25*30|220011|220023|220033|220045|220055|22006-1|220091" "023|210033|210045|210055|21006-1|210091|210101|210131|21014-1|210171|2102111|210" + ;
sData += "|220101|220131|22014-1|220171|2202111|220221|220235|2205325*30*10*20*15|230011|2" "221|210235|2105320*10*15*25*30|220011|220023|220033|220045|220055|22006-1|220091" + ;
sData += "30023|230033|230045|230055|23006-1|230091|230101|230131|23014-1|230171|2302111|2" "|220101|220131|22014-1|220171|2202111|220221|220235|2205325*30*10*20*15|230011|2" + ;
sData += "30221|230235|2305310*20*40*20*30|240011|240023|240033|240045|240055|24006-1|2400" "30023|230033|230045|230055|23006-1|230091|230101|230131|23014-1|230171|2302111|2" + ;
sData += "91|240101|240131|24014-1|240171|2402111|240221|240235|2405340*30*20*30*20|300011" "30221|230235|2305310*20*40*20*30|240011|240023|240033|240045|240055|24006-1|2400" + ;
sData += "|300032|30004252|30005348|30006-2|3000910|300101|300181|300481|300491|30051-9848" "91|240101|240131|24014-1|240171|2402111|240221|240235|2405340*30*20*30*20|300011" + ;
sData += "33|30052-16777216|30053-657956|310011|3100251|310031|3100454|310054|310071|31009" "|300032|30004252|30005348|30006-2|3000910|300101|300181|300481|300491|30051-9848" + ;
sData += "1|310121|310151|310161|310171|310182|310211|310221|310235|3105330*50*20*40*60|40" "33|30052-16777216|30053-657956|310011|3100251|310031|3100454|310054|310071|31009" + ;
sData += "0011|40003352|40004252|40005-2|40006-2|4000910|400101|400111|400131|400181|40020" "1|310121|310151|310161|310171|310182|310211|310221|310235|3105330*50*20*40*60|40" + ;
sData += "100|40021250|4002211|400238|400281|400292|400300|400310|400322|400331|400341|400" "0011|40003352|40004252|40005-2|40006-2|4000910|400101|400111|400131|400181|40020" + ;
sData += "3510|400378|400482|400492|40051-984833|40052-16777216|40053-984833|400541|400558" "100|40021250|4002211|400238|400281|400292|400300|400310|400322|400331|400341|400" + ;
sData += "|40056-16776961|40057-16777216|400592|40060-16777216|40061-16777216|40183$ |4018" "3510|400378|400482|400492|40051-984833|40052-16777216|40053-984833|400541|400558" + ;
sData += "5 %|410011|410021|410031|410043|410053|41006-1|4100950|410131|41014-1|410171|410" "|40056-16776961|40057-16777216|400592|40060-16777216|40061-16777216|40183$ |4018" + ;
sData += "19-10496|4102111|410221|4102310|41053240*230*220*180*170*160*145*130*125*115|420" "5 %|410011|410021|410031|410043|410053|41006-1|4100950|410131|41014-1|410171|410" + ;
sData += "011|4200221|420035|4200422|420052|420061|420071|4200963|420111|420121|420131|420" "19-10496|4102111|410221|4102310|41053240*230*220*180*170*160*145*130*125*115|420" + ;
sData += "171|42019-16744448|4202115|420221|4202310|420261|420538.1*6.2*4.3*2.2*1.2*3.1*5." "011|4200221|420035|4200422|420052|420061|420071|4200963|420111|420121|420131|420" + ;
sData += "2*11.4*7.3*4.2" "171|42019-16744448|4202115|420221|4202310|420261|420538.1*6.2*4.3*2.2*1.2*3.1*5." + ;
"2*11.4*7.3*4.2"
CASE s_nTurn == 4 CASE s_nTurn == 4
hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "10 Biggest Companies" ) hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "10 Biggest Companies" )
// SetMode( 25, 90 ) // SetMode( 25, 90 )
sData += "00003670|00004450|000051|000061|000071|00008-10185235|00009412|00011Tahoma|10001" sData := ;
sData += "1|100035|1000410|10005-5|10006-5|1000912|100101|100111|100131|100181|10020100000" "00003670|00004450|000051|000061|000071|00008-10185235|00009412|00011Tahoma|10001" + ;
sData += "|10021250000|1002211|100239|100281|100292|100300|100310|100322|100331|100341|100" "1|100035|1000410|10005-5|10006-5|1000912|100101|100111|100131|100181|10020100000" + ;
sData += "3510|100378|100482|100492|10051-32944|10052-1296|10053-983041|100541|100558|1005" "|10021250000|1002211|100239|100281|100292|100300|100310|100322|100331|100341|100" + ;
sData += "6-1828|10057-16777216|100592|10060-1828|10061-16777216|10180data source: F.A.Z|1" "3510|100378|100482|100492|10051-32944|10052-1296|10053-983041|100541|100558|1005" + ;
sData += "0181The world's 10 biggest industrial companies 2003|10183$ |10184Total turnover" "6-1828|10057-16777216|100592|10060-1828|10061-16777216|10180data source: F.A.Z|1" + ;
sData += " in Mill. Dollar|10185 %|10186Net operating margin|10187Exxon Mobil*Royal Dutch " "0181The world's 10 biggest industrial companies 2003|10183$ |10184Total turnover" + ;
sData += "/ Shell*BP*General Motors*Daimler Chrysler*Ford Motor*Toyota Motor*General Elect" " in Mill. Dollar|10185 %|10186Net operating margin|10187Exxon Mobil*Royal Dutch " + ;
sData += "ric*TOTAL*Chevron Texaco|110011|110021|110031|110043|110053|11006-1|1100950|1101" "/ Shell*BP*General Motors*Daimler Chrysler*Ford Motor*Toyota Motor*General Elect" + ;
sData += "31|11014-1|110171|11019-10496|1102111|110221|1102310|11053242365*235598*232571*1" "ric*TOTAL*Chevron Texaco|110011|110021|110031|110043|110053|11006-1|1100950|1101" + ;
sData += "85524*170457*164196*149321*132797*130067*119703|120011|1200221|120035|1200422|12" "31|11014-1|110171|11019-10496|1102111|110221|1102310|11053242365*235598*232571*1" + ;
sData += "0052|120061|120071|1200970|120111|120121|120131|1201421|120171|12019-16744448|12" "85524*170457*164196*149321*132797*130067*119703|120011|1200221|120035|1200422|12" + ;
sData += "02115|120221|1202310|120261|120538.9*4.1*4.4*2.1*.3*.3*5.9*11.3*6.7*6" "0052|120061|120071|1200970|120111|120121|120131|1201421|120171|12019-16744448|12" + ;
"02115|120221|1202310|120261|120538.9*4.1*4.4*2.1*.3*.3*5.9*11.3*6.7*6"
CASE s_nTurn == 5 CASE s_nTurn == 5
hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Grouped Bars" ) hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Grouped Bars" )
// SetMode( 25, 80 ) // SetMode( 25, 80 )
sData += "00003600|00004450|000051|000061|000075|00008-2|00009412|00010paper.jpg|00011Taho" sData := ;
sData += "ma|100011|100035|100045|10005-5|10006-5|1000910|100101|100111|100181|100200|1002" "00003600|00004450|000051|000061|000075|00008-2|00009412|00010paper.jpg|00011Taho" + ;
sData += "1100|1002211|100238|100331|100341|100355|100378|100468|100484|10053-2|100541|100" "ma|100011|100035|100045|10005-5|10006-5|1000910|100101|100111|100181|100200|1002" + ;
sData += "558|100631|100651|10182First quarter*Second quarter*Third quarter*Fourth quarter" "1100|1002211|100238|100331|100341|100355|100378|100468|100484|10053-2|100541|100" + ;
sData += "|101872000*2001*2002*2003*2004|110011|110022|110044|110131|1102111|110221|110235" "558|100631|100651|10182First quarter*Second quarter*Third quarter*Fourth quarter" + ;
sData += "|1105330*20*40*60*10|120011|120022|120044|120131|1202111|120221|120235|1205330*2" "|101872000*2001*2002*2003*2004|110011|110022|110044|110131|1102111|110221|110235" + ;
sData += "0*50*70*60|130011|130022|130044|130131|1302111|130221|130235|1305340*10*30*20*80" "|1105330*20*40*60*10|120011|120022|120044|120131|1202111|120221|120235|1205330*2" + ;
sData += "|140011|140022|140044|140131|1402111|140221|140235|1405370*50*80*40*30" "0*50*70*60|130011|130022|130044|130131|1302111|130221|130235|1305340*10*30*20*80" + ;
"|140011|140022|140044|140131|1402111|140221|140235|1405370*50*80*40*30"
CASE s_nTurn == 6 CASE s_nTurn == 6
hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Flow Chart" ) hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Flow Chart" )
// SetMode( 30, 50 ) // SetMode( 30, 50 )
sData += "00003305|00004400|000051|00008-984833|00009412|00011Tahoma|100011|100035|100045|" sData := ;
sData += "10005-5|10006-5|10180\7C|010011|010051|010072|010081|0101050|0101125|01012100|01" "00003305|00004400|000051|00008-984833|00009412|00011Tahoma|100011|100035|100045|" + ;
sData += "01325|01014-5952982|01015-5952982|01016255|010191|0102010|01026Start|01030-256|0" "10005-5|10006-5|10180\7C|010011|010051|010072|010081|0101050|0101125|01012100|01" + ;
sData += "10012|010054|0100721|01014-16776961|010222|01024100*100|0102550*75|01026|010272|" "01325|01014-5952982|01015-5952982|01016255|010191|0102010|01026Start|01030-256|0" + ;
sData += "010293|010013|010051|010071|010081|0101050|0101175|01012100|0101325|01014-669788" "10012|010054|0100721|01014-16776961|010222|01024100*100|0102550*75|01026|010272|" + ;
sData += "2|01015-6697882|01016255|010191|0102010|01026i = 1|01030-16777216|010014|010054|" "010293|010013|010051|010071|010081|0101050|0101175|01012100|0101325|01014-669788" + ;
sData += "0100721|01014-16776961|010222|01024100*100|01025100*150|01026|010272|010293|0100" "2|01015-6697882|01016255|010191|0102010|01026i = 1|01030-16777216|010014|010054|" + ;
sData += "15|010051|010073|010081|0101050|01011150|01012100|0101350|01014-65536|01015-6553" "0100721|01014-16776961|010222|01024100*100|01025100*150|01026|010272|010293|0100" + ;
sData += "6|01016255|010191|0102010|01026i = 39?|01030-256|010016|010054|0100721|01014-167" "15|010051|010073|010081|0101050|01011150|01012100|0101350|01014-65536|01015-6553" + ;
sData += "76961|010222|01024100*100|01025200*225|01026|010272|010293|010017|010051|010071|" "6|01016255|010191|0102010|01026i = 39?|01030-256|010016|010054|0100721|01014-167" + ;
sData += "010081|0101050|01011225|01012100|0101325|01014-6697882|01015-6697882|01016255|01" "76961|010222|01024100*100|01025200*225|01026|010272|010293|010017|010051|010071|" + ;
sData += "0191|0102010|01026i = i + 1|01030-16777216|010018|010054|0100721|01014-16776961" "010081|0101050|01011225|01012100|0101325|01014-6697882|01015-6697882|01016255|01" + ;
sData += "|010222|01024100*100|01025250*275|01026|010272|010293|010019|010051|010073|01008" "0191|0102010|01026i = i + 1|01030-16777216|010018|010054|0100721|01014-16776961" + ;
sData += "1|0101050|01011275|01012100|0101350|01014-65536|01015-65536|01016255|010191|0102" "|010222|01024100*100|01025250*275|01026|010272|010293|010019|010051|010073|01008" + ;
sData += "010|01026i <= 100|01030-256|0100110|010054|0100721|01014-16776961|010222|0102410" "1|0101050|01011275|01012100|0101350|01014-65536|01015-65536|01016255|010191|0102" + ;
sData += "0*100|01025325*350|01026|010272|010293|0100111|010051|010072|010081|0101050|0101" "010|01026i <= 100|01030-256|0100110|010054|0100721|01014-16776961|010222|0102410" + ;
sData += "1350|01012100|0101325|01014-5952982|01015-5952982|01016255|010191|0102010|01026S" "0*100|01025325*350|01026|010272|010293|0100111|010051|010072|010081|0101050|0101" + ;
sData += "top|01030-256|0100113|010054|0100721|01014-16776961|010222|01024150*200|01025175" "1350|01012100|0101325|01014-5952982|01015-5952982|01016255|010191|0102010|01026S" + ;
sData += "*175|01026|010272|010293|0100114|010051|010081|01010145|01011157|0101250|01014-1" "top|01030-256|0100113|010054|0100721|01014-16776961|010222|01024150*200|01025175" + ;
sData += "6776961|01015-5383962|01016255|010191|0102010|01026yes|01030-16777216|0100115|01" "*175|01026|010272|010293|0100114|010051|010081|01010145|01011157|0101250|01014-1" + ;
sData += "0051|010071|010081|01010200|01011162|01012100|0101325|01014-6697882|01015-669788" "6776961|01015-5383962|01016255|010191|0102010|01026yes|01030-16777216|0100115|01" + ;
sData += "2|01016255|010191|0102010|01026i = 69|01030-16777216|0100116|010054|0100721|0101" "0051|010071|010081|01010200|01011162|01012100|0101325|01014-6697882|01015-669788" + ;
sData += "4-16776961|010224|0102450*10*10*100|01025300*300*125*125|01026|010272|010293|010" "2|01016255|010191|0102010|01026i = 69|01030-16777216|0100116|010054|0100721|0101" + ;
sData += "0117|010054|0100721|01014-16776961|010223|01024250*250*100|01025162*125*125|0102" "4-16776961|010224|0102450*10*10*100|01025300*300*125*125|01026|010272|010293|010" + ;
sData += "6|010272|010293|0100118|010051|010081|01010100|01011200|0101250|0101325|01014-16" "0117|010054|0100721|01014-16776961|010223|01024250*250*100|01025162*125*125|0102" + ;
sData += "776961|01016255|010191|0102010|01026no|01030-16777216|0100119|010051|010081|0101" "6|010272|010293|0100118|010051|010081|01010100|01011200|0101250|0101325|01014-16" + ;
sData += "010|01011280|0101240|01014-16776961|01016255|010191|0102010|01026yes|01030-16777" "776961|01016255|010191|0102010|01026no|01030-16777216|0100119|010051|010081|0101" + ;
sData += "216|0100120|010051|010081|01010100|01011322|0101250|01014-16776961|01016255|0101" "010|01011280|0101240|01014-16776961|01016255|010191|0102010|01026yes|01030-16777" + ;
sData += "91|0102010|01026no|01030-16777216|0100120|010051|010079|01010180|01011280|010121" "216|0100120|010051|010081|01010100|01011322|0101250|01014-16776961|01016255|0101" + ;
sData += "20|01013100|01015-39322|010191|010209|01026RMChart is not a flowchart tool. This" "91|0102010|01026no|01030-16777216|0100120|010051|010079|01010180|01011280|010121" + ;
sData += " is just an example for the use of CustomObjects!|01030-256" "20|01013100|01015-39322|010191|010209|01026RMChart is not a flowchart tool. This" + ;
" is just an example for the use of CustomObjects!|01030-256"
ENDCASE ENDCASE
@@ -575,7 +583,7 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam )
RETURN NIL RETURN NIL
STATIC FUNCTION ConfigureRMChart( RMChart ) STATIC PROCEDURE ConfigureRMChart( RMChart )
LOCAL oRegion LOCAL oRegion
LOCAL oCaption LOCAL oCaption
@@ -595,7 +603,7 @@ STATIC FUNCTION ConfigureRMChart( RMChart )
RMChart:AddRegion() RMChart:AddRegion()
oRegion := RMChart:Region( 1 ) oRegion := RMChart:Region( 1 )
oRegion:Footer := "http://vouch.info" oRegion:Footer := hb_Version( HB_VERSION_URL_BASE )
oRegion:AddCaption() oRegion:AddCaption()
@@ -616,9 +624,9 @@ STATIC FUNCTION ConfigureRMChart( RMChart )
oChart:StartAngle := 0 oChart:StartAngle := 0
oChart:DataString := "10*5*20*25" oChart:DataString := "10*5*20*25"
RETURN NIL RETURN
STATIC FUNCTION MyFunction( nMode ) STATIC PROCEDURE MyFunction( nMode )
#define MUSIC_WAITON { 800, 1600 } #define MUSIC_WAITON { 800, 1600 }
@@ -646,4 +654,4 @@ STATIC FUNCTION MyFunction( nMode )
ENDCASE ENDCASE
RETURN NIL RETURN

View File

@@ -1,6 +1,4 @@
/* /* Pritpal Bedi <bedipritpal@hotmail.com> */
* Pritpal Bedi <bedipritpal@hotmail.com>
*/
#include "inkey.ch" #include "inkey.ch"
#include "hbgtinfo.ch" #include "hbgtinfo.ch"
@@ -36,62 +34,62 @@ FUNCTION DynWinDialog( nInfo )
nStyle := DS_SETFONT + WS_VISIBLE + WS_POPUP + WS_CAPTION + WS_SYSMENU + WS_THICKFRAME + WS_MINIMIZEBOX nStyle := DS_SETFONT + WS_VISIBLE + WS_POPUP + WS_CAPTION + WS_SYSMENU + WS_THICKFRAME + WS_MINIMIZEBOX
aDlg := Wvt_MakeDlgTemplate( 1, 4, 21, 60, { 0, 0, 0, 0 }, ; aDlg := wvt_MakeDlgTemplate( 1, 4, 21, 60, { 0, 0, 0, 0 }, ;
"Dialog First [ " + hb_ntos( nInfo ) + " ] " + ; "Dialog First [ " + hb_ntos( nInfo ) + " ] " + ;
iif( nInfo % 2 == 0, "Modeless", "Modal" ), " Dialog !", nStyle ) iif( nInfo % 2 == 0, "Modeless", "Modal" ), " Dialog !", nStyle )
// Multi line edit control // Multi line edit control
nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_AUTOVSCROLL + ES_MULTILINE + ; nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_AUTOVSCROLL + ES_MULTILINE + ;
ES_WANTRETURN + WS_BORDER + WS_VSCROLL ES_WANTRETURN + WS_BORDER + WS_VSCROLL
aDlg := Wvt_AddDlgItem( aDlg, 1, 2, 15, 35, {}, ID_MLE , "EDIT" , nStyle, /* cText, nHelpId, nExStyle */ ) aDlg := wvt_AddDlgItem( aDlg, 1, 2, 15, 35, {}, ID_MLE , "EDIT" , nStyle, /* cText, nHelpId, nExStyle */ )
// Two Horz and Vert Lines // Two Horz and Vert Lines
nStyle := WS_CHILD + WS_VISIBLE + SS_ETCHEDVERT nStyle := WS_CHILD + WS_VISIBLE + SS_ETCHEDVERT
aDlg := Wvt_AddDlgItem( aDlg, 1, 39, 16, 1, {}, 111 , "STATIC" , nStyle ) aDlg := wvt_AddDlgItem( aDlg, 1, 39, 16, 1, {}, 111 , "STATIC" , nStyle )
nStyle := WS_CHILD + WS_VISIBLE + SS_ETCHEDHORZ nStyle := WS_CHILD + WS_VISIBLE + SS_ETCHEDHORZ
aDlg := Wvt_AddDlgItem( aDlg, 17, 2, 1, 56, {}, 112 , "STATIC" , nStyle ) aDlg := wvt_AddDlgItem( aDlg, 17, 2, 1, 56, {}, 112 , "STATIC" , nStyle )
// Icon // Icon
nStyle := WS_CHILD + WS_VISIBLE + SS_ICON //+ SS_CENTERIMAGE nStyle := WS_CHILD + WS_VISIBLE + SS_ICON //+ SS_CENTERIMAGE
aDlg := Wvt_AddDlgItem( aDlg, 18, 2, 2, 6, {}, ID_ICO_VOUCH , "STATIC" , nStyle, "" ) aDlg := wvt_AddDlgItem( aDlg, 18, 2, 2, 6, {}, ID_ICO_VOUCH , "STATIC" , nStyle, "" )
/* /*
// Bitmap // Bitmap
nStyle := WS_CHILD + WS_VISIBLE + SS_BITMAP + SS_REALSIZEIMAGE nStyle := WS_CHILD + WS_VISIBLE + SS_BITMAP + SS_REALSIZEIMAGE
aDlg := Wvt_AddDlgItem( aDlg, 18, 41, 2,8, { -3, 0, 3 }, ID_STA_IMAGE, "STATIC" , nStyle, "" ) aDlg := wvt_AddDlgItem( aDlg, 18, 41, 2,8, { -3, 0, 3 }, ID_STA_IMAGE, "STATIC" , nStyle, "" )
*/ */
nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + BS_AUTOCHECKBOX nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + BS_AUTOCHECKBOX
aDlg := Wvt_AddDlgItem( aDlg, 18, 15, 1, 10, {}, ID_CHK_SATIS , "BUTTON" , nStyle, "Satisfied?" ) aDlg := wvt_AddDlgItem( aDlg, 18, 15, 1, 10, {}, ID_CHK_SATIS , "BUTTON" , nStyle, "Satisfied?" )
nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_RIGHT + ES_READONLY nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_RIGHT + ES_READONLY
aDlg := Wvt_AddDlgItem( aDlg, 18, 30, 1, 7, { 3 }, ID_EDT_TIME , "EDIT" , nStyle, "" ) aDlg := wvt_AddDlgItem( aDlg, 18, 30, 1, 7, { 3 }, ID_EDT_TIME , "EDIT" , nStyle, "" )
nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + LBS_NOTIFY + WS_VSCROLL + WS_BORDER nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + LBS_NOTIFY + WS_VSCROLL + WS_BORDER
aDlg := Wvt_AddDlgItem( aDlg, 1, 41, 4, 17, {}, ID_LST_LIST , "LISTBOX", nStyle, "ListBox" ) aDlg := wvt_AddDlgItem( aDlg, 1, 41, 4, 17, {}, ID_LST_LIST , "LISTBOX", nStyle, "ListBox" )
nStyle := WS_CHILD + WS_VISIBLE + SS_LEFT nStyle := WS_CHILD + WS_VISIBLE + SS_LEFT
aDlg := Wvt_AddDlgItem( aDlg, 4, 41, 1, 17, { 3, 0, 0, 0 }, -1 , "STATIC" , nStyle, "Degree" ) aDlg := wvt_AddDlgItem( aDlg, 4, 41, 1, 17, { 3, 0, 0, 0 }, -1 , "STATIC" , nStyle, "Degree" )
nStyle := WS_VISIBLE + WS_TABSTOP + CBS_DROPDOWNLIST + WS_BORDER + WS_VSCROLL nStyle := WS_VISIBLE + WS_TABSTOP + CBS_DROPDOWNLIST + WS_BORDER + WS_VSCROLL
aDlg := Wvt_AddDlgItem( aDlg, 5, 41, 6, 17, {}, ID_CMB_COMBO , "COMBOBOX" , nStyle, "Combo" ) aDlg := wvt_AddDlgItem( aDlg, 5, 41, 6, 17, {}, ID_CMB_COMBO , "COMBOBOX" , nStyle, "Combo" )
nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + BS_GROUPBOX nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + BS_GROUPBOX
aDlg := Wvt_AddDlgItem( aDlg, 7, 41, 4, 17, { 0, 0, 4, 0 }, ID_GRP_COMP, "BUTTON" , nStyle, "Compiler" ) aDlg := wvt_AddDlgItem( aDlg, 7, 41, 4, 17, { 0, 0, 4, 0 }, ID_GRP_COMP, "BUTTON" , nStyle, "Compiler" )
nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + BS_AUTORADIOBUTTON nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + BS_AUTORADIOBUTTON
aDlg := Wvt_AddDlgItem( aDlg, 8, 43, 1, 14, {}, ID_RDO_XH , "BUTTON" , nStyle, "Harbour" ) aDlg := wvt_AddDlgItem( aDlg, 8, 43, 1, 14, {}, ID_RDO_XH , "BUTTON" , nStyle, "Harbour" )
aDlg := Wvt_AddDlgItem( aDlg, 9, 43, 1, 14, {}, ID_RDO_CLIP , "BUTTON" , nStyle, "Clipper" ) aDlg := wvt_AddDlgItem( aDlg, 9, 43, 1, 14, {}, ID_RDO_CLIP , "BUTTON" , nStyle, "Clipper" )
aDlg := Wvt_AddDlgItem( aDlg, 10, 43, 1, 14, {}, ID_RDO_XBASE , "BUTTON" , nStyle, "Xbase++" ) aDlg := wvt_AddDlgItem( aDlg, 10, 43, 1, 14, {}, ID_RDO_XBASE , "BUTTON" , nStyle, "Xbase++" )
nStyle := WS_CHILD + WS_VISIBLE + SS_LEFT nStyle := WS_CHILD + WS_VISIBLE + SS_LEFT
aDlg := Wvt_AddDlgItem( aDlg, 12, 41, 1, 17, { 3, 0, 0, 0 }, ID_STA_TEXT, "STATIC" , nStyle, "Scrollable Text" ) aDlg := wvt_AddDlgItem( aDlg, 12, 41, 1, 17, { 3, 0, 0, 0 }, ID_STA_TEXT, "STATIC" , nStyle, "Scrollable Text" )
nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_AUTOHSCROLL + WS_BORDER nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_AUTOHSCROLL + WS_BORDER
aDlg := Wvt_AddDlgItem( aDlg, 13, 41, 1, 17, {}, ID_EDT_TEXT , "EDIT" , nStyle, "This is Text Field" ) aDlg := wvt_AddDlgItem( aDlg, 13, 41, 1, 17, {}, ID_EDT_TEXT , "EDIT" , nStyle, "This is Text Field" )
nStyle := WS_CHILD + WS_VISIBLE + SS_LEFT nStyle := WS_CHILD + WS_VISIBLE + SS_LEFT
aDlg := Wvt_AddDlgItem( aDlg, 14, 41, 1, 17, { 3, 0, 0, 0 }, -1, "STATIC" , nStyle, "Right Justified Numerics" ) aDlg := wvt_AddDlgItem( aDlg, 14, 41, 1, 17, { 3, 0, 0, 0 }, -1, "STATIC" , nStyle, "Right Justified Numerics" )
nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_AUTOHSCROLL + ES_NUMBER + ES_RIGHT + WS_BORDER nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_AUTOHSCROLL + ES_NUMBER + ES_RIGHT + WS_BORDER
aDlg := Wvt_AddDlgItem( aDlg, 15, 41, 1, 17, {}, ID_EDT_NUMB , "EDIT" , nStyle, "1234567" ) aDlg := wvt_AddDlgItem( aDlg, 15, 41, 1, 17, {}, ID_EDT_NUMB , "EDIT" , nStyle, "1234567" )
nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + BS_PUSHBUTTON nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + BS_PUSHBUTTON
aDlg := Wvt_AddDlgItem( aDlg, 18, 50, 1, 8, { -3, 0, 3, 0 }, ID_BTN_OK, "BUTTON" , nStyle, "OK" ) aDlg := wvt_AddDlgItem( aDlg, 18, 50, 1, 8, { -3, 0, 3, 0 }, ID_BTN_OK, "BUTTON" , nStyle, "OK" )
hMenu := Wvt_CreateMenu() hMenu := Wvt_CreateMenu()
Wvt_AppendMenu( hMenu, MF_STRING + MF_ENABLED, ID_MNU_FILE , "File" ) Wvt_AppendMenu( hMenu, MF_STRING + MF_ENABLED, ID_MNU_FILE , "File" )
@@ -105,14 +103,14 @@ FUNCTION DynWinDialog( nInfo )
IF nInfo == 2 IF nInfo == 2
// Modal Dialog // Modal Dialog
//hDlg := Wvt_DialogBox( aDlg, bDlgProc, Wvt_GetWindowHandle() ) //hDlg := wvt_DialogBox( aDlg, bDlgProc, Wvt_GetWindowHandle() )
hDlg := Wvt_DialogBox( aDlg, cDlgProc, Wvt_GetWindowHandle() ) hDlg := wvt_DialogBox( aDlg, cDlgProc, Wvt_GetWindowHandle() )
ELSE ELSE
// Modeless Dialog // Modeless Dialog
hDlg := Wvt_CreateDialog( aDlg, lOnTop, cDlgProc, cDlgIcon, /*nTimerTicks*/, hMenu ) hDlg := wvt_CreateDialog( aDlg, lOnTop, cDlgProc, cDlgIcon, /*nTimerTicks*/, hMenu )
// Using Function name. // Using Function name.
//hDlg := Wvt_CreateDialog( aDlg, lOnTop, cDlgProc, cDlgIcon, nTimerTicks, hMenu, lModal ) //hDlg := wvt_CreateDialog( aDlg, lOnTop, cDlgProc, cDlgIcon, nTimerTicks, hMenu, lModal )
ENDIF ENDIF
RETURN hDlg RETURN hDlg
@@ -124,163 +122,161 @@ FUNCTION DynDlgProc( hDlg, nMsg, wParam, lParam )
SWITCH nMsg SWITCH nMsg
CASE WM_TIMER CASE WM_TIMER
Wvg_SetDlgItemText( hDlg, ID_EDT_TIME, Time() ) wvg_SetDlgItemText( hDlg, ID_EDT_TIME, Time() )
EXIT EXIT
CASE WM_COMMAND CASE WM_COMMAND
DO CASE DO CASE
CASE wParam == ID_CHK_SATIS CASE wParam == ID_CHK_SATIS
lClicked := ( Wvg_IsDlgButtonChecked( hDlg, ID_CHK_SATIS ) == 1 ) lClicked := ( wvg_IsDlgButtonChecked( hDlg, ID_CHK_SATIS ) == 1 )
Wvg_MessageBox( hDlg, iif( lClicked, "Satisfied", "UnSatisfied" ), "CheckBoxStatus" ) wvg_MessageBox( hDlg, iif( lClicked, "Satisfied", "UnSatisfied" ), "CheckBoxStatus" )
CASE wParam == ID_RDO_XH CASE wParam == ID_RDO_XH
Wvg_MessageBox( hDlg, "Harbour", "Compiler" ) wvg_MessageBox( hDlg, "Harbour", "Compiler" )
CASE wParam == ID_RDO_CLIP CASE wParam == ID_RDO_CLIP
Wvg_MessageBox( hDlg, "Clipper", "Compiler" ) wvg_MessageBox( hDlg, "Clipper", "Compiler" )
CASE wParam == ID_RDO_XBASE CASE wParam == ID_RDO_XBASE
Wvg_MessageBox( hDlg, "Xbase++", "Compiler" ) wvg_MessageBox( hDlg, "Xbase++", "Compiler" )
CASE wParam == ID_MNU_FILE CASE wParam == ID_MNU_FILE
Wvg_MessageBox( hDlg, "Execute Menu Action!", "File" ) wvg_MessageBox( hDlg, "Execute Menu Action!", "File" )
CASE wParam == ID_MNU_CONTROL CASE wParam == ID_MNU_CONTROL
Wvg_MessageBox( hDlg, "Controls are from Windows!", "Controls" ) wvg_MessageBox( hDlg, "Controls are from Windows!", "Controls" )
CASE Wvg_LOWORD( wParam ) == ID_LST_LIST CASE wvg_LOWORD( wParam ) == ID_LST_LIST
IF Wvg_HIWORD( wParam ) == LBN_SELCHANGE IF wvg_HIWORD( wParam ) == LBN_SELCHANGE
nIndex := Wvg_SendMessage( Wvg_GetDlgItem( hDlg, ID_LST_LIST ), LB_GETCURSEL, 0, 0 ) nIndex := wvg_SendMessage( wvg_GetDlgItem( hDlg, ID_LST_LIST ), LB_GETCURSEL, 0, 0 )
cPrompt := Space( 20 ) cPrompt := Space( 20 )
Wvg_SendMessage( Wvg_GetDlgItem( hDlg, ID_LST_LIST ), LB_GETTEXT, nIndex, @cPrompt ) wvg_SendMessage( wvg_GetDlgItem( hDlg, ID_LST_LIST ), LB_GETTEXT, nIndex, @cPrompt )
Wvg_MessageBox( hDlg, cPrompt, "ListBox" ) wvg_MessageBox( hDlg, cPrompt, "ListBox" )
ENDIF ENDIF
CASE Wvg_LOWORD( wParam ) == ID_CMB_COMBO CASE wvg_LOWORD( wParam ) == ID_CMB_COMBO
IF Wvg_HIWORD( wParam ) == CBN_SELCHANGE IF wvg_HIWORD( wParam ) == CBN_SELCHANGE
nIndex := Wvg_SendMessage( Wvg_GetDlgItem( hDlg, ID_CMB_COMBO ), CB_GETCURSEL, 0, 0 ) nIndex := wvg_SendMessage( wvg_GetDlgItem( hDlg, ID_CMB_COMBO ), CB_GETCURSEL, 0, 0 )
cPrompt := Space( 20 ) cPrompt := Space( 20 )
Wvg_SendMessage( Wvg_GetDlgItem( hDlg, ID_CMB_COMBO ), CB_GETLBTEXT, nIndex, @cPrompt ) wvg_SendMessage( wvg_GetDlgItem( hDlg, ID_CMB_COMBO ), CB_GETLBTEXT, nIndex, @cPrompt )
Wvg_MessageBox( hDlg, cPrompt, "Combo Box" ) wvg_MessageBox( hDlg, cPrompt, "Combo Box" )
ENDIF ENDIF
ENDCASE ENDCASE
EXIT EXIT
CASE WM_CTLCOLOREDIT CASE WM_CTLCOLOREDIT
IF Wvg_GetDlgItem( hDlg, ID_MLE ) == lParam IF wvg_GetDlgItem( hDlg, ID_MLE ) == lParam
Wvg_SetTextColor( wParam, RGB( 0, 0, 255 ) ) wvg_SetTextColor( wParam, RGB( 0, 0, 255 ) )
Wvg_SetBkColor( wParam, RGB( 255, 255, 200 ) ) wvg_SetBkColor( wParam, RGB( 255, 255, 200 ) )
RETURN 1 RETURN 1
ELSEIF Wvg_GetDlgItem( hDlg, ID_EDT_TEXT ) == lParam ELSEIF wvg_GetDlgItem( hDlg, ID_EDT_TEXT ) == lParam
Wvg_SetTextColor( wParam, RGB( 255, 255, 255 ) ) wvg_SetTextColor( wParam, RGB( 255, 255, 255 ) )
Wvg_SetBkColor( wParam, RGB( 10, 200, 45 ) ) wvg_SetBkColor( wParam, RGB( 10, 200, 45 ) )
RETURN 1 RETURN 1
ENDIF ENDIF
EXIT EXIT
CASE WM_CTLCOLORSTATIC CASE WM_CTLCOLORSTATIC
IF Wvg_GetDlgItem( hDlg, ID_STA_TEXT ) == lParam IF wvg_GetDlgItem( hDlg, ID_STA_TEXT ) == lParam
Wvg_SetTextColor( wParam, RGB( 255, 255, 255 ) ) wvg_SetTextColor( wParam, RGB( 255, 255, 255 ) )
RETURN 1 RETURN 1
ENDIF ENDIF
EXIT EXIT
CASE WM_INITDIALOG CASE WM_INITDIALOG
Wvg_SetTimer( hDlg, 5001, 1000 ) // 1 sec wvg_SetTimer( hDlg, 5001, 1000 ) // 1 sec
IF Empty( aHFonts := SetFonts() ) IF Empty( aHFonts := SetFonts() )
IF ( hFont := Wvt_CreateFont( "Times New Roman", 18 ) ) != 0 IF ( hFont := wvt_CreateFont( "Times New Roman", 18 ) ) != 0
SetFonts( hFont ) SetFonts( hFont )
ENDIF ENDIF
ENDIF ENDIF
IF Len( aHFonts ) > 0 IF Len( aHFonts ) > 0
Wvg_SendMessage( Wvg_GetDlgItem( hDlg, ID_MLE ), WM_SETFONT, ahFonts[ 1 ], 0 ) wvg_SendMessage( wvg_GetDlgItem( hDlg, ID_MLE ), WM_SETFONT, ahFonts[ 1 ], 0 )
ENDIF ENDIF
IF Empty( SetIcons() ) IF Empty( SetIcons() )
SetIcons( Wvg_LoadIcon( "vr_1.ico" ) ) SetIcons( wvg_LoadIcon( "vr_1.ico" ) )
ENDIF ENDIF
IF ! Empty( SetIcons() ) IF ! Empty( SetIcons() )
Wvg_SendMessage( Wvg_GetDlgItem( hDlg, ID_ICO_VOUCH ), STM_SETIMAGE, IMAGE_ICON, SetIcons()[ 1 ] ) wvg_SendMessage( wvg_GetDlgItem( hDlg, ID_ICO_VOUCH ), STM_SETIMAGE, IMAGE_ICON, SetIcons()[ 1 ] )
ENDIF ENDIF
/* /*
IF t_hImage == NIL IF t_hImage == NIL
t_hImage := Wvg_LoadImage( "vouch1.bmp", 2 ) t_hImage := wvg_LoadImage( "vouch1.bmp", 2 )
ENDIF ENDIF
IF t_hImage != NIL .AND. t_hImage != 0 IF t_hImage != NIL .AND. t_hImage != 0
Wvg_SendMessage( Wvg_GetDlgItem( hDlg, ID_STA_IMAGE ), STM_SETIMAGE, IMAGE_BITMAP, t_hImage ) wvg_SendMessage( wvg_GetDlgItem( hDlg, ID_STA_IMAGE ), STM_SETIMAGE, IMAGE_BITMAP, t_hImage )
ENDIF ENDIF
*/ */
Wvg_SetDlgItemText( hDlg, ID_MLE, GetEditText() ) wvg_SetDlgItemText( hDlg, ID_MLE, GetEditText() )
Wvg_CheckDlgButton( hDlg, ID_CHK_SATIS, .T. ) wvg_CheckDlgButton( hDlg, ID_CHK_SATIS, .T. )
Wvg_CheckRadioButton( hDlg, ID_RDO_XH, ID_RDO_XBASE, ID_RDO_XH ) wvg_CheckRadioButton( hDlg, ID_RDO_XH, ID_RDO_XBASE, ID_RDO_XH )
Wvt_LBAddString( hDlg, ID_LST_LIST, "Harbour" ) wvt_LBAddString( hDlg, ID_LST_LIST, "Harbour" )
Wvt_LBAddString( hDlg, ID_LST_LIST, "Gtwvt" ) wvt_LBAddString( hDlg, ID_LST_LIST, "Gtwvt" )
Wvt_LBAddString( hDlg, ID_LST_LIST, "Wvtgui" ) wvt_LBAddString( hDlg, ID_LST_LIST, "Wvtgui" )
Wvt_LBAddString( hDlg, ID_LST_LIST, "Modeless" ) wvt_LBAddString( hDlg, ID_LST_LIST, "Modeless" )
Wvt_LBAddString( hDlg, ID_LST_LIST, "Dialogs" ) wvt_LBAddString( hDlg, ID_LST_LIST, "Dialogs" )
Wvt_LBAddString( hDlg, ID_LST_LIST, "WVT" ) wvt_LBAddString( hDlg, ID_LST_LIST, "WVT" )
Wvt_LBSetCurSel( hDlg, ID_LST_LIST, 1 ) wvt_LBSetCurSel( hDlg, ID_LST_LIST, 1 )
Wvt_CBAddString( hDlg, ID_CMB_COMBO, "First" ) wvt_CBAddString( hDlg, ID_CMB_COMBO, "First" )
Wvt_CBAddString( hDlg, ID_CMB_COMBO, "Second" ) wvt_CBAddString( hDlg, ID_CMB_COMBO, "Second" )
Wvt_CBAddString( hDlg, ID_CMB_COMBO, "Third" ) wvt_CBAddString( hDlg, ID_CMB_COMBO, "Third" )
Wvt_CBAddString( hDlg, ID_CMB_COMBO, "Fourth" ) wvt_CBAddString( hDlg, ID_CMB_COMBO, "Fourth" )
Wvt_CBAddString( hDlg, ID_CMB_COMBO, "Fifth" ) wvt_CBAddString( hDlg, ID_CMB_COMBO, "Fifth" )
Wvt_CBSetCurSel( hDlg, ID_CMB_COMBO, 1 ) wvt_CBSetCurSel( hDlg, ID_CMB_COMBO, 1 )
Wvg_InvalidateRect( hDlg ) wvg_InvalidateRect( hDlg )
EXIT EXIT
CASE WM_DESTROY CASE WM_DESTROY
// Do whatevert you want to do with cText // Do whatever you want to do with cText
// Each box will retrieve its own text. // Each box will retrieve its own text.
/* cText := */ #if 0
Wvg_GetDlgItemText( hDlg, ID_MLE ) cText := ""
#endif
wvg_GetDlgItemText( hDlg, ID_MLE )
EXIT EXIT
ENDSWITCH ENDSWITCH
RETURN 0 RETURN 0
STATIC FUNCTION GetEditText() STATIC FUNCTION GetEditText()
RETURN ;
LOCAL cText := "" "Welcome in the Wonderful World of Harbour!" + ;
hb_eol() + hb_eol() + ;
cText += "Welcome in the Wonderful World of Harbour!" "When Peter Rees first published GTWVT, a Windows " + ;
cText += hb_eol() + hb_eol() "Terminal Driver, on 22 Dec 2003, everybody took it " + ;
cText += "When Peter Rees first published GTWVT, a Windows " "lightly, except for me, as I was aware that what " + ;
cText += "Terminal Driver, on 22 Dec 2003, everybody took it " "wonderful contribution to Harbour he has made, " + ;
cText += "lightly, except for me, as I was aware that what " "what immense possibilities he has opened for Harbour " + ;
cText += "wonderful contribution to Harbour he has made, " "developers, what limitations he has cleared for Cl*pper " + ;
cText += "what immense possibilities he has opened for Harbour " "savvy user base." + ;
cText += "developers, what limitations he has cleared for Clipper " hb_eol() + hb_eol() + ;
cText += "savvy user base." "With a little effort I could extend GTWVT " + ;
cText += hb_eol() + hb_eol() "to give it a GUI look. I also tried to give it " + ;
cText += "With a little effort I could extend GTWVT " "an event driven functionality, and up came Wvt*Classes." + ;
cText += "to give it a GUI look. I also tried to give it " hb_eol() + hb_eol() + ;
cText += "an event driven functionality, and up came Wvt*Classes." "And yet another feather is added in the cap of GTWVT " + ;
cText += hb_eol() + hb_eol() "as it is now capable of firing modeless dialogs like the one " + ;
cText += "And yet another feather is added in the cap of GTWVT " "you are viewing. These dialogs can be constructed dynamically ( Courtesy hbwhat ) " + ;
cText += "as it is now capable of firing modeless dialogs like the one " "at run time or can be one of resources. At present 20 such dialogs " + ;
cText += "you are viewing. These dialogs can be constructed dynamically ( Courtesy hbwhat32 ) " "can be active at any given time. Also note that dialogs created " + ;
cText += "at run time or can be one of resources. At present 20 such dialogs " "dynamically respect Top, Left, Rows, Cols coordinates, which is an " + ;
cText += "can be active at any given time. Also note that dialogs created " "undisputed productivity boost!" + ;
cText += "dynamically respect Top, Left, Rows, Cols coordinates, which is an " hb_eol() + hb_eol() + ;
cText += "undisputed productivity boost!" "Enjoy!" + hb_eol() + ;
cText += hb_eol() + hb_eol() "Pritpal Bedi, INDIA"
cText += "Enjoy!" + hb_eol()
cText += "Pritpal Bedi, INDIA"
RETURN cText
FUNCTION DlgSlideShow() FUNCTION DlgSlideShow()
@@ -290,9 +286,9 @@ FUNCTION DlgSlideShow()
nStyle := DS_SETFONT + WS_VISIBLE + WS_POPUP + WS_CAPTION + WS_SYSMENU + WS_THICKFRAME + WS_MINIMIZEBOX nStyle := DS_SETFONT + WS_VISIBLE + WS_POPUP + WS_CAPTION + WS_SYSMENU + WS_THICKFRAME + WS_MINIMIZEBOX
aDlg := Wvt_MakeDlgTemplate( 0, 0, 20, 40, {}, "Slide Show", nStyle ) aDlg := wvt_MakeDlgTemplate( 0, 0, 20, 40, {}, "Slide Show", nStyle )
hDlg := Wvt_CreateDialog( aDlg, .F., "DlgSlideShowProc", "vr_1.ico", 5000 ) hDlg := wvt_CreateDialog( aDlg, .F., "DlgSlideShowProc", "vr_1.ico", 5000 )
RETURN hDlg RETURN hDlg
@@ -325,17 +321,17 @@ FUNCTION DlgSlideShowProc( hDlg, nMsg, wParam, lParam )
RETURN 0 RETURN 0
FUNCTION DrawSlide( hDlg, nSlide ) STATIC PROCEDURE DrawSlide( hDlg, nSlide )
LOCAL hDC, aRect LOCAL hDC, aRect
hDC := Wvg_GetDC( hDlg ) hDC := wvg_GetDC( hDlg )
aRect := Wvg_GetClientRect( hDlg ) aRect := wvg_GetClientRect( hDlg )
win_Rectangle( hDC, aRect[ 1 ] + 10, aRect[ 2 ] + 10, aRect[ 3 ] - 10, aRect[ 4 ] - 10 ) win_Rectangle( hDC, aRect[ 1 ] + 10, aRect[ 2 ] + 10, aRect[ 3 ] - 10, aRect[ 4 ] - 10 )
Wvg_DrawImage( hDC, aRect[ 1 ] + 10, aRect[ 2 ] + 10, aRect[ 3 ] - aRect[ 1 ] - 20, ; wvg_DrawImage( hDC, aRect[ 1 ] + 10, aRect[ 2 ] + 10, aRect[ 3 ] - aRect[ 1 ] - 20, ;
aRect[ 4 ] - aRect[ 2 ] - 20, t_aSlides[ nSlide ] ) aRect[ 4 ] - aRect[ 2 ] - 20, t_aSlides[ nSlide ] )
Wvg_ReleaseDC( hDlg, hDC ) wvg_ReleaseDC( hDlg, hDC )
RETURN NIL RETURN

View File

@@ -1,9 +1,8 @@
/* /* Pritpal Bedi <bedipritpal@hotmail.com> */
* Pritpal Bedi <bedipritpal@hotmail.com>
*/
#include "inkey.ch" #include "inkey.ch"
#include "hbgtinfo.ch" #include "hbgtinfo.ch"
#include "setcurs.ch"
#xuntranslate Alert( => #xuntranslate Alert( =>
@@ -110,7 +109,7 @@ FUNCTION DialogAlert( cCaption, aText_, aButtons_, sel, aMessage_, nTop, nTime )
// check for columns // check for columns
// place 2 spaces before and after the buttons // place 2 spaces before and after the buttons
nColCap := Len( cCaption ) + 7 // " - "+" "+caption+" " nColCap := Len( cCaption ) + 7 // " - " + " " + cCaption + " "
nColTxt := 0 nColTxt := 0
IF ! Empty( aText_ ) IF ! Empty( aText_ )
AEval( aText_, {| e | nColTxt := Max( nColTxt, Len( e ) ) } ) AEval( aText_, {| e | nColTxt := Max( nColTxt, Len( e ) ) } )
@@ -131,7 +130,7 @@ FUNCTION DialogAlert( cCaption, aText_, aButtons_, sel, aMessage_, nTop, nTime )
aTrg_[ i ] := Upper( SubStr( aButtons_[ i ], 1, 1 ) ) aTrg_[ i ] := Upper( SubStr( aButtons_[ i ], 1, 1 ) )
NEXT NEXT
// Create a new Window // Create a new Window
B_CRT nTop, nLeft, nBottom - 1, nRight MODAL ICON "dia_excl.ico" TITLE " " + cCaption INTO oCrt B_CRT nTop, nLeft, nBottom - 1, nRight MODAL ICON "dia_excl.ico" TITLE " " + cCaption INTO oCrt
nTop := -1 nTop := -1
@@ -156,11 +155,11 @@ FUNCTION DialogAlert( cCaption, aText_, aButtons_, sel, aMessage_, nTop, nTime )
DispBegin() DispBegin()
SetColor( pal_[ DLG_CLR_TEXT ] ) SetColor( pal_[ DLG_CLR_TEXT ] )
Wvg_BoxRaised( nTop, nLeft, nBottom, nRight ) wvg_BoxRaised( nTop, nLeft, nBottom, nRight )
SetColor( pal_[ DLG_CLR_TEXT ] ) SetColor( pal_[ DLG_CLR_TEXT ] )
IF ! Empty( aText_ ) IF ! Empty( aText_ )
FOR i := 1 TO Len( aText_ ) FOR i := 1 TO Len( aText_ )
@ nTop + 1 + i, nLeft SAY PadC( aText_[ i ], nRight - nLeft + 1 ) @ nTop + 1 + i, nLeft SAY PadC( aText_[ i ], nRight - nLeft + 1 )
NEXT NEXT
ENDIF ENDIF
@@ -181,7 +180,7 @@ FUNCTION DialogAlert( cCaption, aText_, aButtons_, sel, aMessage_, nTop, nTime )
SetColor( pal_[ DLG_CLR_HISEL ] ) SetColor( pal_[ DLG_CLR_HISEL ] )
@ nBtnRow, nBtnCol_[ sel ] + 2 SAY SubStr( aButtons_[ sel ], 1, 1 ) @ nBtnRow, nBtnCol_[ sel ] + 2 SAY SubStr( aButtons_[ sel ], 1, 1 )
AEval( x_, {| e_ | Wvg_BoxRaised( e_[ 1 ], e_[ 2 ], e_[ 3 ], e_[ 4 ] ) } ) AEval( x_, {| e_ | wvg_BoxRaised( e_[ 1 ], e_[ 2 ], e_[ 3 ], e_[ 4 ] ) } )
DispEnd() DispEnd()
@@ -303,14 +302,13 @@ FUNCTION CreateOCrt( nT, nL, nB, nR, cTitle, xIcon, lModal, lRowCols, lHidden, ;
RETURN oCrt RETURN oCrt
FUNCTION DoModalWindow() PROCEDURE DoModalWindow()
LOCAL oCrt, nSel, pGT LOCAL oCrt, nSel, pGT
LOCAL aLastPaint := WvtSetBlocks( {} ) LOCAL aLastPaint := WvtSetBlocks( {} )
/* This part can be clubbed in a separate prg for different dialogs /* This part can be clubbed in a separate .prg for different dialogs
* OR can be loaded from a data dictionary. OR can be loaded from a data dictionary. */
*/
oCrt := WvgCrt():New( , , { 4, 8 }, { 12, 49 }, , .T. ) oCrt := WvgCrt():New( , , { 4, 8 }, { 12, 49 }, , .T. )
@@ -329,15 +327,14 @@ FUNCTION DoModalWindow()
pGT := SetGT( 3, hb_gtSelect() ) pGT := SetGT( 3, hb_gtSelect() )
// Here goes the Clipper Code // Here goes the Cl*pper Code
SetColor( "N/W" ) SetColor( "N/W" )
CLS CLS
DO WHILE .T. DO WHILE .T.
nSel := Just_Alert( "I am in modal window !;< Try: MMove LBUp RBUp >;Click Parent Window", { "OK" } ) nSel := Just_Alert( "I am in modal window !;< Try: MMove LBUp RBUp >;Click Parent Window", { "OK" } )
IF nSel == 0 .OR. nSel == 1 IF nSel == 0 .OR. nSel == 1
EXIT EXIT
ENDIF ENDIF
ENDDO ENDDO
@@ -346,4 +343,4 @@ FUNCTION DoModalWindow()
WvtSetBlocks( aLastPaint ) WvtSetBlocks( aLastPaint )
RETURN NIL RETURN

View File

@@ -1,15 +1,18 @@
/* /* TBrowse Demonstration with GUI Elements
* TBrowse Demonstration with GUI Elements
* *
* This protocol can be clubbed with pure console implementation * This protocol can be clubbed with pure console implementation
* AND can be called IN a separate thread as well as modal TO * and can be called in a separate thread as well as modal to
* current window. * current window.
* *
* Pritpal Bedi <bedipritpal@hotmail.com> * Pritpal Bedi <bedipritpal@hotmail.com>
*/ */
#include "button.ch"
#include "dbstruct.ch"
#include "inkey.ch" #include "inkey.ch"
#include "setcurs.ch"
#include "hbgtinfo.ch" #include "hbgtinfo.ch"
#include "hbver.ch"
#define K_MOVING 1001 #define K_MOVING 1001
@@ -26,25 +29,24 @@
#define K_SBTHUMBTRACKVERT 1059 #define K_SBTHUMBTRACKVERT 1059
#define K_SBTHUMBTRACKHORZ 1060 #define K_SBTHUMBTRACKHORZ 1060
FUNCTION WvtMyBrowse() PROCEDURE WvtMyBrowse()
IF hb_mtvm() IF hb_mtvm()
hb_threadStart( {| oCrt | oCrt := WvgCrt():new( , , { -1, -2 }, { 34, 69 }, , .T. ), ; hb_threadStart( {| oCrt | oCrt := WvgCrt():new( , , { -1, -2 }, { 34, 69 }, , .T. ), ;
oCrt:resizeMode := HB_GTI_RESIZEMODE_ROWS, ; oCrt:resizeMode := HB_GTI_RESIZEMODE_ROWS, ;
oCrt:icon := GetResource( "dia_excl.ico" ), ; oCrt:icon := GetResource( "dia_excl.ico" ), ;
oCrt:create(), ; oCrt:create(), ;
Wvt_SetGUI( .T. ), ; wvt_SetGUI( .T. ), ;
ExecBrowser( oCrt ), ; ExecBrowser( oCrt ), ;
oCrt:destroy(); oCrt:destroy() } )
} )
ELSE ELSE
ExecBrowser() ExecBrowser()
ENDIF ENDIF
RETURN NIL RETURN
FUNCTION ExecBrowser( oCrt ) STATIC PROCEDURE ExecBrowser( oCrt )
LOCAL nKey, bBlock, oBrowse, aLastPaint, i, pGT LOCAL nKey, bBlock, oBrowse, aLastPaint, i, pGT
LOCAL cFileIndex, cFileDbf, cRDD, nIndex, oTBar, cScr, info_ // , oLB LOCAL cFileIndex, cFileDbf, cRDD, nIndex, oTBar, cScr, info_ // , oLB
@@ -59,7 +61,7 @@ FUNCTION ExecBrowser( oCrt )
LOCAL nCol := Col() LOCAL nCol := Col()
LOCAL cColor := SetColor( "N/W*,N/GR*,,,N/W*" ) LOCAL cColor := SetColor( "N/W*,N/GR*,,,N/W*" )
LOCAL aObjects := WvtSetObjects( {} ) LOCAL aObjects := WvtSetObjects( {} )
LOCAL hPopup := Wvt_SetPopupMenu() LOCAL hPopup := wvt_SetPopupMenu()
LOCAL oVBar, oHBar, oCom, oTre, oChk, oSLE, oLBx, aNvg, oIdx LOCAL oVBar, oHBar, oCom, oTre, oChk, oSLE, oLBx, aNvg, oIdx
STATIC s_nStyle := 0 STATIC s_nStyle := 0
@@ -75,7 +77,7 @@ FUNCTION ExecBrowser( oCrt )
oTBar := BrwBuildToolBar( oCrt ) oTBar := BrwBuildToolBar( oCrt )
oTBar:buttonClick := {| oBtn | Vou_ExecTBarAction( oBtn ) } oTBar:buttonClick := {| oBtn | Vou_ExecTBarAction( oBtn ) }
SetMode( MaxRow() + 1, MaxCol() + 1 ) /* Neccessary because adding menu has reduced the overall size of window */ SetMode( MaxRow() + 1, MaxCol() + 1 ) /* Necessary because adding menu has reduced the overall size of window */
pGT := SetGT( 2, hb_gtSelect() ) pGT := SetGT( 2, hb_gtSelect() )
@@ -85,7 +87,7 @@ FUNCTION ExecBrowser( oCrt )
USE ( cFileDbf ) NEW SHARED VIA ( cRDD ) USE ( cFileDbf ) NEW SHARED VIA ( cRDD )
IF NetErr() IF NetErr()
RETURN NIL RETURN
ENDIF ENDIF
IF FLock() IF FLock()
INDEX ON Test->FIRST TAG "001" TO ( cFileIndex ) INDEX ON Test->FIRST TAG "001" TO ( cFileIndex )
@@ -119,14 +121,14 @@ FUNCTION ExecBrowser( oCrt )
IF s_nStyle > 5 IF s_nStyle > 5
s_nStyle := 0 s_nStyle := 0
ENDIF ENDIF
Wvt_SetPen( s_nStyle, 0, RGB( 210,1210,210 ) ) wvt_SetPen( s_nStyle, 0, RGB( 210,1210,210 ) )
s_nStyle++ s_nStyle++
hb_gtInfo( HB_GTI_WINTITLE, "WVT Gui TBrowse()" ) hb_gtInfo( HB_GTI_WINTITLE, "WVT GUI TBrowse()" )
AAdd( aBlocks, {|| Wvt_DrawBoxRaised( oBrowse:nTop - 2, oBrowse:nLeft - 2, oBrowse:nBottom + 1, oBrowse:nRight + 2 ) } ) AAdd( aBlocks, {|| wvt_DrawBoxRaised( oBrowse:nTop - 2, oBrowse:nLeft - 2, oBrowse:nBottom + 1, oBrowse:nRight + 2 ) } )
AAdd( aBlocks, {|| Wvt_DrawBoxRecessed( oBrowse:nTop, oBrowse:nLeft, oBrowse:nBottom, oBrowse:nRight ) } ) AAdd( aBlocks, {|| wvt_DrawBoxRecessed( oBrowse:nTop, oBrowse:nLeft, oBrowse:nBottom, oBrowse:nRight ) } )
AAdd( aBlocks, {|| Wvt_DrawGridHorz( oBrowse:nTop + 3, oBrowse:nLeft, oBrowse:nRight, oBrowse:nBottom - oBrowse:nTop - 2 ) } ) AAdd( aBlocks, {|| wvt_DrawGridHorz( oBrowse:nTop + 3, oBrowse:nLeft, oBrowse:nRight, oBrowse:nBottom - oBrowse:nTop - 2 ) } )
AAdd( aBlocks, {|| Wvt_DrawGridVert( oBrowse:nTop, oBrowse:nBottom, oBrowse:aColumnsSep, Len( oBrowse:aColumnsSep ) ) } ) AAdd( aBlocks, {|| wvt_DrawGridVert( oBrowse:nTop, oBrowse:nBottom, oBrowse:aColumnsSep, Len( oBrowse:aColumnsSep ) ) } )
Vou_BrwAddScrollBars( oCrt, oBrowse, @oVBar, @oHBar ) Vou_BrwAddScrollBars( oCrt, oBrowse, @oVBar, @oHBar )
@@ -144,7 +146,7 @@ FUNCTION ExecBrowser( oCrt )
BrwBuildButtons( oCrt, oBrowse ) BrwBuildButtons( oCrt, oBrowse )
oTre := BrwBuildTree( oCrt, oBrowse ) oTre := BrwBuildTree( oCrt, oBrowse )
Wvt_Keyboard( HB_K_RESIZE ) /* Refresh All GUI Controls */ wvt_Keyboard( HB_K_RESIZE ) /* Refresh All GUI Controls */
WHILE ! lEnd WHILE ! lEnd
DispBegin() DispBegin()
@@ -198,7 +200,7 @@ FUNCTION ExecBrowser( oCrt )
ENDCASE ENDCASE
ENDDO ENDDO
Wvt_SetPen( 0 ) wvt_SetPen( 0 )
WvtSetBlocks( aLastPaint ) WvtSetBlocks( aLastPaint )
WvtSetObjects( aObjects ) WvtSetObjects( aObjects )
@@ -207,13 +209,14 @@ FUNCTION ExecBrowser( oCrt )
SetCursor( nCursor ) SetCursor( nCursor )
dbCloseArea() dbCloseArea()
IF oCrt == NIL IF oCrt == NIL
RestScreen( 0, 0, MaxRow(), MaxCol(), cScr ) RestScreen( 0, 0, MaxRow(), MaxCol(), cScr )
ENDIF ENDIF
Wvt_SetPopupMenu( hPopup ) wvt_SetPopupMenu( hPopup )
SetGT( 2, pGT ) SetGT( 2, pGT )
RETURN NIL RETURN
STATIC FUNCTION BrwHandleResize( oCrt, oBrw, oVBar, oHBar, oCom, oSLE, oLBx, oTre, oChk, aNvg, oIdx, lActiveX, cFileDbf ) STATIC FUNCTION BrwHandleResize( oCrt, oBrw, oVBar, oHBar, oCom, oSLE, oLBx, oTre, oChk, aNvg, oIdx, lActiveX, cFileDbf )
@@ -234,12 +237,16 @@ STATIC FUNCTION BrwHandleResize( oCrt, oBrw, oVBar, oHBar, oCom, oSLE, oLBx, oTr
oVBar:setPosAndSize() oVBar:setPosAndSize()
oHBar:setPosAndSize() oHBar:setPosAndSize()
oCom:setPosAndSize() oCom:setPosAndSize()
// oSLE:setPosAndSize() #if 0
// oLBx:setPosAndSize() oSLE:setPosAndSize()
// oIdx:setPosAndSize() oLBx:setPosAndSize()
oIdx:setPosAndSize()
#endif
oTre:setPosAndSize() oTre:setPosAndSize()
// oChk:setPosAndSize() #if 0
oChk:setPosAndSize()
#endif
BrwReposButtons( oCrt ) /* Because we are repositioning at the center of console width */ BrwReposButtons( oCrt ) /* Because we are repositioning at the center of console width */
@@ -259,7 +266,7 @@ STATIC FUNCTION BrwHandleResize( oCrt, oBrw, oVBar, oHBar, oCom, oSLE, oLBx, oTr
RETURN .T. RETURN .T.
STATIC FUNCTION BrwShowColumn( oBrw, cHeading ) STATIC PROCEDURE BrwShowColumn( oBrw, cHeading )
LOCAL i, j, nCur LOCAL i, j, nCur
@@ -281,7 +288,7 @@ STATIC FUNCTION BrwShowColumn( oBrw, cHeading )
oBrw:refreshCurrent() oBrw:refreshCurrent()
oBrw:forceStable() oBrw:forceStable()
RETURN NIL RETURN
STATIC FUNCTION BrwBuildTree( oCrt /*, oBrw*/ ) STATIC FUNCTION BrwBuildTree( oCrt /*, oBrw*/ )
@@ -294,7 +301,7 @@ STATIC FUNCTION BrwBuildTree( oCrt /*, oBrw*/ )
oTree:create( , , { -24, -1 }, { {|| -( MaxRow() - 1 - 24 ) }, -10 } ) oTree:create( , , { -24, -1 }, { {|| -( MaxRow() - 1 - 24 ) }, -10 } )
oTree:setColorFG( "W+" ) oTree:setColorFG( "W+" )
oTree:setColorBG( "R*" ) oTree:setColorBG( "R*" )
oTree:itemSelected := {| oItem | Wvg_MessageBox( , iif( oItem != NIL, oItem:caption, "Some Problem" ) ) } oTree:itemSelected := {| oItem | wvg_MessageBox( , iif( oItem != NIL, oItem:caption, "Some Problem" ) ) }
oItem1 := oTree:rootItem:addItem( "First level A" ) oItem1 := oTree:rootItem:addItem( "First level A" )
@@ -322,9 +329,11 @@ STATIC FUNCTION BrwBuildActiveX( oCrt, oBrw )
oCom := WvgActiveXControl():new( oCrt, , { -24, -13 }, { {|| -( MaxRow() - 1 - 24 ) }, {|| -( MaxCol() - 1 - 13 ) } }, , .F. ) oCom := WvgActiveXControl():new( oCrt, , { -24, -13 }, { {|| -( MaxRow() - 1 - 24 ) }, {|| -( MaxCol() - 1 - 13 ) } }, , .F. )
oCom:CLSID := "Shell.Explorer.2" oCom:CLSID := "Shell.Explorer.2"
// oCom:mapEvent( 269, {|| uiDebug( " E X P L O R E R - 2 6 9" ) } ) #if 0
oCom:mapEvent( 269, {|| uiDebug( "EXPLORER-269" ) } )
#endif
oCom:create() oCom:create()
oCom:navigate( "http://hbide.vouch.info" ) oCom:navigate( hb_Version( HB_VERSION_URL_BASE ) )
RETURN oCom RETURN oCom
@@ -345,13 +354,13 @@ STATIC FUNCTION BrwBuildListBox( oCrt, oBrw )
RETURN oXbp RETURN oXbp
STATIC FUNCTION BrwSetThisOrder( oBrw, nOrd ) STATIC PROCEDURE BrwSetThisOrder( oBrw, nOrd )
dbSetOrder( nOrd ) dbSetOrder( nOrd )
oBrw:refreshAll() oBrw:refreshAll()
oBrw:forceStable() oBrw:forceStable()
RETURN NIL RETURN
STATIC FUNCTION BrwBuildListBoxIdx( oCrt, oBrw ) STATIC FUNCTION BrwBuildListBoxIdx( oCrt, oBrw )
@@ -419,8 +428,8 @@ STATIC FUNCTION BrwBuildNvg( oCrt, oBrw, oCom )
oXbp:setColorFG( "N" ) oXbp:setColorFG( "N" )
oXbp:setColorBG( "BG+" ) oXbp:setColorBG( "BG+" )
oXbp:returnPressed := {| m1, m2, o | m1 := m2, oCom:navigate( RTrim( o:getData() ) ) } oXbp:returnPressed := {| m1, m2, o | m1 := m2, oCom:navigate( RTrim( o:getData() ) ) }
oXbp:tooltipText := "Type-in a http:// address and press ENTER" oXbp:tooltipText := "Type-in a web address and press ENTER"
oXbp:setData( "http://hbide.vouch.info/" ) oXbp:setData( hb_Version( HB_VERSION_URL_BASE ) )
RETURN { oLbl, oXbp } RETURN { oLbl, oXbp }
@@ -433,16 +442,16 @@ STATIC FUNCTION BrwBuildCheckBox( oCrt, oBrw, lActiveX )
oXbp := WvgCheckBox():new( oCrt ) oXbp := WvgCheckBox():new( oCrt )
oXbp:pointerFocus := .F. oXbp:pointerFocus := .F.
oXbp:caption := "ActiveX" oXbp:caption := "ActiveX"
oXbp:selected := {| x, y, o | x := y, lActiveX := o:getData(), Wvt_Keyboard( HB_K_RESIZE ) } oXbp:selected := {| x, y, o | x := y, lActiveX := o:getData(), wvt_Keyboard( HB_K_RESIZE ) }
oXbp:selection := .F. oXbp:selection := .F.
oXbp:create( , , { -23, -1 }, { -1, -10 } ) oXbp:create( , , { -23, -1 }, { -1, -10 } )
oXbp:setColorFG( "R+" ) oXbp:setColorFG( "R+" )
oXbp:setColorBG( "W" ) oXbp:setColorBG( "W" )
oXbp:tooltipText := "Naviagate: http://hbide.vouch.info" oXbp:tooltipText := "Navigate: " + hb_Version( HB_VERSION_URL_BASE )
RETURN oXbp RETURN oXbp
STATIC FUNCTION BrwReposButtons( oCrt ) STATIC PROCEDURE BrwReposButtons( oCrt )
LOCAL oXbp, nOff, nTtl, nG, i LOCAL oXbp, nOff, nTtl, nG, i
LOCAL aW := { 10, 10, 10, 10, 10 } LOCAL aW := { 10, 10, 10, 10, 10 }
@@ -462,20 +471,20 @@ STATIC FUNCTION BrwReposButtons( oCrt )
ENDIF ENDIF
NEXT NEXT
RETURN NIL RETURN
STATIC FUNCTION BrwBuildButtons( oCrt, oBrw ) STATIC PROCEDURE BrwBuildButtons( oCrt, oBrw )
LOCAL oPB, nOff, nTtl, nG, i LOCAL oPB, nOff, nTtl, nG, i
LOCAL aPmt := { "Modal Window", "Maximize", "Go Top", "Go Bottom", "Right Most" } LOCAL aPmt := { "Modal Window", "Maximize", "Go Top", "Go Bottom", "Right Most" }
LOCAL aAct := { {|| Wvt_Keyboard( K_F3 ) }, ; LOCAL aAct := { {|| wvt_Keyboard( K_F3 ) }, ;
{|| Wvt_Keyboard( K_F4 ) }, ; {|| wvt_Keyboard( K_F4 ) }, ;
{|| oBrw:goTop(), oBrw:forceStable() }, ; {|| oBrw:goTop(), oBrw:forceStable() }, ;
{|| oBrw:goBottom(), oBrw:forceStable() }, ; {|| oBrw:goBottom(), oBrw:forceStable() }, ;
{|| oBrw:panEnd(), oBrw:forceStable() } } {|| oBrw:panEnd(), oBrw:forceStable() } }
LOCAL aW := { 10, 10, 10, 10, 10 } LOCAL aW := { 10, 10, 10, 10, 10 }
nG := 2 nG := 2
nTtl := 0 nTtl := 0
AEval( aW, {| e | nTtl += e } ) AEval( aW, {| e | nTtl += e } )
nTtl += ( Len( aW ) - 1 ) * nG nTtl += ( Len( aW ) - 1 ) * nG
@@ -501,25 +510,25 @@ STATIC FUNCTION BrwBuildButtons( oCrt, oBrw )
nOff += aW[ i ] + nG nOff += aW[ i ] + nG
NEXT NEXT
RETURN NIL RETURN
FUNCTION Vou_BrwAddScrollBars( oCrt, oBrw, oVBar, oHBar ) STATIC PROCEDURE Vou_BrwAddScrollBars( oCrt, oBrw, oVBar, oHBar )
oHBar := WvgScrollBar():new( oCrt, , { {|| -( oBrw:nBottom + 1 ) }, {|| -( oBrw:nLeft ) } }, ; oHBar := WvgScrollBar():new( oCrt, , { {|| -( oBrw:nBottom + 1 ) }, {|| -oBrw:nLeft } }, ;
{ -1, {|| -( oBrw:nRight - oBrw:nLeft + 1 ) } } ) { -1, {|| -( oBrw:nRight - oBrw:nLeft + 1 ) } } )
oHBar:range := { 1, oBrw:colCount } oHBar:range := { 1, oBrw:colCount }
oHBar:type := WVGSCROLL_HORIZONTAL oHBar:type := WVGSCROLL_HORIZONTAL
oHBar:create() oHBar:create()
oHBar:scroll := {| mp1 | oBrw:colPos := mp1[ 1 ], oBrw:refreshCurrent(), oBrw:forceStable() } oHBar:scroll := {| mp1 | oBrw:colPos := mp1[ 1 ], oBrw:refreshCurrent(), oBrw:forceStable() }
oVBar := WvgScrollBar():new( oCrt, , { {|| -( oBrw:nTop ) }, {|| -( oBrw:nRight + 1 ) } }, ; oVBar := WvgScrollBar():new( oCrt, , { {|| -oBrw:nTop }, {|| -( oBrw:nRight + 1 ) } }, ;
{ {|| -( oBrw:nBottom - oBrw:nTop + 1 ) }, {|| -2 } } ) { {|| -( oBrw:nBottom - oBrw:nTop + 1 ) }, {|| -2 } } )
oVBar:range := { 1, LastRec() } oVBar:range := { 1, LastRec() }
oVBar:type := WVGSCROLL_VERTICAL oVBar:type := WVGSCROLL_VERTICAL
oVBar:create() oVBar:create()
oVBar:scroll := {| mp1 | Vou_BrwSetVScroll( mp1, oBrw ) } oVBar:scroll := {| mp1 | Vou_BrwSetVScroll( mp1, oBrw ) }
RETURN NIL RETURN
STATIC FUNCTION BrwBuildMenu( oCrt ) STATIC FUNCTION BrwBuildMenu( oCrt )
@@ -673,7 +682,7 @@ STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd )
RETURN lRet RETURN lRet
FUNCTION Vou_NavigateToCell( oBrowse ) STATIC FUNCTION Vou_NavigateToCell( oBrowse )
LOCAL nCount LOCAL nCount
@@ -686,23 +695,23 @@ FUNCTION Vou_NavigateToCell( oBrowse )
nCount := oBrowse:mRowPos - oBrowse:RowPos nCount := oBrowse:mRowPos - oBrowse:RowPos
DispBegin() DispBegin()
WHILE nCount < 0 DO WHILE nCount < 0
nCount++ nCount++
oBrowse:Up() oBrowse:Up()
ENDDO ENDDO
WHILE nCount > 0 DO WHILE nCount > 0
nCount -- nCount--
oBrowse:Down() oBrowse:Down()
ENDDO ENDDO
nCount := oBrowse:mColPos - oBrowse:ColPos nCount := oBrowse:mColPos - oBrowse:ColPos
WHILE nCount < 0 DO WHILE nCount < 0
nCount++ nCount++
oBrowse:Left() oBrowse:Left()
ENDDO ENDDO
WHILE nCount > 0 DO WHILE nCount > 0
nCount-- nCount--
oBrowse:Right() oBrowse:Right()
ENDDO ENDDO
@@ -733,7 +742,7 @@ STATIC FUNCTION DbSkipBlock( n )
ENDDO ENDDO
ENDIF ENDIF
RETURN nSkipped RETURN nSkipped
STATIC FUNCTION TBNext() STATIC FUNCTION TBNext()
@@ -743,7 +752,7 @@ STATIC FUNCTION TBNext()
IF Eof() IF Eof()
lMoved := .F. lMoved := .F.
ELSE ELSE
dbSkip( 1 ) dbSkip()
IF Eof() IF Eof()
lMoved := .F. lMoved := .F.
dbGoto( nSaveRecNum ) dbGoto( nSaveRecNum )
@@ -770,28 +779,28 @@ STATIC FUNCTION VouBlockField( i )
RETURN {|| FieldGet( i ) } RETURN {|| FieldGet( i ) }
STATIC FUNCTION Vou_ExecTBarAction( oBtn ) STATIC PROCEDURE Vou_ExecTBarAction( oBtn )
SWITCH oBtn:caption SWITCH oBtn:caption
CASE "New" CASE "New"
Wvt_Keyboard( K_DOWN ); EXIT wvt_Keyboard( K_DOWN ); EXIT
CASE "Select" CASE "Select"
Wvt_Keyboard( K_UP ); EXIT wvt_Keyboard( K_UP ); EXIT
CASE "Calendar" CASE "Calendar"
Wvt_Keyboard( K_RIGHT ); EXIT wvt_Keyboard( K_RIGHT ); EXIT
CASE "Tools" CASE "Tools"
Wvt_Keyboard( K_LEFT ); EXIT wvt_Keyboard( K_LEFT ); EXIT
CASE "Index" CASE "Index"
Wvt_Keyboard( K_PGDN ); EXIT wvt_Keyboard( K_PGDN ); EXIT
CASE "Show" CASE "Show"
Wvt_Keyboard( K_PGUP ); EXIT wvt_Keyboard( K_PGUP ); EXIT
CASE "Hide" CASE "Hide"
Wvt_Keyboard( K_CTRL_HOME ); EXIT wvt_Keyboard( K_CTRL_HOME ); EXIT
ENDSWITCH ENDSWITCH
RETURN NIL RETURN
FUNCTION Vou_BrwSetVScroll( mp1, oBrowse ) STATIC PROCEDURE Vou_BrwSetVScroll( mp1, oBrowse )
SWITCH mp1[ 2 ] SWITCH mp1[ 2 ]
@@ -830,7 +839,7 @@ FUNCTION Vou_BrwSetVScroll( mp1, oBrowse )
oBrowse:forceStable() oBrowse:forceStable()
RETURN NIL RETURN
/* For brosers inside WvtDialog() */ /* For brosers inside WvtDialog() */

View File

@@ -1,6 +1,4 @@
/* /* Pritpal Bedi <bedipritpal@hotmail.com> */
* Pritpal Bedi <bedipritpal@hotmail.com>
*/
#include "inkey.ch" #include "inkey.ch"
#include "hbgtinfo.ch" #include "hbgtinfo.ch"
@@ -35,18 +33,18 @@
THREAD STATIC t_keys_ := {, , , , , , , , , , , , , , , , , , , } THREAD STATIC t_keys_ := {, , , , , , , , , , , , , , , , , , , }
THREAD STATIC t_pic_ := {, , , , , , , , , , , , , , , , , , , } THREAD STATIC t_pic_ := {, , , , , , , , , , , , , , , , , , , }
FUNCTION WvtSetKeys( lSet ) PROCEDURE WvtSetKeys( lSet )
IF lSet IF lSet
t_keys_[ 2 ] := SetKey( K_F2, {|| WvtNextGets() } ) t_keys_[ 2 ] := SetKey( K_F2, {|| WvtNextGets() } )
t_keys_[ 3 ] := SetKey( K_F3, {|| WvtWindowExpand( 1 ) } ) t_keys_[ 3 ] := SetKey( K_F3, {|| WvtWindowExpand( 1 ) } )
t_keys_[ 4 ] := SetKey( K_F4, {|| WvtWindowExpand( -1 ) } ) t_keys_[ 4 ] := SetKey( K_F4, {|| WvtWindowExpand( -1 ) } )
t_keys_[ 5 ] := SetKey( K_F5, {|| WvtMyBrowse() } ) t_keys_[ 5 ] := SetKey( K_F5, {|| WvtMyBrowse() } )
t_keys_[ 6 ] := SetKey( K_F6, {|| Wvt_Minimize() } ) t_keys_[ 6 ] := SetKey( K_F6, {|| wvt_Minimize() } )
t_keys_[ 7 ] := SetKey( K_F7, {|| WvtPartialScreen() } ) t_keys_[ 7 ] := SetKey( K_F7, {|| WvtPartialScreen() } )
t_keys_[ 8 ] := SetKey( K_F8, {|| WvtLines() } ) t_keys_[ 8 ] := SetKey( K_F8, {|| WvtLines() } )
t_keys_[ 9 ] := SetKey( K_F9, {|| Wvt_ChooseFont() } ) t_keys_[ 9 ] := SetKey( K_F9, {|| wvt_ChooseFont() } )
t_keys_[ 10 ] := SetKey( K_F10, {|| Wvt_ChooseColor() } ) t_keys_[ 10 ] := SetKey( K_F10, {|| wvt_ChooseColor() } )
ELSE ELSE
SetKey( K_F2, t_keys_[ 2 ] ) SetKey( K_F2, t_keys_[ 2 ] )
SetKey( K_F3, t_keys_[ 3 ] ) SetKey( K_F3, t_keys_[ 3 ] )
@@ -59,12 +57,12 @@ FUNCTION WvtSetKeys( lSet )
SetKey( K_F10, t_keys_[ 10 ] ) SetKey( K_F10, t_keys_[ 10 ] )
ENDIF ENDIF
RETURN NIL RETURN
// Wvt_Paint() must be a FUNCTION in your application // wvt_Paint() must be a FUNCTION in your application
// as it is called when Window gets WM_PAINT message. // as it is called when Window gets WIN_WM_PAINT message.
FUNCTION Wvt_Paint() FUNCTION wvt_Paint() /* must be a public function */
LOCAL aBlocks := WvtSetBlocks() LOCAL aBlocks := WvtSetBlocks()
@@ -74,13 +72,13 @@ FUNCTION Wvt_Paint()
RETURN 0 RETURN 0
// Wvt_SetFocus() must be a FUNCTION in your application // wvt_SetFocus() must be a FUNCTION in your application
// needs to process messages sent through WM_SETFOCUS message // needs to process messages sent through WM_SETFOCUS message
// received by the window. // received by the window.
#if 0 #if 0
FUNCTION Wvt_SetFocus() PROCEDURE wvt_SetFocus() /* must be a public function */
LOCAL nRow := Row() LOCAL nRow := Row()
LOCAL nCol := Col() LOCAL nCol := Col()
@@ -89,17 +87,17 @@ FUNCTION Wvt_SetFocus()
DevPos( nRow, nCol ) DevPos( nRow, nCol )
RETURN NIL RETURN
#endif #endif
// Wvt_KillFocus() must be a FUNCTION in your application // wvt_KillFocus() must be a FUNCTION in your application
// needs to process messages sent through WM_KILLFOCUS message // needs to process messages sent through WM_KILLFOCUS message
// received by the window. // received by the window.
#if 0 #if 0
FUNCTION Wvt_KillFocus() PROCEDURE wvt_KillFocus() /* must be a public function */
LOCAL nRow := Row() LOCAL nRow := Row()
LOCAL nCol := Col() LOCAL nCol := Col()
@@ -108,11 +106,11 @@ FUNCTION Wvt_KillFocus()
DevPos( nRow, nCol ) DevPos( nRow, nCol )
RETURN NIL RETURN
#endif #endif
// Wvt_Mouse() must be present if you want to catch and fire // wvt_Mouse() must be present if you want to catch and fire
// mouse call back outside of the Inkey() loop. // mouse call back outside of the Inkey() loop.
FUNCTION Wvt_Mouse( nKey, nRow, nCol ) FUNCTION Wvt_Mouse( nKey, nRow, nCol )
@@ -134,15 +132,15 @@ FUNCTION Wvt_Mouse( nKey, nRow, nCol )
IF nKey == -1000001 IF nKey == -1000001
FOR nObj := 1 TO nLen FOR nObj := 1 TO nLen
DO CASE DO CASE
CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_DISP CASE aObjects[ nObj ][ WVT_OBJ_STATE ] == OBJ_STATE_DISP
Eval( aObjects[ nObj, WVT_OBJ_ONDISP ] ) Eval( aObjects[ nObj ][ WVT_OBJ_ONDISP ] )
CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_MOUSEOVER CASE aObjects[ nObj ][ WVT_OBJ_STATE ] == OBJ_STATE_MOUSEOVER
Eval( aObjects[ nObj, WVT_OBJ_ONMOUSEOVER ] ) Eval( aObjects[ nObj ][ WVT_OBJ_ONMOUSEOVER ] )
CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_BUTTONDOWN CASE aObjects[ nObj ][ WVT_OBJ_STATE ] == OBJ_STATE_BUTTONDOWN
Eval( aObjects[ nObj, WVT_OBJ_ONBUTTONDOWN ] ) Eval( aObjects[ nObj ][ WVT_OBJ_ONBUTTONDOWN ] )
CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_BUTTONUP CASE aObjects[ nObj ][ WVT_OBJ_STATE ] == OBJ_STATE_BUTTONUP
Eval( aObjects[ nObj, WVT_OBJ_ONDISP ] ) Eval( aObjects[ nObj ][ WVT_OBJ_ONDISP ] )
CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_HIDE CASE aObjects[ nObj ][ WVT_OBJ_STATE ] == OBJ_STATE_HIDE
ENDCASE ENDCASE
NEXT NEXT
@@ -155,8 +153,8 @@ FUNCTION Wvt_Mouse( nKey, nRow, nCol )
e_[ WVT_OBJ_COLTO ] >= nCol } ) e_[ WVT_OBJ_COLTO ] >= nCol } )
IF nObj == 0 IF nObj == 0
IF s_nLastObj > 0 IF s_nLastObj > 0
aObjects[ s_nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_DISP aObjects[ s_nLastObj ][ WVT_OBJ_STATE ] := OBJ_STATE_DISP
Eval( aObjects[ s_nLastObj, WVT_OBJ_ONDISP ] ) Eval( aObjects[ s_nLastObj ][ WVT_OBJ_ONDISP ] )
s_nLastObj := 0 s_nLastObj := 0
ENDIF ENDIF
RETURN NIL RETURN NIL
@@ -171,23 +169,23 @@ FUNCTION Wvt_Mouse( nKey, nRow, nCol )
DO CASE DO CASE
CASE nKey == K_MOUSEMOVE CASE nKey == K_MOUSEMOVE
IF aObjects[ s_nLastObj, WVT_OBJ_STATE ] != OBJ_STATE_MOUSEOVER IF aObjects[ s_nLastObj ][ WVT_OBJ_STATE ] != OBJ_STATE_MOUSEOVER
aObjects[ s_nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_MOUSEOVER aObjects[ s_nLastObj ][ WVT_OBJ_STATE ] := OBJ_STATE_MOUSEOVER
IF aObjects[ nObj, WVT_OBJ_ONMOUSEOVER ] != NIL IF aObjects[ nObj ][ WVT_OBJ_ONMOUSEOVER ] != NIL
Eval( aObjects[ nObj, WVT_OBJ_ONMOUSEOVER ] ) Eval( aObjects[ nObj ][ WVT_OBJ_ONMOUSEOVER ] )
ENDIF ENDIF
ENDIF ENDIF
CASE nKey == K_LBUTTONDOWN CASE nKey == K_LBUTTONDOWN
aObjects[ s_nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_BUTTONDOWN aObjects[ s_nLastObj ][ WVT_OBJ_STATE ] := OBJ_STATE_BUTTONDOWN
IF aObjects[ nObj, WVT_OBJ_ONBUTTONDOWN ] != NIL IF aObjects[ nObj ][ WVT_OBJ_ONBUTTONDOWN ] != NIL
Eval( aObjects[ nObj, WVT_OBJ_ONBUTTONDOWN ] ) Eval( aObjects[ nObj ][ WVT_OBJ_ONBUTTONDOWN ] )
ENDIF ENDIF
CASE nKey == K_LBUTTONUP CASE nKey == K_LBUTTONUP
aObjects[ s_nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_DISP aObjects[ s_nLastObj ][ WVT_OBJ_STATE ] := OBJ_STATE_DISP
IF aObjects[ nObj, WVT_OBJ_ONBUTTONUP ] != NIL IF aObjects[ nObj ][ WVT_OBJ_ONBUTTONUP ] != NIL
Eval( aObjects[ nObj, WVT_OBJ_ONBUTTONUP ] ) Eval( aObjects[ nObj ][ WVT_OBJ_ONBUTTONUP ] )
ENDIF ENDIF
ENDCASE ENDCASE
@@ -256,7 +254,7 @@ FUNCTION WvtWindowExpand( nUnits )
s_nUnits += nUnits s_nUnits += nUnits
Wvt_SetFont( "Courier New", s_nUnits ) wvt_SetFont( "Courier New", s_nUnits )
RETURN .T. RETURN .T.
@@ -284,12 +282,14 @@ FUNCTION Hb_Clear()
FUNCTION MyMenuProcedure( nID ) FUNCTION MyMenuProcedure( nID )
DO CASE SWITCH nID
CASE nID == 101 CASE 101
Alert( "Procedure 101" ) Alert( "Procedure 101" )
CASE nID == 102 EXIT
CASE 102
Alert( "Procedure 102" ) Alert( "Procedure 102" )
ENDCASE EXIT
ENDSWITCH
RETURN .T. RETURN .T.
@@ -363,13 +363,13 @@ FUNCTION SetIcons( hIcon )
FUNCTION Popups( nID, lDestroy ) FUNCTION Popups( nID, lDestroy )
THREAD STATIC t_hPop_ := { , , , , , , , , }
LOCAL hPop, hPop1 LOCAL hPop, hPop1
LOCAL nPrompt := MF_ENABLED + MF_STRING LOCAL nPrompt := MF_ENABLED + MF_STRING
THREAD STATIC t_hPop_ := { , , , , , , , , }
IF nID == NIL IF nID == NIL
Wvt_SetPopupMenu() wvt_SetPopupMenu()
RETURN NIL RETURN NIL
ENDIF ENDIF
@@ -428,11 +428,11 @@ FUNCTION Popups( nID, lDestroy )
t_hPop_[ nID ] := hPop t_hPop_[ nID ] := hPop
RETURN Wvt_SetPopupMenu( t_hPop_[ nID ] ) RETURN wvt_SetPopupMenu( t_hPop_[ nID ] )
FUNCTION DispStatusMsg( cMsg ) FUNCTION DispStatusMsg( cMsg )
Wvt_DrawLabel( MaxRow(), 60, cMsg, 6, , 0, RGB( 198, 198, 198 ), "Arial", 18, , 900 ) wvt_DrawLabel( MaxRow(), 60, cMsg, 6, , 0, RGB( 198, 198, 198 ), "Arial", 18, , 900 )
RETURN .T. RETURN .T.
@@ -447,31 +447,30 @@ FUNCTION ClearStatusMsg()
RETURN .T. RETURN .T.
FUNCTION WvtPictures( nSlot, cFilePic ) PROCEDURE WvtPictures( nSlot, cFilePic )
IF nSlot != NIL .AND. nSlot <= 20 .AND. hb_FileExists( cFilePic ) IF nSlot != NIL .AND. nSlot <= 20 .AND. hb_FileExists( cFilePic )
IF !( t_pic_[ nSlot ] == cFilePic ) IF !( t_pic_[ nSlot ] == cFilePic )
IF Wvt_LoadPicture( cFilePic, nSlot ) IF wvt_LoadPicture( cFilePic, nSlot )
t_pic_[ nSlot ] := cFilePic t_pic_[ nSlot ] := cFilePic
ENDIF ENDIF
ENDIF ENDIF
ENDIF ENDIF
RETURN NIL RETURN
FUNCTION WvtExePicture( nTop, nLeft, nBottom, nRight, nSlot, aOffset ) PROCEDURE WvtExePicture( nTop, nLeft, nBottom, nRight, nSlot, aOffset )
IF t_pic_[ nSlot ] != NIL IF t_pic_[ nSlot ] != NIL
Wvt_DrawPicture( nTop, nLeft, nBottom, nRight, nSlot, aOffSet ) wvt_DrawPicture( nTop, nLeft, nBottom, nRight, nSlot, aOffSet )
ENDIF ENDIF
RETURN NIL RETURN
FUNCTION GetResource( cName ) FUNCTION GetResource( cName )
RETURN hb_DirBase() + cName RETURN hb_DirBase() + cName
FUNCTION uiDebug( ... ) PROCEDURE uiDebug( ... )
LOCAL aP := hb_AParams() LOCAL aP := hb_AParams()
LOCAL s := "" LOCAL s := ""
@@ -480,9 +479,9 @@ FUNCTION uiDebug( ... )
wapi_OutputDebugString( s ) wapi_OutputDebugString( s )
RETURN NIL RETURN
FUNCTION MyError( oError ) PROCEDURE MyError( oError )
? oError:description ? oError:description
? oError:operation ? oError:operation
@@ -494,4 +493,4 @@ FUNCTION MyError( oError )
DO WHILE Inkey() != K_ESC DO WHILE Inkey() != K_ESC
ENDDO ENDDO
RETURN NIL RETURN

View File

@@ -1,17 +1,16 @@
/* /* Wvt*Classes Demonstration
* Wvt*Classes Demonstration
* *
* This protocol can be clubbed with pure console implementation * This protocol can be clubbed with pure console implementation
* AND can be called IN a separate thread as well as modal TO * and can be called in a separate thread as well as modal to
* current window. * current window.
* *
* Pritpal Bedi <bedipritpal@hotmail.com> * Pritpal Bedi <bedipritpal@hotmail.com>
*/ */
#include "inkey.ch" #include "inkey.ch"
#include "hbgtinfo.ch" #include "hbgtinfo.ch"
FUNCTION DialogWvgClassesOne( nMode ) PROCEDURE DialogWvgClassesOne( nMode )
LOCAL bBlock LOCAL bBlock
@@ -34,9 +33,9 @@ FUNCTION DialogWvgClassesOne( nMode )
MyDialogOne() MyDialogOne()
ENDIF ENDIF
RETURN NIL RETURN
STATIC FUNCTION MyDialogOne( oCrt ) STATIC PROCEDURE MyDialogOne( oCrt )
LOCAL aObjects := WvtSetBlocks( {} ) LOCAL aObjects := WvtSetBlocks( {} )
LOCAL nWinRows, nWinCols, cWinTitle, cFont, nHeight LOCAL nWinRows, nWinCols, cWinTitle, cFont, nHeight
@@ -53,7 +52,7 @@ STATIC FUNCTION MyDialogOne( oCrt )
WvtSetKeys( .F. ) WvtSetKeys( .F. )
lChkMouse := SetMouseCheck( .F. ) lChkMouse := SetMouseCheck( .F. )
hPopup := Wvt_SetPopupMenu() hPopup := wvt_SetPopupMenu()
Popups() Popups()
cTxt := "GTWVG is capable of designing virtually any preceivable control " cTxt := "GTWVG is capable of designing virtually any preceivable control "
@@ -73,7 +72,7 @@ STATIC FUNCTION MyDialogOne( oCrt )
AAdd( aImg_, GetResource( "v_notes1.bmp" ) ) AAdd( aImg_, GetResource( "v_notes1.bmp" ) )
AAdd( aImg_, GetResource( "v_selct1.bmp" ) ) AAdd( aImg_, GetResource( "v_selct1.bmp" ) )
? "." ? "."
Wvt_ShowWindow( 1 ) wvt_ShowWindow( 1 )
nWinRows := 55 nWinRows := 55
nWinCols := 185 nWinCols := 185
cWinTitle := "WvtGui Dialog One" cWinTitle := "WvtGui Dialog One"
@@ -141,7 +140,7 @@ STATIC FUNCTION MyDialogOne( oCrt )
oBtn := WvtPushButton():New( oDlg, 124, 6, 129, 7, 137 ) oBtn := WvtPushButton():New( oDlg, 124, 6, 129, 7, 137 )
oBtn:cCaption := "Print" oBtn:cCaption := "Print"
oBtn:bOnLeftUp := {|| Wvt_Keyboard( 379 ) } oBtn:bOnLeftUp := {|| wvt_Keyboard( 379 ) }
oBtn:Tooltip := "Open Printing Dialog for the Browser in Focus" oBtn:Tooltip := "Open Printing Dialog for the Browser in Focus"
oDlg:AddObject( oBtn ) oDlg:AddObject( oBtn )
@@ -183,7 +182,7 @@ STATIC FUNCTION MyDialogOne( oCrt )
oGet:AddGets( 12, nGetCol, "GTWvt ", "@! ", "W+/B*,N/W*" ) oGet:AddGets( 12, nGetCol, "GTWvt ", "@! ", "W+/B*,N/W*" )
oGet:AddGets( 14, nGetCol, Date() ) oGet:AddGets( 14, nGetCol, Date() )
oGet:AddGets( 16, nGetCol, 2122.57, "@Z 99999999.99", "w+/R,GR+/B" ) oGet:AddGets( 16, nGetCol, 2122.57, "@Z 99999999.99", "w+/R,GR+/B" )
oGet:Tooltip := "WvtGets():New() - ReadModal() like Clipper" oGet:Tooltip := "WvtGets():New() - ReadModal() like Cl*pper"
oGet:cDesc := "Normal Get Box" oGet:cDesc := "Normal Get Box"
oGet:bOnCreate := bBlock oGet:bOnCreate := bBlock
oDlg:AddObject( oGet ) oDlg:AddObject( oGet )
@@ -282,7 +281,7 @@ STATIC FUNCTION MyDialogOne( oCrt )
oMenu:Caption := "Other Dialogs" oMenu:Caption := "Other Dialogs"
oMenu:AddItem( "Dialog Two", {|| DialogWvgClassesTwo() } ) oMenu:AddItem( "Dialog Two", {|| DialogWvgClassesTwo() } )
oMenu:AddItem( "-" ) oMenu:AddItem( "-" )
oMenu:AddItem( "Exit", {|| Wvt_Keyboard( K_ESC ) } ) oMenu:AddItem( "Exit", {|| wvt_Keyboard( K_ESC ) } )
g_oMenuBar:addItem( "", oMenu ) g_oMenuBar:addItem( "", oMenu )
oDlg:oMenu := g_oMenuBar oDlg:oMenu := g_oMenuBar
@@ -322,12 +321,12 @@ STATIC FUNCTION MyDialogOne( oCrt )
WvtSetBlocks( aObjects ) WvtSetBlocks( aObjects )
WvtSetKeys( .T. ) WvtSetKeys( .T. )
Wvt_SetPopupMenu( hPopup ) wvt_SetPopupMenu( hPopup )
SetMouseCheck( lChkMouse ) SetMouseCheck( lChkMouse )
RETURN NIL RETURN
FUNCTION DialogWvgClassesTwo() PROCEDURE DialogWvgClassesTwo()
LOCAL aObjects := WvtSetBlocks( {} ) LOCAL aObjects := WvtSetBlocks( {} )
LOCAL oDlg := WvtDialog():New( 30, 90, "My Dialog Two" ) LOCAL oDlg := WvtDialog():New( 30, 90, "My Dialog Two" )
@@ -339,7 +338,7 @@ FUNCTION DialogWvgClassesTwo()
oMenu:Caption := "Miscellaneous" oMenu:Caption := "Miscellaneous"
oMenu:AddItem( "Progressbar", {|| ExeProgBar( oPBar, oPBar1, oPBar2, oPBar3, oPBar4 ) } ) oMenu:AddItem( "Progressbar", {|| ExeProgBar( oPBar, oPBar1, oPBar2, oPBar3, oPBar4 ) } )
oMenu:AddItem( "-" ) oMenu:AddItem( "-" )
oMenu:AddItem( "Exit", {|| Wvt_Keyboard( K_ESC ) } ) oMenu:AddItem( "Exit", {|| wvt_Keyboard( K_ESC ) } )
g_oMenuBar:addItem( "", oMenu ) g_oMenuBar:addItem( "", oMenu )
oDlg:oMenu := g_oMenuBar oDlg:oMenu := g_oMenuBar
@@ -385,9 +384,9 @@ FUNCTION DialogWvgClassesTwo()
WvtSetBlocks( aObjects ) WvtSetBlocks( aObjects )
RETURN NIL RETURN
STATIC FUNCTION ExeProgBar( oPBar, oPBar1, oPBar2, oPBar3, oPBar4 ) STATIC PROCEDURE ExeProgBar( oPBar, oPBar1, oPBar2, oPBar3, oPBar4 )
LOCAL i LOCAL i
@@ -411,9 +410,9 @@ STATIC FUNCTION ExeProgBar( oPBar, oPBar1, oPBar2, oPBar3, oPBar4 )
oPBar3:DeActivate() oPBar3:DeActivate()
oPBar4:DeActivate() oPBar4:DeActivate()
RETURN NIL RETURN
STATIC FUNCTION ExeProgressBar( oPBar, oPBar3 ) STATIC PROCEDURE ExeProgressBar( oPBar, oPBar3 )
LOCAL i LOCAL i
@@ -427,4 +426,4 @@ STATIC FUNCTION ExeProgressBar( oPBar, oPBar3 )
oPBar:DeActivate() oPBar:DeActivate()
oPBar3:DeActivate() oPBar3:DeActivate()
RETURN NIL RETURN

View File

@@ -1,19 +1,12 @@
/* /* Pritpal Bedi <bedipritpal@hotmail.com> */
* Pritpal Bedi <bedipritpal@hotmail.com>
*/
//
#include "inkey.ch" #include "inkey.ch"
#include "hbgtinfo.ch" #include "hbgtinfo.ch"
#include "hbver.ch"
#define MUSIC_WAITON {800, 1600} #define MUSIC_WAITON {800, 1600}
// PROCEDURE demoxbp()
// A Pure Xbase++ Implementation
//
FUNCTION demoxbp()
LOCAL oCrt, oTBar, oSBar, oStatic, oCom, oXbp, oTree, oItem1, oItem2 LOCAL oCrt, oTBar, oSBar, oStatic, oCom, oXbp, oTree, oItem1, oItem2
LOCAL oListBox, oCheck, oRadio, oStatic2, oMLE, oAddr LOCAL oListBox, oCheck, oRadio, oStatic2, oMLE, oAddr
@@ -22,7 +15,7 @@ FUNCTION demoxbp()
LOCAL aState := { "not selected", "selected", "undefined" } LOCAL aState := { "not selected", "selected", "undefined" }
LOCAL aParts := {} LOCAL aParts := {}
// --------------------------- Dialog -------------------------------\\ // --- Dialog ---
oCrt := WvgDialog():new( , , { 30, 30 }, { 900, 600 }, , .T. ) oCrt := WvgDialog():new( , , { 30, 30 }, { 900, 600 }, , .T. )
oCrt:closable := .T. oCrt:closable := .T.
oCrt:icon := GetResource( "vr_1.ico" ) oCrt:icon := GetResource( "vr_1.ico" )
@@ -38,9 +31,9 @@ FUNCTION demoxbp()
// --------------------------- ToolBar -----------------------------\\ // --------------------------- ToolBar -----------------------------\\
oTBar := ActiveXBuildToolBarXbp( oDA ) oTBar := ActiveXBuildToolBarXbp( oDA )
// --------------------------- StatusBar ---------------------------\\ // --- StatusBar ---
oSBar := WvgStatusBar():new( oCrt ):create( , , , , , .T. ) oSBar := WvgStatusBar():new( oCrt ):create( , , , , , .T. )
oSBar:panelClick := {| oPanel | Wvg_MessageBox( , oPanel:caption ) } oSBar:panelClick := {| oPanel | wvg_MessageBox( , oPanel:caption ) }
oPanel := oSBar:getItem( 1 ) oPanel := oSBar:getItem( 1 )
oPanel:caption := "My Root Panel" oPanel:caption := "My Root Panel"
oPanel1 := oSBar:addItem() oPanel1 := oSBar:addItem()
@@ -48,7 +41,7 @@ FUNCTION demoxbp()
oPanel2 := oSBar:addItem() oPanel2 := oSBar:addItem()
oPanel2:caption := "Click on any part!" oPanel2:caption := "Click on any part!"
// --------------------------- Static ------------------------------\\ // --- Static ---
oStatic := WvgStatic():new( oDA ) oStatic := WvgStatic():new( oDA )
oStatic:type := WVGSTATIC_TYPE_TEXT oStatic:type := WVGSTATIC_TYPE_TEXT
oStatic:options := WVGSTATIC_TEXT_CENTER oStatic:options := WVGSTATIC_TEXT_CENTER
@@ -58,47 +51,47 @@ FUNCTION demoxbp()
oTBar:currentSize()[ 2 ] - oSBar:currentSize()[ 2 ] - 4 }, , .T. ) oTBar:currentSize()[ 2 ] - oSBar:currentSize()[ 2 ] - 4 }, , .T. )
oStatic:setColorBG( RGB( 200, 200, 200 ) ) oStatic:setColorBG( RGB( 200, 200, 200 ) )
// --------------------------- ListBox -----------------------------\\ // --- ListBox ---
oListBox := WvgListBox():new() oListBox := WvgListBox():new()
oListBox:create( oStatic, , { 5, 55 }, { 107, 380 } ) oListBox:create( oStatic, , { 5, 55 }, { 107, 380 } )
oListBox:setColorFG( RGB( 218, 61, 34 ) ) oListBox:setColorFG( RGB( 218, 61, 34 ) )
// oListBox:setColorBG( RGB( 250,244,182 ) ) // oListBox:setColorBG( RGB( 250,244,182 ) )
AAdd( aParts, "XbpDialog" ) AAdd( aParts, "XbpDialog" )
AAdd( aParts, "XbpMenuBar" ) AAdd( aParts, "XbpMenuBar" )
AAdd( aParts, "XbpToolBar" ) AAdd( aParts, "XbpToolBar" )
AAdd( aParts, "XbpToolBarButton" ) AAdd( aParts, "XbpToolBarButton" )
AAdd( aParts, "XbpStatusBar" ) AAdd( aParts, "XbpStatusBar" )
AAdd( aParts, "XbpStatic" ) AAdd( aParts, "XbpStatic" )
AAdd( aParts, "XbpTreeView" ) AAdd( aParts, "XbpTreeView" )
AAdd( aParts, "XbpTreeViewItem" ) AAdd( aParts, "XbpTreeViewItem" )
AAdd( aParts, "XbpActiveXControl" ) AAdd( aParts, "XbpActiveXControl" )
AAdd( aParts, "XbpListBox" ) AAdd( aParts, "XbpListBox" )
AAdd( aParts, "XbpPushButton" ) AAdd( aParts, "XbpPushButton" )
AAdd( aParts, "XbpCheckBox" ) AAdd( aParts, "XbpCheckBox" )
AAdd( aParts, "XbpRadioButton" ) AAdd( aParts, "XbpRadioButton" )
AAdd( aParts, "Xbp3State" ) AAdd( aParts, "Xbp3State" )
AAdd( aParts, "XbpSLE" ) AAdd( aParts, "XbpSLE" )
AAdd( aParts, "XbpMLE" ) AAdd( aParts, "XbpMLE" )
AAdd( aParts, "XbpHTMLViewer" ) AAdd( aParts, "XbpHTMLViewer" )
AAdd( aParts, "XbpSysWindow" ) AAdd( aParts, "XbpSysWindow" )
AAdd( aParts, "XbpFontDialog" ) AAdd( aParts, "XbpFontDialog" )
AAdd( aParts, "XbpFont" ) AAdd( aParts, "XbpFont" )
AAdd( aParts, "-------------" ) AAdd( aParts, "-------------" )
AAdd( aParts, "DataRef" ) AAdd( aParts, "DataRef" )
AEval( aParts, {| e | oListBox:addItem( e ) } ) AEval( aParts, {| e | oListBox:addItem( e ) } )
oListBox:itemSelected := {|| Wvg_MessageBox( , oListBox:getCurItem() ) } oListBox:itemSelected := {|| wvg_MessageBox( , oListBox:getCurItem() ) }
oListBox:setData( 3 ) // show selected "XbpToolBar" oListBox:setData( 3 ) // show selected "XbpToolBar"
// --------------------------- PushButton --------------------------\\ // --- PushButton ---
oXbp := WvgPushButton():new( oStatic ) oXbp := WvgPushButton():new( oStatic )
oXbp:caption := "Hide" oXbp:caption := "Hide"
oXbp:create( , , { 20, 440 }, { 80, 30 } ) oXbp:create( , , { 20, 440 }, { 80, 30 } )
oXbp:activate := {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } oXbp:activate := {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) }
// --------------------------- TreeView ---------------------------\\ // --- TreeView ---
oTree := WvgTreeView():new( oDA, , { oCrt:currentSize()[ 1 ] - 160, oTBar:currentSize()[ 2 ] + 3 }, ; oTree := WvgTreeView():new( oDA, , { oCrt:currentSize()[ 1 ] - 160, oTBar:currentSize()[ 2 ] + 3 }, ;
{ 160, oCrt:currentSize()[ 2 ] - ; { 160, oCrt:currentSize()[ 2 ] - ;
@@ -109,7 +102,7 @@ FUNCTION demoxbp()
oTree:create() oTree:create()
oTree:setColorBG( RGB( 120, 15, 240 ) ) oTree:setColorBG( RGB( 120, 15, 240 ) )
oTree:setColorFG( RGB( 15, 240, 120 ) ) oTree:setColorFG( RGB( 15, 240, 120 ) )
oTree:itemSelected := {| oItem | iif( oItem != NIL, Wvg_MessageBox( , oItem:caption ), NIL ) } oTree:itemSelected := {| oItem | iif( oItem != NIL, wvg_MessageBox( , oItem:caption ), NIL ) }
oItem1 := oTree:rootItem:addItem( "First level A" ) oItem1 := oTree:rootItem:addItem( "First level A" )
@@ -135,20 +128,20 @@ FUNCTION demoxbp()
#if 0 #if 0
oCom := WvgActiveXControl():New( oDA, , { 0, 0 }, { 100, 100 }, , .T. ) oCom := WvgActiveXControl():New( oDA, , { 0, 0 }, { 100, 100 }, , .T. )
oCom:CLSID := "Shell.Explorer.2" oCom:CLSID := "Shell.Explorer.2"
oCom:mapEvent( 269, {|| QOut( " E X P L O R E R - 2 6 9" ) } ) oCom:mapEvent( 269, {|| QOut( "EXPLORER-269" ) } )
#else #else
oCom := WvgHtmlViewer():New( oDA, , { 0, 0 }, { 100, 100 }, , .T. ) oCom := WvgHtmlViewer():New( oDA, , { 0, 0 }, { 100, 100 }, , .T. )
oCom:beforeNavigate := {| cURL, x, oHTML | x := x, oHTML := oHTML, oPanel:caption := cURL } oCom:beforeNavigate := {| cURL, x, oHTML | x := x, oHTML := oHTML, oPanel:caption := cURL }
oCom:statusTextChange := {| cText | oPanel:caption := cText } oCom:statusTextChange := {| cText | oPanel:caption := cText }
oCom:mapEvent( 112, {|| oPanel:caption := " E X P L O R E R - 2 6 9" } ) oCom:mapEvent( 112, {|| oPanel:caption := "EXPLORER-269" } )
#endif #endif
oCom:create() oCom:create()
oCom:Navigate( "http://www.harbour.vouch.info" ) oCom:Navigate( hb_Version( HB_VERSION_URL_BASE ) )
oAddr := WvgSLE():new() oAddr := WvgSLE():new()
oAddr:bufferLength := 500 oAddr:bufferLength := 500
oAddr:border := .T. oAddr:border := .T.
cNavigate := "http://www.harbour.vouch.info" cNavigate := hb_Version( HB_VERSION_URL_BASE )
oAddr:dataLink := {| x | iif( x == NIL, cNavigate, cNavigate := x ) } oAddr:dataLink := {| x | iif( x == NIL, cNavigate, cNavigate := x ) }
oAddr:setColorFG( RGB( 0, 0, 255 ) ) oAddr:setColorFG( RGB( 0, 0, 255 ) )
oAddr:setColorBG( RGB( 0, 255, 255 ) ) oAddr:setColorBG( RGB( 0, 255, 255 ) )
@@ -156,48 +149,52 @@ FUNCTION demoxbp()
oAddr:setData() oAddr:setData()
oAddr:killInputFocus := {| m1, m2, oS | m1 := m1, m2 := m2, oS:getData(), oCom:navigate( cNavigate ) } oAddr:killInputFocus := {| m1, m2, oS | m1 := m1, m2 := m2, oS:getData(), oCom:navigate( cNavigate ) }
// ----------------- Panel : Static + Radio + Checkbox ----------\\ // --- Panel : Static + Radio + Checkbox ---
oStatic2 := WvgStatic():New( oDA, , { 150, 150 }, { 500, 310 }, , .F. ) oStatic2 := WvgStatic():New( oDA, , { 150, 150 }, { 500, 310 }, , .F. )
// oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME #if 0
oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME
#endif
oStatic2:exStyle += WS_EX_WINDOWEDGE oStatic2:exStyle += WS_EX_WINDOWEDGE
// oStatic2:options := WVGSTATIC_FRAMETHICK #if 0
oStatic2:options := WVGSTATIC_FRAMETHICK
#endif
oStatic2:create() oStatic2:create()
oStatic2:setColorBG( RGB( 175, 175, 175 ) ) oStatic2:setColorBG( RGB( 175, 175, 175 ) )
oXbp := WvgPushButton():new( oStatic2 ) oXbp := WvgPushButton():new( oStatic2 )
oXbp:caption := "Hide" oXbp:caption := "Hide"
oXbp:caption := "Hide" oXbp:caption := "Hide"
oXbp:create( , , { 430, 275 }, { 60, 25 } ) oXbp:create( , , { 430, 275 }, { 60, 25 } )
oXbp:activate := {|| oStatic2:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } oXbp:activate := {|| oStatic2:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) }
oRadio := WvgRadioButton():new( oStatic2, , { 10, 10 }, { 100, 15 } ) oRadio := WvgRadioButton():new( oStatic2, , { 10, 10 }, { 100, 15 } )
oRadio:caption := "Com 1" oRadio:caption := "Com 1"
oRadio:selection := .T. oRadio:selection := .T.
oRadio:selected := {| m1, m2, obj | m1 := m1, m2 := m2, Wvg_MessageBox( , obj:caption + iif( obj:selection, "< S >", "< N >" ) ) } oRadio:selected := {| m1, m2, obj | m1 := m1, m2 := m2, wvg_MessageBox( , obj:caption + iif( obj:selection, "< S >", "< N >" ) ) }
oRadio:create() oRadio:create()
oRadio := WvgRadioButton():new( oStatic2, , { 10, 35 }, { 100, 15 } ) oRadio := WvgRadioButton():new( oStatic2, , { 10, 35 }, { 100, 15 } )
oRadio:caption := "Com 2" oRadio:caption := "Com 2"
oRadio:create() oRadio:create()
oCheck := WvgCheckBox():New( oStatic2, , { 10, 70 }, { 100, 15 }, , .T. ) oCheck := WvgCheckBox():New( oStatic2, , { 10, 70 }, { 100, 15 }, , .T. )
oCheck:caption := "Checkbox A" oCheck:caption := "Checkbox A"
oCheck:create() oCheck:create()
oCheck:selected := {| m1, m2, o | m1 := m1, m2 := m2, Wvg_MessageBox( , iif( o:getData(), "I am selected", "I am not selected" ) ) } oCheck:selected := {| m1, m2, o | m1 := m1, m2 := m2, wvg_MessageBox( , iif( o:getData(), "I am selected", "I am not selected" ) ) }
// Create first 3State button, passing the position to :create() // Create first 3State button, passing the position to :create()
oXbp := Wvg3State():new() oXbp := Wvg3State():new()
oXbp:caption := "3 State A" oXbp:caption := "3 State A"
oXbp:create( oStatic2, , { 10, 100 }, { 100, 15 } ) oXbp:create( oStatic2, , { 10, 100 }, { 100, 15 } )
// Determine current state using mp1 // Determine current state using mp1
oXbp:selected := {| m1, m2, oBtn | m2 := m2, oBtn := oBtn, oPanel1:caption := "3State A [" + aState[ m1 + 1 ] + "]" } oXbp:selected := {| m1, m2, oBtn | m2 := m2, oBtn := oBtn, oPanel1:caption := "3State A [" + aState[ m1 + 1 ] + "]" }
// Create second 3State Button, passing the position to :new() // Create second 3State Button, passing the position to :new()
oXbp := Wvg3State():new( oStatic2, , { 10, 125 }, { 100, 15 } ) oXbp := Wvg3State():new( oStatic2, , { 10, 125 }, { 100, 15 } )
oXbp:caption := "3 State B" oXbp:caption := "3 State B"
oXbp:create( oStatic2 ) oXbp:create( oStatic2 )
// Determine current state using :getData() // Determine current state using :getData()
oXbp:selected := {| m1, m2, oBtn | m1 := m1, m2 := m2, Wvg_MessageBox( , "3State B", aState[ oBtn:getData() + 1 ] ) } oXbp:selected := {| m1, m2, oBtn | m1 := m1, m2 := m2, wvg_MessageBox( , "3State B", aState[ oBtn:getData() + 1 ] ) }
// Create first SLE, specify position using :create() // Create first SLE, specify position using :create()
// On :typeOut set the focus to the second SLE // On :typeOut set the focus to the second SLE
@@ -221,7 +218,7 @@ FUNCTION demoxbp()
oXbp:killInputFocus := {| x, y, oSLE | x := x, y := y, oSLE:getData(), oPanel:caption := "cVarB =" + cVarB } oXbp:killInputFocus := {| x, y, oSLE | x := x, y := y, oSLE:getData(), oPanel:caption := "cVarB =" + cVarB }
// Read file into LOCAL variable // Read file into LOCAL variable
cText := MemoRead( GetResource( "gtwvg.hbc" ) ) cText := hb_MemoRead( GetResource( __FILE__ ) )
// Create MLE, specify position using :create() and // Create MLE, specify position using :create() and
// assign data code block accessing LOCAL variable // assign data code block accessing LOCAL variable
oMLE := WvgMLE():new() oMLE := WvgMLE():new()
@@ -232,11 +229,11 @@ FUNCTION demoxbp()
// Copy text from LOCAL variable into edit buffer via :dataLink // Copy text from LOCAL variable into edit buffer via :dataLink
oMLE:setData() oMLE:setData()
// --------------------------- Misc Config ------------------------\\ // --- Misc Config ---
oTBar:buttonClick := {| oBtn | iif( oBtn:caption == "Hide", oStatic:hide(), NIL ), ; oTBar:buttonClick := {| oBtn | iif( oBtn:caption == "Hide", oStatic:hide(), NIL ), ;
iif( oBtn:caption == "Show", oStatic:show(), NIL ), ; iif( oBtn:caption == "Show", oStatic:show(), NIL ), ;
iif( oBtn:caption == "Tools", oStatic2:show():toFront(), NIL ), ; iif( oBtn:caption == "Tools", oStatic2:show():toFront(), NIL ), ;
iif( oBtn:caption == "FontDlg", ExeFontDialogXbp( oCrt ), NIL ), ; iif( oBtn:caption == "FontDlg", ExeFontDialog( oCrt ), NIL ), ;
iif( oBtn:caption $ "Hide,Show", oCrt:sendMessage( WM_SIZE, 0, 0 ), NIL ), ; iif( oBtn:caption $ "Hide,Show", oCrt:sendMessage( WM_SIZE, 0, 0 ), NIL ), ;
oPanel2:caption := "Button [ " + oBtn:caption + " ] clicked!" } oPanel2:caption := "Button [ " + oBtn:caption + " ] clicked!" }
@@ -253,7 +250,7 @@ FUNCTION demoxbp()
oCrt:Destroy() oCrt:Destroy()
RETURN NIL RETURN
STATIC FUNCTION ResizeDialogXbp( oCrt, oTBar, oSBar, oStatic, oCom, oTree, oAddr ) STATIC FUNCTION ResizeDialogXbp( oCrt, oTBar, oSBar, oStatic, oCom, oTree, oAddr )
@@ -316,7 +313,7 @@ STATIC FUNCTION ActiveXBuildMenuXbp( oCrt, oStatic, oStatic2 )
oStatic:hide(), oStatic:show() ), oCrt:sendMessage( WM_SIZE, 0, 0 ) } } ) oStatic:hide(), oStatic:show() ), oCrt:sendMessage( WM_SIZE, 0, 0 ) } } )
oSubMenu:addItem( { "~Show My Panel" , {|| oStatic2:show():toFront() } } ) oSubMenu:addItem( { "~Show My Panel" , {|| oStatic2:show():toFront() } } )
oSubMenu:addItem() oSubMenu:addItem()
oSubMenu:addItem( { "~Font Dialog" , {|| ExeFontDialogXbp( oCrt ) } } ) oSubMenu:addItem( { "~Font Dialog" , {|| ExeFontDialog( oCrt ) } } )
oMenuBar:addItem( { oSubMenu, NIL } ) oMenuBar:addItem( { oSubMenu, NIL } )
@@ -354,7 +351,7 @@ STATIC FUNCTION ActiveXBuildToolBarXbp( oCrt )
RETURN oTBar RETURN oTBar
STATIC FUNCTION MyFunctionXbp( nMode ) STATIC PROCEDURE MyFunctionXbp( nMode )
DO CASE DO CASE
CASE nMode == 1 CASE nMode == 1
@@ -366,7 +363,7 @@ STATIC FUNCTION MyFunctionXbp( nMode )
Tone( MUSIC_WAITON[ 1 ], 1 ) Tone( MUSIC_WAITON[ 1 ], 1 )
CASE nMode == 3 CASE nMode == 3
Wvg_MessageBox( , "Button clicked!" ) wvg_MessageBox( , "Button clicked!" )
CASE nMode == 101 // Charge CASE nMode == 101 // Charge
Eval( {|| Tone( 523, 2 ), Tone( 698, 2 ), Tone( 880, 2 ), Tone( 1046, 4 ), Tone( 880, 2 ), Tone( 1046, 8 ) } ) Eval( {|| Tone( 523, 2 ), Tone( 698, 2 ), Tone( 880, 2 ), Tone( 1046, 4 ), Tone( 880, 2 ), Tone( 1046, 8 ) } )
@@ -380,9 +377,9 @@ STATIC FUNCTION MyFunctionXbp( nMode )
ENDCASE ENDCASE
RETURN NIL RETURN
STATIC FUNCTION ExeFontDialogXbp( oCrt ) STATIC PROCEDURE ExeFontDialog( oCrt )
LOCAL oFontDlg LOCAL oFontDlg
@@ -397,17 +394,19 @@ STATIC FUNCTION ExeFontDialogXbp( oCrt )
oFontDlg:familyName := "Courier New" oFontDlg:familyName := "Courier New"
oFontDlg:strikeout := .T. oFontDlg:strikeout := .T.
oFontDlg:underscore := .F. oFontDlg:underscore := .F.
// oFontDlg:activateOk := {|| Wvg_MessageBox( , "activateOK Event Handelled in Windows!" ) } // oFontDlg:activateOk := {|| wvg_MessageBox( , "activateOK Event Handelled in Windows!" ) }
oFontDlg:nominalPointSize := 12 oFontDlg:nominalPointSize := 12
// oFontDlg:size := .F. #if 0
// oFontDlg:style := .F. oFontDlg:size := .F.
oFontDlg:style := .F.
#endif
oFontDlg:create() oFontDlg:create()
// Every 2nd FontDialog will be MODAL // Every 2nd FontDialog will be MODAL
oFontDlg:display( ++s_nMode % 2 ) oFontDlg:display( ++s_nMode % 2 )
oFontDlg:destroy() oFontDlg:destroy()
RETURN NIL RETURN

View File

@@ -1,25 +1,26 @@
/* /*
* GTWVT Console GUI Interface * GTWVT Console GUI Interface
* *
* Pritpal Bedi <pritpal@vouchcac.com> * Copyright (c) Pritpal Bedi <pritpal@vouchcac.com>
* *
* I have tried to simulate the gui controls through GDI * I have tried to simulate the GUI controls through GDI
* functions and found a way to refresh those controls * functions and found a way to refresh those controls
* through WM_PAINT message issued to the Window. * through WIN_WM_PAINT message issued to the Window.
* and * and
* I feel that IF this functionality is built * I feel that IF this functionality is built
* into the GT itself, what a wonder! * into the GT itself, what a wonder!
* *
* This protocol opens up the the distinct possibilities and hope * This protocol opens up the the distinct possibilities and hope
* you all will cooperate to enhance it further. * you all will cooperate to enhance it further.
* *
* Thanks Peter Rees! You have laid the foundation! * Thanks Peter Rees! You have laid the foundation!
*/ */
#require "gtwvg" #require "gtwvg"
#include "inkey.ch" #include "inkey.ch"
#include "hbgtinfo.ch" #include "hbgtinfo.ch"
#include "hbver.ch"
#include "wvgparts.ch" #include "wvgparts.ch"
REQUEST DBFCDX REQUEST DBFCDX
@@ -51,11 +52,11 @@ EXIT PROCEDURE CleanHandles()
LOCAL obj LOCAL obj
FOR EACH obj IN SetFonts() FOR EACH obj IN SetFonts()
Wvg_DeleteObject( obj ) wvg_DeleteObject( obj )
obj := NIL obj := NIL
NEXT NEXT
FOR EACH obj IN SetIcons() FOR EACH obj IN SetIcons()
Wvg_DeleteObject( obj ) wvg_DeleteObject( obj )
obj := NIL obj := NIL
NEXT NEXT
@@ -69,7 +70,7 @@ PROCEDURE Main()
LOCAL cName := PadR( "Pritpal Bedi", 35 ) LOCAL cName := PadR( "Pritpal Bedi", 35 )
LOCAL cAdd1 := PadR( "60, New Professor Colony", 35 ) LOCAL cAdd1 := PadR( "60, New Professor Colony", 35 )
LOCAL cAdd2 := PadR( "Ludhiana, INDIA", 35 ) LOCAL cAdd2 := PadR( "Ludhiana, INDIA", 35 )
LOCAL cAdd3 := PadR( "http://hbide.vouch.info", 35 ) LOCAL cAdd3 := PadR( hb_Version( HB_VERSION_URL_BASE ), 35 )
LOCAL nSlry := 20000 LOCAL nSlry := 20000
LOCAL aBlocks := {} LOCAL aBlocks := {}
LOCAL nColGet := 8 LOCAL nColGet := 8
@@ -91,56 +92,56 @@ PROCEDURE Main()
Set( _SET_EVENTMASK, INKEY_ALL + HB_INKEY_GTEVENT ) Set( _SET_EVENTMASK, INKEY_ALL + HB_INKEY_GTEVENT )
Wvt_SetGUI( .T. ) wvt_SetGUI( .T. )
WvtSetKeys( .T. ) WvtSetKeys( .T. )
Popups( 1 ) Popups( 1 )
Wvt_SetMouseMove( .T. ) wvt_SetMouseMove( .T. )
Wvt_SetFont( "Courier New", 18, 0, 0 ) wvt_SetFont( "Courier New", 18, 0, 0 )
CLS CLS
Wvt_ShowWindow( SW_RESTORE ) wvt_ShowWindow( SW_RESTORE )
/* Xbase++ compatible menu protocol */ /* Xbase++ compatible menu protocol */
oLastMenu := BuildMainMenu() oLastMenu := BuildMainMenu()
oLastMenu:disableItem( 11 ) oLastMenu:disableItem( 11 )
oLastMenu:checkItem( 1 ) oLastMenu:checkItem( 1 )
oLastMenu:insItem( 11, { "I am inserted later !", ; oLastMenu:insItem( 11, { "I am inserted later !", ;
{|| Wvg_MessageBox( , "Hi " + iif( oLastMenu:isItemChecked( 1 ), "Yes", "No" ) + ; {|| wvg_MessageBox( , "Hi " + iif( oLastMenu:isItemChecked( 1 ), "Yes", "No" ) + ;
iif( oLastMenu:isItemEnabled( 12 ), " Yes", " No" ) ) } } ) iif( oLastMenu:isItemEnabled( 12 ), " Yes", " No" ) ) } } )
oLastMenu:setItem( 14, { "This is Set Against Prev Menu", {|| Wvg_MessageBox( , "Hi" ) } } ) oLastMenu:setItem( 14, { "This is Set Against Prev Menu", {|| wvg_MessageBox( , "Hi" ) } } )
SetMode( MaxRow() + 1, MaxCol() + 1 ) /* Needed to accomodate attached menu */ SetMode( MaxRow() + 1, MaxCol() + 1 ) /* Needed to accommodate attached menu */
SetKey( K_F12 , {|| hb_gtInfo( HB_GTI_ACTIVATESELECTCOPY ) } ) SetKey( K_F12 , {|| hb_gtInfo( HB_GTI_ACTIVATESELECTCOPY ) } )
SetKey( K_CTRL_V , {|| __Keyboard( hb_gtInfo( HB_GTI_CLIPBOARDDATA ) ) } ) SetKey( K_CTRL_V , {|| __Keyboard( hb_gtInfo( HB_GTI_CLIPBOARDDATA ) ) } )
SetKey( K_RBUTTONDOWN, {|| __Keyboard( hb_gtInfo( HB_GTI_CLIPBOARDDATA ) ) } ) SetKey( K_RBUTTONDOWN, {|| __Keyboard( hb_gtInfo( HB_GTI_CLIPBOARDDATA ) ) } )
hPopup := Wvt_SetPopupMenu() hPopup := wvt_SetPopupMenu()
pGT := SetGT( 1, hb_gtSelect() ) pGT := SetGT( 1, hb_gtSelect() )
/* Force mouse pointer right below the Harbour label */ /* Force mouse pointer right below the Harbour label */
Wvt_SetMousePos( 2, 40 ) wvt_SetMousePos( 2, 40 )
AAdd( aBlocks, {|| Wvt_SetIcon( GetResource( "vr_1.ico" ) ) } ) AAdd( aBlocks, {|| wvt_SetIcon( GetResource( "vr_1.ico" ) ) } )
AAdd( aBlocks, {|| Wvt_SetTitle( "Vouch" ) } ) AAdd( aBlocks, {|| Wvt_SetTitle( "Vouch" ) } )
AAdd( aBlocks, {|| Wvt_DrawLabel( 1, 40, cLabel, 6,, RGB( 255, 255, 255 ), RGB( 198, 198, 198 ), "Arial", 26, , , , , .T., .T. ) } ) AAdd( aBlocks, {|| wvt_DrawLabel( 1, 40, cLabel, 6,, RGB( 255, 255, 255 ), RGB( 198, 198, 198 ), "Arial", 26, , , , , .T., .T. ) } )
AAdd( aBlocks, {|| Wvt_DrawBoxRaised( nTop, nLft, nBtm, nRgt ) } ) AAdd( aBlocks, {|| wvt_DrawBoxRaised( nTop, nLft, nBtm, nRgt ) } )
AAdd( aBlocks, {|| Wvt_DrawBoxRecessed( 7, 61, 13, 70 ) } ) AAdd( aBlocks, {|| wvt_DrawBoxRecessed( 7, 61, 13, 70 ) } )
AAdd( aBlocks, {|| Wvt_DrawBoxGroup( 15, 59, 18, 72 ) } ) AAdd( aBlocks, {|| wvt_DrawBoxGroup( 15, 59, 18, 72 ) } )
AAdd( aBlocks, {|| Wvt_DrawBoxGroup( 5, 6, 19, 44 ) } ) AAdd( aBlocks, {|| wvt_DrawBoxGroup( 5, 6, 19, 44 ) } )
AAdd( aBlocks, {|| Wvt_DrawImage( 8, 62, 12, 69, IMAGE_VOUCH, , .T. ) } ) AAdd( aBlocks, {|| wvt_DrawImage( 8, 62, 12, 69, IMAGE_VOUCH, , .T. ) } )
AAdd( aBlocks, {|| Wvt_DrawBoxRecessed( 7, 48, 13, 55 ) } ) AAdd( aBlocks, {|| wvt_DrawBoxRecessed( 7, 48, 13, 55 ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( MaxRow() - 2, 0, MaxRow() - 2, MaxCol(), WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_BOTTOM ) } ) AAdd( aBlocks, {|| wvt_DrawLine( MaxRow() - 2, 0, MaxRow() - 2, MaxCol(), WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_BOTTOM ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( MaxRow() - 1, 41, MaxRow(), 41, WVT_LINE_VERT, WVT_LINE_RECESSED, WVT_LINE_CENTER ) } ) AAdd( aBlocks, {|| wvt_DrawLine( MaxRow() - 1, 41, MaxRow(), 41, WVT_LINE_VERT, WVT_LINE_RECESSED, WVT_LINE_CENTER ) } )
AAdd( aBlocks, {|| AEval( GetList, {| oGet | Wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) } ) AAdd( aBlocks, {|| AEval( GetList, {| oGet | wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) } )
AAdd( aBlocks, {|| Wvt_Mouse( -1000001 ) } ) AAdd( aBlocks, {|| wvt_Mouse( -1000001 ) } )
aLastPaint := WvtSetBlocks( aBlocks ) aLastPaint := WvtSetBlocks( aBlocks )
/* XBase++ compatible pure GUI controls onto CUI console */ /* Xbase++ compatible pure GUI controls onto CUI console */
BuildButtons() BuildButtons()
scr := SaveScreen( 0, 0, MaxRow(), MaxCol() ) scr := SaveScreen( 0, 0, MaxRow(), MaxCol() )
@@ -155,8 +156,8 @@ PROCEDURE Main()
dDate := hb_SToD( "20040401" ) dDate := hb_SToD( "20040401" )
@ 7, nColGet GET dDate WHEN DispStatusMsg( "Date must be valid" ) VALID ClearStatusMsg() @ 7, nColGet GET dDate WHEN DispStatusMsg( "Date must be valid" ) VALID ClearStatusMsg()
@ 10, nColGet GET cName WHEN DispStatusMsg( "Must be one of the list!" ) VALID ( VouChoice() < 7 .AND. ClearStatusMsg() ) @ 10, nColGet GET cName WHEN DispStatusMsg( "Must be one of the list!" ) VALID VouChoice() < 7 .AND. ClearStatusMsg()
@ 13, nColGet GET cAdd1 @ 13, nColGet GET cAdd1
@ 15, nColGet GET cAdd2 @ 15, nColGet GET cAdd2
@ 17, nColGet GET cAdd3 @ 17, nColGet GET cAdd3
@@ -172,7 +173,7 @@ PROCEDURE Main()
SetColor( clr ) SetColor( clr )
RestScreen( 0, 0, MaxRow(), MaxCol(), scr ) RestScreen( 0, 0, MaxRow(), MaxCol(), scr )
WvtSetKeys( .F. ) WvtSetKeys( .F. )
Wvt_SetPopupMenu( hPopup ) wvt_SetPopupMenu( hPopup )
Popups( 1, .T. ) Popups( 1, .T. )
SetGT( 1, pGT ) SetGT( 1, pGT )
@@ -181,14 +182,14 @@ PROCEDURE Main()
RETURN RETURN
PROCEDURE WvtConsoleGets( nMode ) STATIC PROCEDURE WvtConsoleGets( nMode )
hb_default( @nMode, 0 ) hb_default( @nMode, 0 )
IF hb_mtvm() IF hb_mtvm()
hb_threadStart( {| oCrt | hb_gtReload( "WVT" ), ; hb_threadStart( {| oCrt | hb_gtReload( "WVT" ), ;
oCrt := hb_gtSelect(), ; oCrt := hb_gtSelect(), ;
iif( nMode == 0, WvtNextGetsConsole(), GoogleMap() ), ; iif( nMode == 0, WvtNextGetsConsole(), OnlineMap() ), ;
oCrt := NIL } ) oCrt := NIL } )
ENDIF ENDIF
@@ -196,14 +197,14 @@ PROCEDURE WvtConsoleGets( nMode )
PROCEDURE WvtNextGetsConsole() PROCEDURE WvtNextGetsConsole()
LOCAL dDate := hb_SToD() LOCAL dDate := hb_SToD()
LOCAL cName := Space( 35 ) LOCAL cName := Space( 35 )
LOCAL cAdd1 := Space( 35 ) LOCAL cAdd1 := Space( 35 )
LOCAL cAdd2 := Space( 35 ) LOCAL cAdd2 := Space( 35 )
LOCAL cAdd3 := Space( 35 ) LOCAL cAdd3 := Space( 35 )
LOCAL nSlry := 0 LOCAL nSlry := 0
LOCAL nColGet := 8 LOCAL nColGet := 8
LOCAL GetList := {} LOCAL GetList := {}
SetMode( 20, 51 ) SetMode( 20, 51 )
SetColor( "N/W,N/GR*,,,N/W*" ) SetColor( "N/W,N/GR*,,,N/W*" )
@@ -228,11 +229,11 @@ PROCEDURE WvtNextGetsConsole()
RETURN RETURN
PROCEDURE WvtNextGets() PROCEDURE WvtNextGets() /* must be a public function */
IF hb_mtvm() IF hb_mtvm()
hb_threadStart( {|| hb_gtReload( "WVG" ), Wvt_SetFont( "Terminal", 20 ), ; hb_threadStart( {|| hb_gtReload( "WVG" ), wvt_SetFont( "Terminal", 20 ), ;
hb_clear(), Wvt_ShowWindow( SW_RESTORE ), WvtNextGets_X() } ) hb_clear(), wvt_ShowWindow( SW_RESTORE ), WvtNextGets_X() } )
ELSE ELSE
WvtNextGets_X() WvtNextGets_X()
ENDIF ENDIF
@@ -257,32 +258,32 @@ PROCEDURE WvtNextGets_X()
LOCAL nRow := Row() LOCAL nRow := Row()
LOCAL nCol := Col() LOCAL nCol := Col()
LOCAL scr := SaveScreen( 0, 0, MaxRow(), MaxCol() ) LOCAL scr := SaveScreen( 0, 0, MaxRow(), MaxCol() )
LOCAL wvtScr := Wvt_SaveScreen( 0, 0, MaxRow(), MaxCol() ) LOCAL wvtScr := wvt_SaveScreen( 0, 0, MaxRow(), MaxCol() )
STATIC s_nPalletMultiplier := 0 STATIC s_nPalletMultiplier := 0
// Change the values of pallatte arbitrarily though yu can fine tune // Change the values of palette arbitrarly though you can fine-tune
// these values with realistic values. // these values with realistic values.
aNewPalette[ 8 ] := aNewPalette[ 8 ] + ( 100000 * ++s_nPalletMultiplier ) aNewPalette[ 8 ] := aNewPalette[ 8 ] + ( 100000 * ++s_nPalletMultiplier )
Wvt_SetPalette( aNewPalette ) Wvt_SetPalette( aNewPalette )
AAdd( aBlocks, {|| Wvt_SetTitle( "Wvt Gets 2nd Window with Different Palette" ) } ) AAdd( aBlocks, {|| Wvt_SetTitle( "Wvt Gets 2nd Window with Different Palette" ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( MaxRow() - 1, 0, MaxRow() - 1, MaxCol() ) } ) AAdd( aBlocks, {|| wvt_DrawLine( MaxRow() - 1, 0, MaxRow() - 1, MaxCol() ) } )
AAdd( aBlocks, {|| Wvt_SetBrush( 0, RGB( 32, 255, 100 ) ) } ) AAdd( aBlocks, {|| wvt_SetBrush( 0, RGB( 32, 255, 100 ) ) } )
AAdd( aBlocks, {|| Wvt_DrawEllipse( 6, 50, 10, 58 ) } ) AAdd( aBlocks, {|| wvt_DrawEllipse( 6, 50, 10, 58 ) } )
AAdd( aBlocks, {|| Wvt_SetBrush( 2, RGB( 255, 255, 100 ), 1 ) } ) AAdd( aBlocks, {|| wvt_SetBrush( 2, RGB( 255, 255, 100 ), 1 ) } )
AAdd( aBlocks, {|| Wvt_DrawRectangle( 11, 50, 13, 58 ) } ) AAdd( aBlocks, {|| wvt_DrawRectangle( 11, 50, 13, 58 ) } )
AAdd( aBlocks, {|| Wvt_DrawBoxGroupRaised( 5, 6, 19, 72 ) } ) AAdd( aBlocks, {|| wvt_DrawBoxGroupRaised( 5, 6, 19, 72 ) } )
AAdd( aBlocks, {|| AEval( GetList, {| oGet | Wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) } ) AAdd( aBlocks, {|| AEval( GetList, {| oGet | wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) } )
AAdd( aBlocks, {|| Wvt_DrawButton( 21, 6, 22, 9, "New", "vouch1.bmp" ) } ) AAdd( aBlocks, {|| wvt_DrawButton( 21, 6, 22, 9, "New", "vouch1.bmp" ) } )
AAdd( aBlocks, {|| Wvt_DrawButton( 21, 11, 22, 14, "Browse", "vouch1.bmp", 1, RGB( 255, 255, 255 ) ) } ) AAdd( aBlocks, {|| wvt_DrawButton( 21, 11, 22, 14, "Browse", "vouch1.bmp", 1, RGB( 255, 255, 255 ) ) } )
AAdd( aBlocks, {|| Wvt_DrawButton( 21, 16, 22, 19, , "vouch1.bmp" ) } ) AAdd( aBlocks, {|| wvt_DrawButton( 21, 16, 22, 19, , "vouch1.bmp" ) } )
AAdd( aBlocks, {|| Wvt_DrawButton( 21, 21, 22, 24, "Data",, 0, RGB( 100, 22, 241 ), RGB( 198, 198, 198 ) ) } ) AAdd( aBlocks, {|| wvt_DrawButton( 21, 21, 22, 24, "Data",, 0, RGB( 100, 22, 241 ), RGB( 198, 198, 198 ) ) } )
AAdd( aBlocks, {|| Wvt_DrawButton( 21, 26, 22, 29, "Flat", IMAGE_VR, 2 ) } ) AAdd( aBlocks, {|| wvt_DrawButton( 21, 26, 22, 29, "Flat", IMAGE_VR, 2 ) } )
AAdd( aBlocks, {|| Wvt_DrawButton( 21, 31, 22, 34, "Outline", IMAGE_VR, 3 ) } ) AAdd( aBlocks, {|| wvt_DrawButton( 21, 31, 22, 34, "Outline", IMAGE_VR, 3 ) } )
AAdd( aBlocks, {|| Wvt_DrawButton( 22, 36, 22, 41, "Data",, 0, RGB( 100, 22, 241 ), RGB( 198, 198, 198 ) ) } ) AAdd( aBlocks, {|| wvt_DrawButton( 22, 36, 22, 41, "Data",, 0, RGB( 100, 22, 241 ), RGB( 198, 198, 198 ) ) } )
aLastPaint := WvtSetBlocks( aBlocks ) aLastPaint := WvtSetBlocks( aBlocks )
@@ -312,54 +313,54 @@ PROCEDURE WvtNextGets_X()
SetColor( clr ) SetColor( clr )
RestScreen( 0, 0, MaxRow(), MaxCol(), scr ) RestScreen( 0, 0, MaxRow(), MaxCol(), scr )
Wvt_RestScreen( wvtScr ) wvt_RestScreen( wvtScr )
SetPos( nRow, nCol ) SetPos( nRow, nCol )
RETURN RETURN
FUNCTION WvtPartialScreen() PROCEDURE WvtPartialScreen() /* must be a public function */
LOCAL scr := SaveScreen( 7, 20, 15, 60 ) LOCAL scr := SaveScreen( 7, 20, 15, 60 )
LOCAL wvtScr := Wvt_SaveScreen( 0, 0, MaxRow(), MaxCol() ) LOCAL wvtScr := wvt_SaveScreen( 0, 0, MaxRow(), MaxCol() )
LOCAL wvtScr1 LOCAL wvtScr1
LOCAL aLastPaint LOCAL aLastPaint
LOCAL hPopup := Wvt_SetPopupMenu() LOCAL hPopup := wvt_SetPopupMenu()
aLastPaint := WvtSetBlocks( {} ) aLastPaint := WvtSetBlocks( {} )
hb_DispBox( 7, 20, 15, 60, " ", "W/GR*" ) hb_DispBox( 7, 20, 15, 60, " ", "W/GR*" )
@ 10, 25 SAY "Wvt_SaveScreen()" COLOR "N/GR*" @ 10, 25 SAY "wvt_SaveScreen()" COLOR "N/GR*"
@ 11, 25 SAY "Wvt_RestScreen()" COLOR "N/GR*" @ 11, 25 SAY "wvt_RestScreen()" COLOR "N/GR*"
@ 13, 25 SAY "Press Esc " COLOR "N/GR*" @ 13, 25 SAY "Press Esc " COLOR "N/GR*"
Wvt_DrawBoxRecessed( 8, 22, 14, 58 ) wvt_DrawBoxRecessed( 8, 22, 14, 58 )
wvtScr1 := Wvt_SaveScreen( 7, 20, 15, 60 ) wvtScr1 := wvt_SaveScreen( 7, 20, 15, 60 )
DO WHILE Inkey( 0 ) != K_ESC DO WHILE Inkey( 0 ) != K_ESC
ENDDO ENDDO
hb_DispBox( 7, 20, 15, 60, " ", "W/B*" ) hb_DispBox( 7, 20, 15, 60, " ", "W/B*" )
@ 10, 25 SAY "Wvt_SaveScreen()" COLOR "N/B*" @ 10, 25 SAY "wvt_SaveScreen()" COLOR "N/B*"
@ 11, 25 SAY "Wvt_RestScreen()" COLOR "N/B*" @ 11, 25 SAY "wvt_RestScreen()" COLOR "N/B*"
@ 13, 25 SAY "Press Esc " COLOR "N/B*" @ 13, 25 SAY "Press Esc " COLOR "N/B*"
Wvt_DrawBoxRecessed( 8, 22, 14, 58 ) wvt_DrawBoxRecessed( 8, 22, 14, 58 )
DO WHILE Inkey( 0 ) != K_ESC DO WHILE Inkey( 0 ) != K_ESC
ENDDO ENDDO
Wvt_RestScreen( 7, 20, 15, 60, wvtScr1 ) wvt_RestScreen( 7, 20, 15, 60, wvtScr1 )
DO WHILE Inkey( 0 ) != K_ESC DO WHILE Inkey( 0 ) != K_ESC
ENDDO ENDDO
RestScreen( 7, 20, 15, 60, scr ) RestScreen( 7, 20, 15, 60, scr )
Wvt_RestScreen( 0, 0, MaxRow(), MaxCol(), wvtScr ) wvt_RestScreen( 0, 0, MaxRow(), MaxCol(), wvtScr )
WvtSetBlocks( aLastPaint ) WvtSetBlocks( aLastPaint )
Wvt_SetPopupMenu( hPopup ) wvt_SetPopupMenu( hPopup )
RETURN NIL RETURN
FUNCTION WvtLines() PROCEDURE WvtLines() /* must be a public function */
LOCAL scr := SaveScreen( 0, 0, MaxRow(), MaxCol() ) LOCAL scr := SaveScreen( 0, 0, MaxRow(), MaxCol() )
LOCAL clr := SetColor( "N/W" ) LOCAL clr := SetColor( "N/W" )
@@ -367,34 +368,34 @@ FUNCTION WvtLines()
LOCAL nCols := MaxCol() LOCAL nCols := MaxCol()
LOCAL aLastPaint := WvtSetBlocks( {} ) LOCAL aLastPaint := WvtSetBlocks( {} )
LOCAL aObjects := WvtSetObjects( {} ) LOCAL aObjects := WvtSetObjects( {} )
LOCAL hPopup := Wvt_SetPopupMenu() LOCAL hPopup := wvt_SetPopupMenu()
LOCAL aBlocks := {} LOCAL aBlocks := {}
CLS CLS
AAdd( aBlocks, {|| Wvt_DrawLine( 0, 0, 0, nCols, WVT_LINE_HORZ, WVT_LINE_RAISED, WVT_LINE_CENTER ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 0, 0, 0, nCols, WVT_LINE_HORZ, WVT_LINE_RAISED, WVT_LINE_CENTER ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( 1, 0, 1, nCols, WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_TOP ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 1, 0, 1, nCols, WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_TOP ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( 2, 0, 2, nCols, WVT_LINE_HORZ, WVT_LINE_PLAIN, WVT_LINE_CENTER, WVT_LINE_SOLID, 4, RGB( 255, 255, 255 ) ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 2, 0, 2, nCols, WVT_LINE_HORZ, WVT_LINE_PLAIN, WVT_LINE_CENTER, WVT_LINE_SOLID, 4, RGB( 255, 255, 255 ) ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( 3, 0, 3, nCols, WVT_LINE_HORZ, WVT_LINE_RAISED, WVT_LINE_CENTER, WVT_LINE_DASH, 0, RGB( 255, 0, 0 ) ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 3, 0, 3, nCols, WVT_LINE_HORZ, WVT_LINE_RAISED, WVT_LINE_CENTER, WVT_LINE_DASH, 0, RGB( 255, 0, 0 ) ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( 4, 0, 4, nCols, WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_BOTTOM ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 4, 0, 4, nCols, WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_BOTTOM ) } )
@ 0, 1 SAY "Center Raised" @ 0, 1 SAY "Center Raised"
@ 1, 11 SAY "Top Recessed" @ 1, 11 SAY "Top Recessed"
@ 2, 21 SAY "Center Plain White 3 Pixels" @ 2, 21 SAY "Center Plain White 3 Pixels"
@ 3, 31 SAY "Center Raised Dotted" @ 3, 31 SAY "Center Raised Dotted"
@ 4, 41 SAY "Bottom Recessed" @ 4, 41 SAY "Bottom Recessed"
@ 5, 1 SAY "Bottom Checked" @ 5, 1 SAY "Bottom Checked"
@ nRows, 0 SAY PadC( "Press ESC to Quit", nCols + 1 ) COLOR "GR+/W" @ nRows, 0 SAY PadC( "Press ESC to Quit", nCols + 1 ) COLOR "GR+/W"
AAdd( aBlocks, {|| Wvt_DrawLine( 11, 5, nRows - 2, 5, WVT_LINE_VERT, WVT_LINE_RAISED, WVT_LINE_CENTER ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 11, 5, nRows - 2, 5, WVT_LINE_VERT, WVT_LINE_RAISED, WVT_LINE_CENTER ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( 11, 6, nRows - 2, 6, WVT_LINE_VERT, WVT_LINE_RECESSED, WVT_LINE_CENTER ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 11, 6, nRows - 2, 6, WVT_LINE_VERT, WVT_LINE_RECESSED, WVT_LINE_CENTER ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( 11, 7, nRows - 2, 7, WVT_LINE_VERT, WVT_LINE_PLAIN, WVT_LINE_LEFT ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 11, 7, nRows - 2, 7, WVT_LINE_VERT, WVT_LINE_PLAIN, WVT_LINE_LEFT ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( 11, 8, nRows - 2, 8, WVT_LINE_VERT, WVT_LINE_PLAIN, WVT_LINE_CENTER ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 11, 8, nRows - 2, 8, WVT_LINE_VERT, WVT_LINE_PLAIN, WVT_LINE_CENTER ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( 11, 9, nRows - 2, 9, WVT_LINE_VERT, WVT_LINE_PLAIN, WVT_LINE_RIGHT ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 11, 9, nRows - 2, 9, WVT_LINE_VERT, WVT_LINE_PLAIN, WVT_LINE_RIGHT ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( 11, 10, nRows - 2, 10, WVT_LINE_VERT, WVT_LINE_PLAIN, WVT_LINE_CENTER, WVT_LINE_DOT, 0, RGB( 0, 0, 255 ) ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 11, 10, nRows - 2, 10, WVT_LINE_VERT, WVT_LINE_PLAIN, WVT_LINE_CENTER, WVT_LINE_DOT, 0, RGB( 0, 0, 255 ) ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( 11, 11, nRows - 2, 11, WVT_LINE_VERT, WVT_LINE_PLAIN, WVT_LINE_CENTER, WVT_LINE_DASH, 0, RGB( 255, 0, 0 ) ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 11, 11, nRows - 2, 11, WVT_LINE_VERT, WVT_LINE_PLAIN, WVT_LINE_CENTER, WVT_LINE_DASH, 0, RGB( 255, 0, 0 ) ) } )
AAdd( aBlocks, {|| Wvt_DrawLine( 11, 12, nRows - 2, 12, WVT_LINE_VERT, WVT_LINE_PLAIN, WVT_LINE_CENTER, WVT_LINE_DASHDOT, 0, RGB( 0, 255, 0 ) ) } ) AAdd( aBlocks, {|| wvt_DrawLine( 11, 12, nRows - 2, 12, WVT_LINE_VERT, WVT_LINE_PLAIN, WVT_LINE_CENTER, WVT_LINE_DASHDOT, 0, RGB( 0, 255, 0 ) ) } )
WvtSetBlocks( aBlocks ) WvtSetBlocks( aBlocks )
@@ -412,13 +413,13 @@ FUNCTION WvtLines()
WvtSetBlocks( aLastPaint ) WvtSetBlocks( aLastPaint )
WvtSetObjects( aObjects ) WvtSetObjects( aObjects )
Wvt_SetPopupMenu( hPopup ) wvt_SetPopupMenu( hPopup )
RestScreen( 0, 0, MaxRow(), MaxCol(), scr ) RestScreen( 0, 0, MaxRow(), MaxCol(), scr )
RETURN NIL RETURN
FUNCTION BuildMainMenu() STATIC FUNCTION BuildMainMenu()
LOCAL oMenu LOCAL oMenu
LOCAL g_oMenuBar := WvgSetAppWindow():menuBar() LOCAL g_oMenuBar := WvgSetAppWindow():menuBar()
@@ -445,7 +446,7 @@ FUNCTION BuildMainMenu()
oMenu:AddItem( "-" ) oMenu:AddItem( "-" )
oMenu:AddItem( "Wvt Lines . Main Window" , {|| WvtLines() } ) oMenu:AddItem( "Wvt Lines . Main Window" , {|| WvtLines() } )
oMenu:AddItem( "-" ) oMenu:AddItem( "-" )
oMenu:AddItem( "Google Maps" , {|| WvtConsoleGets( 1 ) } ) oMenu:AddItem( "Online Maps" , {|| WvtConsoleGets( 1 ) } )
oMenu:AddItem( "-" ) oMenu:AddItem( "-" )
oMenu:AddItem( "Wvg Console with GCUI" , {|| ExecGCUI() } ) oMenu:AddItem( "Wvg Console with GCUI" , {|| ExecGCUI() } )
oMenu:AddItem( "-" ) oMenu:AddItem( "-" )
@@ -454,9 +455,9 @@ FUNCTION BuildMainMenu()
oMenu := WvgMenu():new( g_oMenuBar, , .T. ):create() oMenu := WvgMenu():new( g_oMenuBar, , .T. ):create()
oMenu:Caption := "Common Dialogs" oMenu:Caption := "Common Dialogs"
oMenu:AddItem( "Fonts" , {|| Wvt_ChooseFont() } ) oMenu:AddItem( "Fonts" , {|| wvt_ChooseFont() } )
oMenu:AddItem( "-" ) oMenu:AddItem( "-" )
oMenu:AddItem( "Colors" , {|| Wvt_ChooseColor() } ) oMenu:AddItem( "Colors" , {|| wvt_ChooseColor() } )
g_oMenuBar:addItem( { oMenu, "Common Dialogs" } ) g_oMenuBar:addItem( { oMenu, "Common Dialogs" } )
oMenu := WvgMenu():new( g_oMenuBar, , .T. ):create() oMenu := WvgMenu():new( g_oMenuBar, , .T. ):create()
@@ -464,7 +465,7 @@ FUNCTION BuildMainMenu()
oMenu:AddItem( "Expand" , {|| WvtWindowExpand( 1 ) } ) oMenu:AddItem( "Expand" , {|| WvtWindowExpand( 1 ) } )
oMenu:AddItem( "Shrink" , {|| WvtWindowExpand( -1 ) } ) oMenu:AddItem( "Shrink" , {|| WvtWindowExpand( -1 ) } )
oMenu:AddItem( "-" ) oMenu:AddItem( "-" )
oMenu:AddItem( "Minimize" , {|| Wvt_Minimize() } ) oMenu:AddItem( "Minimize" , {|| wvt_Minimize() } )
oMenu:AddItem( "Maximize" , {|| hb_gtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_MAXIMIZED ) } ) oMenu:AddItem( "Maximize" , {|| hb_gtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_MAXIMIZED ) } )
g_oMenuBar:addItem( { oMenu, "Functionality" } ) g_oMenuBar:addItem( { oMenu, "Functionality" } )
@@ -495,7 +496,7 @@ FUNCTION BuildMainMenu()
RETURN oMenu /* The last submenu item */ RETURN oMenu /* The last submenu item */
STATIC FUNCTION GoogleMap() STATIC PROCEDURE OnlineMap()
LOCAL mfrom1, mto1, mfrom2, mto2, mfrom3, mto3, mweb LOCAL mfrom1, mto1, mfrom2, mto2, mfrom3, mto3, mweb
LOCAL nCursor := SetCursor() LOCAL nCursor := SetCursor()
@@ -504,21 +505,21 @@ STATIC FUNCTION GoogleMap()
SetMode( 22, 65 ) SetMode( 22, 65 )
SetColor( "N/W,N/GR*,,,N/W*" ) SetColor( "N/W,N/GR*,,,N/W*" )
cls cls
hb_gtInfo( HB_GTI_WINTITLE, "Google Maps" ) hb_gtInfo( HB_GTI_WINTITLE, "Online Maps" )
mfrom1 := mto1 := Space( 20 ) mfrom1 := mto1 := Space( 20 )
mfrom2 := mto2 := Space( 40 ) mfrom2 := mto2 := Space( 40 )
mfrom3 := mto3 := Space( 50 ) mfrom3 := mto3 := Space( 50 )
WHILE .T. DO WHILE .T.
@ 5, 01 SAY "FROM :" @ 5, 01 SAY "FROM :"
@ 7, 01 SAY "State ...:" GET mfrom1 PICTURE "@!" @ 7, 01 SAY "State ...:" GET mfrom1 PICTURE "@!"
@ 8, 01 SAY "City ....:" GET mfrom2 PICTURE "@!" @ 8, 01 SAY "City ....:" GET mfrom2 PICTURE "@!"
@ 9, 01 SAY "Street ..:" GET mfrom3 PICTURE "@!" @ 9, 01 SAY "Street ..:" GET mfrom3 PICTURE "@!"
@ 11, 01 SAY "TO :" @ 11, 01 SAY "TO :"
@ 13, 01 SAY "State ...:" GET mto1 PICTURE "@!" @ 13, 01 SAY "State ...:" GET mto1 PICTURE "@!"
@ 14, 01 SAY "City ....:" GET mto2 PICTURE "@!" @ 14, 01 SAY "City ....:" GET mto2 PICTURE "@!"
@ 15, 01 SAY "Street ..:" GET mto3 PICTURE "@!" @ 15, 01 SAY "Street ..:" GET mto3 PICTURE "@!"
SetCursor( 1 ); read; SetCursor( nCursor ) SetCursor( 1 ); read; SetCursor( nCursor )
@@ -526,16 +527,16 @@ STATIC FUNCTION GoogleMap()
EXIT EXIT
ENDIF ENDIF
mweb := "http://maps.google.com/maps?q=from " + ; mweb := "https://maps.google.com/maps?q=from " + ;
AllTrim( mfrom3 ) + " " + AllTrim( mfrom2 ) + " " + AllTrim( mfrom1 ) + " to " + ; AllTrim( mfrom3 ) + " " + AllTrim( mfrom2 ) + " " + AllTrim( mfrom1 ) + " to " + ;
AllTrim( mto3 ) + " " + AllTrim( mto2 ) + " " + AllTrim( mto1 ) AllTrim( mto3 ) + " " + AllTrim( mto2 ) + " " + AllTrim( mto1 )
hb_threadStart( {|| ExecuteActiveX( 1, mweb ) } ) hb_threadStart( {|| ExecuteActiveX( 1, mweb ) } )
ENDDO ENDDO
RETURN NIL RETURN
FUNCTION BuildButtons() STATIC PROCEDURE BuildButtons()
LOCAL oXbp LOCAL oXbp
@@ -543,40 +544,40 @@ FUNCTION BuildButtons()
oXbp:pointerFocus := .F. oXbp:pointerFocus := .F.
oXbp:caption := "Hi" oXbp:caption := "Hi"
oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -1 }, { -2, -4 } ) oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -1 }, { -2, -4 } )
oXbp:activate := {|| Wvg_MessageBox( , "Harbour!" ) } oXbp:activate := {|| wvg_MessageBox( , "Harbour!" ) }
oXbp:toolTipText := "Harbour CUI/GUI Console" oXbp:toolTipText := "Harbour CUI/GUI Console"
oXbp := WvgPushButton():new() oXbp := WvgPushButton():new()
oXbp:pointerFocus := .F. oXbp:pointerFocus := .F.
oXbp:caption := IMAGE_VOUCH oXbp:caption := IMAGE_VOUCH
oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -6 }, { -2, -4 } ) oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -6 }, { -2, -4 } )
oXbp:activate := {|| Wvt_Keyboard( K_F2 ) } oXbp:activate := {|| wvt_Keyboard( K_F2 ) }
oXbp:toolTipText := "Open Another GET Screen" oXbp:toolTipText := "Open Another GET Screen"
oXbp := WvgPushButton():new() oXbp := WvgPushButton():new()
oXbp:pointerFocus := .F. oXbp:pointerFocus := .F.
oXbp:caption := IMAGE_BROWSE oXbp:caption := IMAGE_BROWSE
oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -11 }, { -2, -4 } ) oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -11 }, { -2, -4 } )
oXbp:activate := {|| Wvt_Keyboard( K_F5 ) } oXbp:activate := {|| wvt_Keyboard( K_F5 ) }
oXbp:toolTipText := "TBrowse + GUI Controls" oXbp:toolTipText := "TBrowse + GUI Controls"
oXbp := WvgPushButton():new() oXbp := WvgPushButton():new()
oXbp:pointerFocus := .F. oXbp:pointerFocus := .F.
oXbp:caption := IMAGE_NOTES oXbp:caption := IMAGE_NOTES
oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -16 }, { -2, -4 } ) oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -16 }, { -2, -4 } )
oXbp:activate := {|| Wvt_Keyboard( K_F3 ) } oXbp:activate := {|| wvt_Keyboard( K_F3 ) }
oXbp := WvgPushButton():new() oXbp := WvgPushButton():new()
oXbp:pointerFocus := .F. oXbp:pointerFocus := .F.
oXbp:caption := IMAGE_TOOLS oXbp:caption := IMAGE_TOOLS
oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -21 }, { -2, -4 } ) oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -21 }, { -2, -4 } )
oXbp:activate := {|| Wvt_Keyboard( K_F6 ) } oXbp:activate := {|| wvt_Keyboard( K_F6 ) }
oXbp := WvgPushButton():new() oXbp := WvgPushButton():new()
oXbp:pointerFocus := .F. oXbp:pointerFocus := .F.
oXbp:caption := IMAGE_HELP oXbp:caption := IMAGE_HELP
oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -26 }, { -2, -4 } ) oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -26 }, { -2, -4 } )
oXbp:activate := {|| Wvt_Keyboard( K_F7 ) } oXbp:activate := {|| wvt_Keyboard( K_F7 ) }
oXbp := WvgPushButton():new() oXbp := WvgPushButton():new()
oXbp:pointerFocus := .F. oXbp:pointerFocus := .F.
@@ -586,17 +587,17 @@ FUNCTION BuildButtons()
oXbp:activate := {|| hb_threadStart( {|| demoXbp() } ) } oXbp:activate := {|| hb_threadStart( {|| demoXbp() } ) }
oXbp:toolTipText := "Flat Button . Lines: press ESC when finished." oXbp:toolTipText := "Flat Button . Lines: press ESC when finished."
RETURN NIL RETURN
#if ! defined( __HBSCRIPT__HBSHELL ) #if ! defined( __HBSCRIPT__HBSHELL )
FUNCTION hb_GTSYS() PROCEDURE hb_GTSYS() /* must be a public function */
REQUEST HB_GT_WVG_DEFAULT REQUEST HB_GT_WVG_DEFAULT
REQUEST HB_GT_WVT REQUEST HB_GT_WVT
REQUEST HB_GT_WGU REQUEST HB_GT_WGU
RETURN NIL RETURN
#endif #endif

View File

@@ -1,11 +1,12 @@
// GTWVT Console GUI Interface // GTWVT Console GUI Interface
// //
// Pritpal Bedi <bedipritpal@hotmail.com> // Copyright (c) Pritpal Bedi <pritpal@vouchcac.com>
#require "gtwvg" #require "gtwvg"
#include "inkey.ch" #include "inkey.ch"
#include "hbgtinfo.ch" #include "hbgtinfo.ch"
#include "hbver.ch"
#define IMAGE_VOUCH hb_DirBase() + "vouch1.bmp" #define IMAGE_VOUCH hb_DirBase() + "vouch1.bmp"
#define IMAGE_BROWSE hb_DirBase() + "v_browse.ico" #define IMAGE_BROWSE hb_DirBase() + "v_browse.ico"
@@ -28,29 +29,29 @@ PROCEDURE Main()
Set( _SET_EVENTMASK, INKEY_ALL + HB_INKEY_GTEVENT ) Set( _SET_EVENTMASK, INKEY_ALL + HB_INKEY_GTEVENT )
Wvt_SetGUI( .T. ) wvt_SetGUI( .T. )
Wvt_SetFont( "Courier New", 18, 0, 0 ) wvt_SetFont( "Courier New", 18, 0, 0 )
Wvt_SetMouseMove( .T. ) wvt_SetMouseMove( .T. )
SetColor( "N/W" ) SetColor( "N/W" )
CLS CLS
Wvt_ShowWindow( SW_RESTORE ) wvt_ShowWindow( SW_RESTORE )
Wvt_SetTitle( "Harbour's GTWVG Demo ( Simplified )" ) Wvt_SetTitle( "Harbour's GTWVG Demo ( Simplified )" )
Wvt_SetIcon( hb_DirBase() + "vr_1.ico" ) wvt_SetIcon( hb_DirBase() + "vr_1.ico" )
SetGT( 1, hb_gtSelect() ) SetGT( 1, hb_gtSelect() )
aPaint := {} aPaint := {}
AAdd( aPaint, { "Label", {|| Wvt_DrawLabel( 1, 40, "Harbour Console GUI Demo", 6, , RGB( 255, 255, 255 ), RGB( 198, 198, 198 ), "Arial", 26, , , , , .T., .T. ) }, { WVT_BLOCK_LABEL, 1, 10, 3, 50 } } ) AAdd( aPaint, { "Label", {|| wvt_DrawLabel( 1, 40, "Harbour Console GUI Demo", 6, , RGB( 255, 255, 255 ), RGB( 198, 198, 198 ), "Arial", 26, , , , , .T., .T. ) }, { WVT_BLOCK_LABEL, 1, 10, 3, 50 } } )
AAdd( aPaint, { "Box_1", {|| Wvt_DrawBoxRaised( 4, 4, 20, 75 ) }, { WVT_BLOCK_BOX, 4, 4, 20, 75 } } ) AAdd( aPaint, { "Box_1", {|| wvt_DrawBoxRaised( 4, 4, 20, 75 ) }, { WVT_BLOCK_BOX, 4, 4, 20, 75 } } )
AAdd( aPaint, { "Box_2", {|| Wvt_DrawBoxRecessed( 7, 61, 13, 70 ) }, { WVT_BLOCK_BOX, 7, 61, 13, 70 } } ) AAdd( aPaint, { "Box_2", {|| wvt_DrawBoxRecessed( 7, 61, 13, 70 ) }, { WVT_BLOCK_BOX, 7, 61, 13, 70 } } )
AAdd( aPaint, { "Box_3", {|| Wvt_DrawBoxGroup( 15, 59, 18, 72 ) }, { WVT_BLOCK_BOX, 15, 59, 18, 72 } } ) AAdd( aPaint, { "Box_3", {|| wvt_DrawBoxGroup( 15, 59, 18, 72 ) }, { WVT_BLOCK_BOX, 15, 59, 18, 72 } } )
AAdd( aPaint, { "Box_4", {|| Wvt_DrawBoxGroup( 5, 6, 19, 44 ) }, { WVT_BLOCK_BOX, 5, 6, 19, 44 } } ) AAdd( aPaint, { "Box_4", {|| wvt_DrawBoxGroup( 5, 6, 19, 44 ) }, { WVT_BLOCK_BOX, 5, 6, 19, 44 } } )
AAdd( aPaint, { "Image", {|| Wvt_DrawImage( 8, 62, 12, 69, IMAGE_VOUCH ) }, { WVT_BLOCK_IMAGE, 8, 62, 12, 69 } } ) AAdd( aPaint, { "Image", {|| wvt_DrawImage( 8, 62, 12, 69, IMAGE_VOUCH ) }, { WVT_BLOCK_IMAGE, 8, 62, 12, 69 } } )
AAdd( aPaint, { "Box_5", {|| Wvt_DrawBoxRecessed( 7, 48, 13, 55 ) }, { WVT_BLOCK_BOX, 7, 48, 13, 55 } } ) AAdd( aPaint, { "Box_5", {|| wvt_DrawBoxRecessed( 7, 48, 13, 55 ) }, { WVT_BLOCK_BOX, 7, 48, 13, 55 } } )
AAdd( aPaint, { "Line_1", {|| Wvt_DrawLine( MaxRow() - 2, 0, MaxRow() - 2, MaxCol(), WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_BOTTOM ) }, NIL } ) AAdd( aPaint, { "Line_1", {|| wvt_DrawLine( MaxRow() - 2, 0, MaxRow() - 2, MaxCol(), WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_BOTTOM ) }, NIL } )
AAdd( aPaint, { "Gets", {|| AEval( GetList, {| oGet | Wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) }, NIL } ) AAdd( aPaint, { "Gets", {|| AEval( GetList, {| oGet | wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) }, NIL } )
ExecForm( aPaint ) ExecForm( aPaint )
@@ -58,23 +59,23 @@ PROCEDURE Main()
/* This function must be linked with the application */ /* This function must be linked with the application */
FUNCTION Wvt_Paint() FUNCTION wvt_Paint() /* must be a public function */
WvtPaintObjects() WvtPaintObjects()
RETURN NIL RETURN NIL
STATIC FUNCTION ExecForm( aPaint ) STATIC PROCEDURE ExecForm( aPaint )
LOCAL cColor := SetColor() LOCAL cColor := SetColor()
LOCAL aPnt LOCAL aPnt
LOCAL dDate := Date() LOCAL dDate := Date()
LOCAL cName := PadR( "Pritpal Bedi", 35 ) LOCAL cName := PadR( "Pritpal Bedi", 35 )
LOCAL cAdd1 := PadR( "60, New Professor Colony", 35 ) LOCAL cAdd1 := PadR( "60, New Professor Colony", 35 )
LOCAL cAdd2 := PadR( "Ludhiana, INDIA", 35 ) LOCAL cAdd2 := PadR( "Ludhiana, INDIA", 35 )
LOCAL cAdd3 := PadR( "http://hbide.vouch.info", 35 ) LOCAL cAdd3 := PadR( hb_Version( HB_VERSION_URL_BASE ), 35 )
LOCAL nSlry := 20000 LOCAL nSlry := 20000
LOCAL nColGet := 8 LOCAL nColGet := 8
aPnt := WvtSetPaint( aPaint ) aPnt := WvtSetPaint( aPaint )
@@ -88,22 +89,21 @@ STATIC FUNCTION ExecForm( aPaint )
@ 9, nColGet SAY "<" + PadC( "Name", 33 ) + ">" @ 9, nColGet SAY "<" + PadC( "Name", 33 ) + ">"
@ 12, nColGet SAY "<" + PadC( "Address", 33 ) + ">" @ 12, nColGet SAY "<" + PadC( "Address", 33 ) + ">"
@ 16, 61 SAY "< Salary >" @ 16, 61 SAY "< Salary >"
@ 7, nColGet GET dDate WHEN DispStatusMsg( "Date must be Valid" ) @ 7, nColGet GET dDate WHEN DispStatusMsg( "Date must be Valid" )
@ 10, nColGet GET cName WHEN DispStatusMsg( "Must be one of the list!" ) VALID ( MyChoice() < 7 ) @ 10, nColGet GET cName WHEN DispStatusMsg( "Must be one of the list!" ) VALID ( MyChoice() < 7 )
@ 13, nColGet GET cAdd1 WHEN DispStatusMsg( "Press F2 to get modal window" ) @ 13, nColGet GET cAdd1 WHEN DispStatusMsg( "Press F2 to get modal window" )
@ 15, nColGet GET cAdd2 WHEN DispStatusMsg( "Press F2 to activate modal window" ) @ 15, nColGet GET cAdd2 WHEN DispStatusMsg( "Press F2 to activate modal window" )
@ 17, nColGet GET cAdd3 WHEN DispStatusMsg( "Press F2 to bring in front a modal window" ) @ 17, nColGet GET cAdd3 WHEN DispStatusMsg( "Press F2 to bring in front a modal window" )
@ 17, 61 GET nSlry PICTURE "@Z 9999999.99" WHEN ClearStatusMsg() @ 17, 61 GET nSlry PICTURE "@Z 9999999.99" WHEN ClearStatusMsg()
READ READ
SetColor( cColor ) SetColor( cColor )
WvtSetPaint( aPnt ) WvtSetPaint( aPnt )
RETURN NIL RETURN
FUNCTION SetGT( nIndex, pGT ) STATIC FUNCTION SetGT( nIndex, pGT )
LOCAL oldGT LOCAL oldGT
STATIC s_pGT_ := { NIL, NIL, NIL } STATIC s_pGT_ := { NIL, NIL, NIL }
@@ -136,21 +136,22 @@ FUNCTION DispStatusMsg( cMsg )
ClearStatusMsg() ClearStatusMsg()
/* NOTE: The GUI function used as such is not subject to autopainting */ /* NOTE: The GUI function used as such is not subject to autopainting */
Wvt_DrawLabel( MaxRow(), 60, cMsg, 6, , 0, RGB( 198, 198, 198 ), "Arial", 18, , 900 ) wvt_DrawLabel( MaxRow(), 60, cMsg, 6, , 0, RGB( 198, 198, 198 ), "Arial", 18, , 900 )
RETURN .T. RETURN .T.
FUNCTION ClearStatusMsg() STATIC FUNCTION ClearStatusMsg()
LOCAL nRow := Row() LOCAL nRow := Row()
LOCAL nCol := Col() LOCAL nCol := Col()
hb_DispOutAt( MaxRow(), 42, Space( 37 ), "W/W" ) hb_DispOutAt( MaxRow(), 42, Space( 37 ), "W/W" )
SetPos( nRow, nCol ) SetPos( nRow, nCol )
RETURN .T. RETURN .T.
FUNCTION DoModalDialog() STATIC PROCEDURE DoModalDialog()
LOCAL oCrt, nSel LOCAL oCrt, nSel
LOCAL aPnt := WvtSetPaint( {} ) LOCAL aPnt := WvtSetPaint( {} )
@@ -167,7 +168,7 @@ FUNCTION DoModalDialog()
oCrt:Create() oCrt:Create()
oCrt:show() oCrt:show()
AAdd( aPaint, { "Box_V", {|| Wvt_DrawBoxRaised( 1, 2, 11, 47 ) }, NIL, { WVT_BLOCK_BOX, 0, 0, MaxRow(), MaxCol() } } ) AAdd( aPaint, { "Box_V", {|| wvt_DrawBoxRaised( 1, 2, 11, 47 ) }, NIL, { WVT_BLOCK_BOX, 0, 0, MaxRow(), MaxCol() } } )
WvtSetPaint( aPaint ) WvtSetPaint( aPaint )
SetColor( "N/W" ) SetColor( "N/W" )
@@ -183,16 +184,16 @@ FUNCTION DoModalDialog()
WvtSetPaint( aPnt ) WvtSetPaint( aPnt )
RETURN NIL RETURN
#if ! defined( __HBSCRIPT__HBSHELL ) #if ! defined( __HBSCRIPT__HBSHELL )
FUNCTION hb_GTSYS() PROCEDURE hb_GTSYS() /* must be a public function */
REQUEST HB_GT_WVG_DEFAULT REQUEST HB_GT_WVG_DEFAULT
REQUEST HB_GT_WVT REQUEST HB_GT_WVT
REQUEST HB_GT_WGU REQUEST HB_GT_WGU
RETURN NIL RETURN
#endif #endif

View File

@@ -1,10 +1,10 @@
// EnOnkar // EnOnkar
// ( The Lord is ONE ) // ( The Lord is ONE )
// . // .
// Xbase++ Compatible XbpDialog() based Application // Xbase++ Compatible XbpDialog() based Application
// //
// Pritpal Bedi <pritpal@vouchcac.com> // Pritpal Bedi <pritpal@vouchcac.com>
// 2008-12-08 // 2008-12-08
#require "gtwvg" #require "gtwvg"
@@ -42,7 +42,7 @@ PROCEDURE Main()
// --------------------------- StatusBar ---------------------------\\ // --------------------------- StatusBar ---------------------------\\
oSBar := WvgStatusBar():new( oCrt ):create( , , , , , .T. ) oSBar := WvgStatusBar():new( oCrt ):create( , , , , , .T. )
oSBar:panelClick := {| oPanel | Wvg_MessageBox( , oPanel:caption ) } oSBar:panelClick := {| oPanel | wvg_MessageBox( , oPanel:caption ) }
oPanel := oSBar:getItem( 1 ) oPanel := oSBar:getItem( 1 )
oPanel:caption := "My Root Panel" oPanel:caption := "My Root Panel"
oPanel1 := oSBar:addItem() oPanel1 := oSBar:addItem()
@@ -91,7 +91,7 @@ PROCEDURE Main()
AAdd( aParts, "DataRef" ) AAdd( aParts, "DataRef" )
AEval( aParts, {| e | oListBox:addItem( e ) } ) AEval( aParts, {| e | oListBox:addItem( e ) } )
oListBox:itemSelected := {|| Wvg_MessageBox( , oListBox:getCurItem() ) } oListBox:itemSelected := {|| wvg_MessageBox( , oListBox:getCurItem() ) }
oListBox:setData( 3 ) // show selected "XbpToolBar" oListBox:setData( 3 ) // show selected "XbpToolBar"
// --------------------------- PushButton --------------------------\\ // --------------------------- PushButton --------------------------\\
@@ -111,7 +111,7 @@ PROCEDURE Main()
oTree:create() oTree:create()
oTree:setColorBG( RGB( 120, 15, 240 ) ) oTree:setColorBG( RGB( 120, 15, 240 ) )
oTree:setColorFG( RGB( 15, 240, 120 ) ) oTree:setColorFG( RGB( 15, 240, 120 ) )
oTree:itemSelected := {| oItem | iif( oItem != NIL, Wvg_MessageBox( , oItem:caption ), NIL ) } oTree:itemSelected := {| oItem | iif( oItem != NIL, wvg_MessageBox( , oItem:caption ), NIL ) }
oItem1 := oTree:rootItem:addItem( "First level A" ) oItem1 := oTree:rootItem:addItem( "First level A" )
@@ -174,7 +174,7 @@ PROCEDURE Main()
oRadio := WvgRadioButton():new( oStatic2, , { 10, 10 }, { 100, 15 } ) oRadio := WvgRadioButton():new( oStatic2, , { 10, 10 }, { 100, 15 } )
oRadio:caption := "Com 1" oRadio:caption := "Com 1"
oRadio:selection := .T. oRadio:selection := .T.
oRadio:selected := {| m1, m2, obj | m1 := m1, m2 := m2, Wvg_MessageBox( , obj:caption + iif( obj:selection, "< S >", "< N >" ) ) } oRadio:selected := {| m1, m2, obj | m1 := m1, m2 := m2, wvg_MessageBox( , obj:caption + iif( obj:selection, "< S >", "< N >" ) ) }
oRadio:create() oRadio:create()
oRadio := WvgRadioButton():new( oStatic2, , { 10, 35 }, { 100, 15 } ) oRadio := WvgRadioButton():new( oStatic2, , { 10, 35 }, { 100, 15 } )
@@ -184,7 +184,7 @@ PROCEDURE Main()
oCheck := WvgCheckBox():New( oStatic2, , { 10, 70 }, { 100, 15 }, , .T. ) oCheck := WvgCheckBox():New( oStatic2, , { 10, 70 }, { 100, 15 }, , .T. )
oCheck:caption := "Checkbox A" oCheck:caption := "Checkbox A"
oCheck:create() oCheck:create()
oCheck:selected := {| m1, m2, o | m1 := m1, m2 := m2, Wvg_MessageBox( , iif( o:getData(), "I am selected", "I am not selected" ) ) } oCheck:selected := {| m1, m2, o | m1 := m1, m2 := m2, wvg_MessageBox( , iif( o:getData(), "I am selected", "I am not selected" ) ) }
// Create first 3State button, passing the position to :create() // Create first 3State button, passing the position to :create()
oXbp := Wvg3State():new() oXbp := Wvg3State():new()
@@ -198,7 +198,7 @@ PROCEDURE Main()
oXbp:caption := "3 State B" oXbp:caption := "3 State B"
oXbp:create( oStatic2 ) oXbp:create( oStatic2 )
// Determine current state using :getData() // Determine current state using :getData()
oXbp:selected := {| m1, m2, oBtn | m1 := m1, m2 := m2, Wvg_MessageBox( , "3State B", aState[ oBtn:getData() + 1 ] ) } oXbp:selected := {| m1, m2, oBtn | m1 := m1, m2 := m2, wvg_MessageBox( , "3State B", aState[ oBtn:getData() + 1 ] ) }
// Create first SLE, specify position using :create() // Create first SLE, specify position using :create()
// On :typeOut set the focus to the second SLE // On :typeOut set the focus to the second SLE
@@ -369,7 +369,7 @@ STATIC FUNCTION MyFunctionXbp( nMode )
Tone( MUSIC_WAITON[ 1 ], 1 ) Tone( MUSIC_WAITON[ 1 ], 1 )
CASE nMode == 3 CASE nMode == 3
Wvg_MessageBox( , "Button clicked!" ) wvg_MessageBox( , "Button clicked!" )
CASE nMode == 101 // Charge CASE nMode == 101 // Charge
Eval( {|| Tone( 523, 2 ), Tone( 698, 2 ), Tone( 880, 2 ), Tone( 1046, 4 ), Tone( 880, 2 ), Tone( 1046, 8 ) } ) Eval( {|| Tone( 523, 2 ), Tone( 698, 2 ), Tone( 880, 2 ), Tone( 1046, 4 ), Tone( 880, 2 ), Tone( 1046, 8 ) } )
@@ -400,7 +400,7 @@ STATIC FUNCTION ExeFontDialog( oCrt )
oFontDlg:familyName := "Courier New" oFontDlg:familyName := "Courier New"
oFontDlg:strikeout := .T. oFontDlg:strikeout := .T.
oFontDlg:underscore := .F. oFontDlg:underscore := .F.
// oFontDlg:activateOk := {|| Wvg_MessageBox( , "activateOK Event Handelled in Windows!" ) } // oFontDlg:activateOk := {|| wvg_MessageBox( , "activateOK Event Handelled in Windows!" ) }
oFontDlg:nominalPointSize := 12 oFontDlg:nominalPointSize := 12
// oFontDlg:size := .F. // oFontDlg:size := .F.

View File

@@ -13,20 +13,18 @@
#pragma -km+ #pragma -km+
/* /* Docs:
Docs:
RFC 1945 - Hypertext Transfer Protocol -- HTTP/1.0 RFC 1945 - Hypertext Transfer Protocol -- HTTP/1.0 - https://tools.ietf.org/html/rfc1945
RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1 RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1 - https://tools.ietf.org/html/rfc2616
HTTP Made Really Easy (http://www.jmarshall.com/easy/http/) HTTP Made Really Easy - https://www.jmarshall.com/easy/http/
*/ */
#define THREAD_COUNT_PREALLOC 3
#define THREAD_COUNT_PREALLOC 3
#define THREAD_COUNT_MAX 50 #define THREAD_COUNT_MAX 50
#define SESSION_TIMEOUT 600 #define SESSION_TIMEOUT 600
#define CR_LF ( Chr( 13 ) + Chr( 10 ) ) #define CR_LF ( Chr( 13 ) + Chr( 10 ) )
THREAD STATIC t_cResult, t_nStatusCode, t_aHeader, t_aSessionData THREAD STATIC t_cResult, t_nStatusCode, t_aHeader, t_aSessionData
@@ -35,12 +33,14 @@ MEMVAR server, get, post, cookie, session, httpd
CREATE CLASS UHttpd MODULE FRIENDLY CREATE CLASS UHttpd MODULE FRIENDLY
EXPORTED: EXPORTED:
METHOD Run( hConfig ) METHOD Run( hConfig )
METHOD Stop() METHOD Stop()
VAR cError INIT "" VAR cError INIT ""
HIDDEN: HIDDEN:
VAR hConfig VAR hConfig
VAR aFirewallFilter VAR aFirewallFilter
@@ -63,7 +63,6 @@ CREATE CLASS UHttpd MODULE FRIENDLY
ENDCLASS ENDCLASS
FUNCTION UHttpdNew() FUNCTION UHttpdNew()
RETURN UHttpd() RETURN UHttpd()
METHOD Run( hConfig ) CLASS UHttpd METHOD Run( hConfig ) CLASS UHttpd
@@ -71,11 +70,11 @@ METHOD Run( hConfig ) CLASS UHttpd
LOCAL hSocket, nI, aI, xValue, aThreads, nJobs, nWorkers LOCAL hSocket, nI, aI, xValue, aThreads, nJobs, nWorkers
IF ! hb_mtvm() IF ! hb_mtvm()
Self:cError := "Multithread support required" ::cError := "Multithread support required"
RETURN .F. RETURN .F.
ENDIF ENDIF
Self:hConfig := { ; ::hConfig := { ;
"SSL" => .F., ; "SSL" => .F., ;
"Port" => 80, ; "Port" => 80, ;
"BindAddress" => "0.0.0.0", ; "BindAddress" => "0.0.0.0", ;
@@ -89,67 +88,66 @@ METHOD Run( hConfig ) CLASS UHttpd
"FirewallFilter" => "0.0.0.0/0" } "FirewallFilter" => "0.0.0.0/0" }
FOR EACH xValue IN hConfig FOR EACH xValue IN hConfig
IF ! hb_HHasKey( Self:hConfig, xValue:__enumKey ) .OR. !( ValType( xValue ) == ValType( Self:hConfig[ xValue:__enumKey ] ) ) IF ! hb_HHasKey( ::hConfig, xValue:__enumKey ) .OR. !( ValType( xValue ) == ValType( ::hConfig[ xValue:__enumKey ] ) )
Self:cError := "Invalid config option '" + xValue:__enumKey + "'" ::cError := "Invalid config option '" + xValue:__enumKey + "'"
RETURN .F. RETURN .F.
ENDIF ENDIF
Self:hConfig[ xValue:__enumKey ] := xValue ::hConfig[ xValue:__enumKey ] := xValue
NEXT NEXT
IF ::hConfig[ "SSL" ]
IF Self:hConfig[ "SSL" ] IF ::lHasSSL
IF Self:lHasSSL
SSL_init() SSL_init()
DO WHILE RAND_status() != 1 DO WHILE RAND_status() != 1
RAND_add( Str( hb_Random(), 18, 15 ) + Str( hb_MilliSeconds(), 20 ), 1 ) RAND_add( Str( hb_Random(), 18, 15 ) + Str( hb_MilliSeconds(), 20 ), 1 )
ENDDO ENDDO
Self:hSSLCtx := SSL_CTX_new( HB_SSL_CTX_NEW_METHOD_SSLV23_SERVER ) ::hSSLCtx := SSL_CTX_new( HB_SSL_CTX_NEW_METHOD_SSLV23_SERVER )
SSL_CTX_set_options( Self:hSSLCtx, HB_SSL_OP_NO_TLSv1 ) SSL_CTX_set_options( ::hSSLCtx, HB_SSL_OP_NO_TLSv1 )
IF SSL_CTX_use_PrivateKey_file( Self:hSSLCtx, Self:hConfig[ "PrivateKeyFilename" ], HB_SSL_FILETYPE_PEM ) != 1 IF SSL_CTX_use_PrivateKey_file( ::hSSLCtx, ::hConfig[ "PrivateKeyFilename" ], HB_SSL_FILETYPE_PEM ) != 1
Self:cError := "Invalid private key file" ::cError := "Invalid private key file"
RETURN .F. RETURN .F.
ENDIF ENDIF
IF SSL_CTX_use_certificate_file( Self:hSSLCtx, Self:hConfig[ "CertificateFilename" ], HB_SSL_FILETYPE_PEM ) != 1 IF SSL_CTX_use_certificate_file( ::hSSLCtx, ::hConfig[ "CertificateFilename" ], HB_SSL_FILETYPE_PEM ) != 1
Self:cError := "Invalid certificate file" ::cError := "Invalid certificate file"
RETURN .F. RETURN .F.
ENDIF ENDIF
ELSE ELSE
Self:cError := "SSL not supported" ::cError := "SSL not supported"
RETURN .F. RETURN .F.
ENDIF ENDIF
ENDIF ENDIF
IF Self:hConfig[ "Port" ] < 1 .OR. Self:hConfig[ "Port" ] > 65535 IF ::hConfig[ "Port" ] < 1 .OR. ::hConfig[ "Port" ] > 65535
Self:cError := "Invalid port number" ::cError := "Invalid port number"
RETURN .F. RETURN .F.
ENDIF ENDIF
IF ParseFirewallFilter( Self:hConfig[ "FirewallFilter" ], @aI ) IF ParseFirewallFilter( ::hConfig[ "FirewallFilter" ], @aI )
Self:aFirewallFilter := aI ::aFirewallFilter := aI
ELSE ELSE
Self:cError := "Invalid firewall filter" ::cError := "Invalid firewall filter"
RETURN .F. RETURN .F.
ENDIF ENDIF
Self:hmtxQueue := hb_mutexCreate() ::hmtxQueue := hb_mutexCreate()
Self:hmtxLog := hb_mutexCreate() ::hmtxLog := hb_mutexCreate()
Self:hmtxSession := hb_mutexCreate() ::hmtxSession := hb_mutexCreate()
IF Empty( Self:hListen := hb_socketOpen() ) IF Empty( ::hListen := hb_socketOpen() )
Self:cError := "Socket create error: " + hb_socketErrorString() ::cError := "Socket create error: " + hb_socketErrorString()
RETURN .F. RETURN .F.
ENDIF ENDIF
IF ! hb_socketBind( Self:hListen, { HB_SOCKET_AF_INET, Self:hConfig[ "BindAddress" ], Self:hConfig[ "Port" ] } ) IF ! hb_socketBind( ::hListen, { HB_SOCKET_AF_INET, ::hConfig[ "BindAddress" ], ::hConfig[ "Port" ] } )
Self:cError := "Bind error: " + hb_socketErrorString() ::cError := "Bind error: " + hb_socketErrorString()
hb_socketClose( Self:hListen ) hb_socketClose( ::hListen )
RETURN .F. RETURN .F.
ENDIF ENDIF
IF ! hb_socketListen( Self:hListen ) IF ! hb_socketListen( ::hListen )
Self:cError := "Listen error: " + hb_socketErrorString() ::cError := "Listen error: " + hb_socketErrorString()
hb_socketClose( Self:hListen ) hb_socketClose( ::hListen )
RETURN .F. RETURN .F.
ENDIF ENDIF
@@ -158,49 +156,49 @@ METHOD Run( hConfig ) CLASS UHttpd
AAdd( aThreads, hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @ProcessConnection(), Self ) ) AAdd( aThreads, hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @ProcessConnection(), Self ) )
NEXT NEXT
Self:lStop := .F. ::lStop := .F.
Self:hSession := { => } ::hSession := { => }
DO WHILE .T. DO WHILE .T.
IF Empty( hSocket := hb_socketAccept( Self:hListen,, 1000 ) ) IF Empty( hSocket := hb_socketAccept( ::hListen,, 1000 ) )
IF hb_socketGetError() == HB_SOCKET_ERR_TIMEOUT IF hb_socketGetError() == HB_SOCKET_ERR_TIMEOUT
Eval( Self:hConfig[ "Idle" ], Self ) Eval( ::hConfig[ "Idle" ], Self )
IF Self:lStop IF ::lStop
EXIT EXIT
ENDIF ENDIF
ELSE ELSE
Self:LogError( "[error] Accept error: " + hb_socketErrorString() ) ::LogError( "[error] Accept error: " + hb_socketErrorString() )
ENDIF ENDIF
ELSE ELSE
Eval( Self:hConfig[ "Trace" ], "New connection", hSocket ) Eval( ::hConfig[ "Trace" ], "New connection", hSocket )
IF hb_mutexQueueInfo( Self:hmtxQueue, @nWorkers, @nJobs ) .AND. ; IF hb_mutexQueueInfo( ::hmtxQueue, @nWorkers, @nJobs ) .AND. ;
Len( aThreads ) < THREAD_COUNT_MAX .AND. ; Len( aThreads ) < THREAD_COUNT_MAX .AND. ;
nJobs >= nWorkers nJobs >= nWorkers
AAdd( aThreads, hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @ProcessConnection(), Self ) ) AAdd( aThreads, hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @ProcessConnection(), Self ) )
ENDIF ENDIF
hb_mutexNotify( Self:hmtxQueue, hSocket ) hb_mutexNotify( ::hmtxQueue, hSocket )
ENDIF ENDIF
ENDDO ENDDO
hb_socketClose( Self:hListen ) hb_socketClose( ::hListen )
/* End child threads */ /* End child threads */
AEval( aThreads, {|| hb_mutexNotify( Self:hmtxQueue, NIL ) } ) AEval( aThreads, {|| hb_mutexNotify( ::hmtxQueue, NIL ) } )
AEval( aThreads, {| h | hb_threadJoin( h ) } ) AEval( aThreads, {| h | hb_threadJoin( h ) } )
RETURN .T. RETURN .T.
METHOD Stop() CLASS UHttpd METHOD Stop() CLASS UHttpd
Eval( Self:hConfig[ "Trace" ], "stopping" ) Eval( ::hConfig[ "Trace" ], "stopping" )
Self:lStop := .T. ::lStop := .T.
RETURN NIL RETURN NIL
METHOD LogError( cError ) CLASS UHttpd METHOD LogError( cError ) CLASS UHttpd
hb_mutexLock( Self:hmtxLog ) hb_mutexLock( ::hmtxLog )
Eval( Self:hConfig[ "LogError" ], DToS( Date() ) + " " + Time() + " " + cError ) Eval( ::hConfig[ "LogError" ], DToS( Date() ) + " " + Time() + " " + cError )
hb_mutexUnlock( Self:hmtxLog ) hb_mutexUnlock( ::hmtxLog )
RETURN NIL RETURN NIL
@@ -208,15 +206,15 @@ METHOD LogAccess() CLASS UHttpd
LOCAL cDate := DToS( Date() ), cTime := Time() LOCAL cDate := DToS( Date() ), cTime := Time()
hb_mutexLock( Self:hmtxLog ) hb_mutexLock( ::hmtxLog )
Eval( Self:hConfig[ "LogAccess" ], ; Eval( ::hConfig[ "LogAccess" ], ;
server[ "REMOTE_ADDR" ] + " - - [" + Right( cDate, 2 ) + "/" + ; server[ "REMOTE_ADDR" ] + " - - [" + Right( cDate, 2 ) + "/" + ;
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }[ Val( SubStr( cDate, 5, 2 ) ) ] + ; { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }[ Val( SubStr( cDate, 5, 2 ) ) ] + ;
"/" + Left( cDate, 4 ) + ":" + cTime + ' +0000] "' + server[ "REQUEST_ALL" ] + '" ' + ; "/" + Left( cDate, 4 ) + ":" + cTime + ' +0000] "' + server[ "REQUEST_ALL" ] + '" ' + ;
hb_ntos( t_nStatusCode ) + " " + hb_ntos( Len( t_cResult ) ) + ; hb_ntos( t_nStatusCode ) + " " + hb_ntos( Len( t_cResult ) ) + ;
' "' + server[ "HTTP_REFERER" ] + '" "' + server[ "HTTP_USER_AGENT" ] + ; ' "' + server[ "HTTP_REFERER" ] + '" "' + server[ "HTTP_USER_AGENT" ] + ;
'"' ) '"' )
hb_mutexUnlock( Self:hmtxLog ) hb_mutexUnlock( ::hmtxLog )
RETURN NIL RETURN NIL
@@ -261,7 +259,7 @@ STATIC FUNCTION ParseFirewallFilter( cFilter, aFilter )
ENDIF ENDIF
ELSE ELSE
nPrefix := Val( cI ) nPrefix := Val( cI )
IF nPrefix < 0 .OR. nPrefix > 32 .OR. !( hb_ntos( nPrefix ) == cI ) IF nPrefix < 0 .OR. nPrefix > 32 .OR. ! hb_ntos( nPrefix ) == cI
RETURN .F. RETURN .F.
ENDIF ENDIF
ENDIF ENDIF
@@ -491,7 +489,7 @@ STATIC FUNCTION ProcessConnection( oServer )
ENDDO ENDDO
IF nErr != 0 IF nErr != 0
Eval( oServer:hConfig[ "Trace" ], "Close connection1", hSocket ) Eval( oServer:hConfig[ "Trace" ], "Close connection", hSocket )
hb_socketShutdown( hSocket ) hb_socketShutdown( hSocket )
hb_socketClose( hSocket ) hb_socketClose( hSocket )
LOOP LOOP
@@ -614,9 +612,9 @@ STATIC FUNCTION ProcessConnection( oServer )
IF !( Left( server[ "SERVER_PROTOCOL" ], 5 ) == "HTTP/" ) IF !( Left( server[ "SERVER_PROTOCOL" ], 5 ) == "HTTP/" )
USetStatusCode( 400 ) /* Bad request */ USetStatusCode( 400 ) /* Bad request */
UAddHeader( "Connection", "close" ) UAddHeader( "Connection", "close" )
ELSEIF !( SubStr( server[ "SERVER_PROTOCOL" ], 6 ) $ "1.0 1.1" ) ELSEIF ! SubStr( server[ "SERVER_PROTOCOL" ], 6 ) $ "1.0 1.1"
USetStatusCode( 505 ) /* HTTP version not supported */ USetStatusCode( 505 ) /* HTTP version not supported */
ELSEIF !( server[ "REQUEST_METHOD" ] $ "GET POST" ) ELSEIF ! server[ "REQUEST_METHOD" ] $ "GET POST"
USetStatusCode( 501 ) /* Not implemented */ USetStatusCode( 501 ) /* Not implemented */
ELSE ELSE
IF server[ "SERVER_PROTOCOL" ] == "HTTP/1.1" IF server[ "SERVER_PROTOCOL" ] == "HTTP/1.1"
@@ -801,7 +799,7 @@ STATIC FUNCTION ParseRequestHeader( cRequest )
ENDSWITCH ENDSWITCH
ENDIF ENDIF
NEXT NEXT
IF !( server[ "QUERY_STRING" ] == "" ) IF ! server[ "QUERY_STRING" ] == ""
FOR EACH cI IN hb_ATokens( server[ "QUERY_STRING" ], "&" ) FOR EACH cI IN hb_ATokens( server[ "QUERY_STRING" ], "&" )
IF ( nI := At( "=", cI ) ) > 0 IF ( nI := At( "=", cI ) ) > 0
get[ UUrlDecode( Left( cI, nI - 1 ) ) ] := UUrlDecode( SubStr( cI, nI + 1 ) ) get[ UUrlDecode( Left( cI, nI - 1 ) ) ] := UUrlDecode( SubStr( cI, nI + 1 ) )
@@ -813,7 +811,7 @@ STATIC FUNCTION ParseRequestHeader( cRequest )
RETURN nContentLength RETURN nContentLength
STATIC FUNCTION ParseRequestBody( cRequest ) STATIC PROCEDURE ParseRequestBody( cRequest )
LOCAL nI, cPart, cEncoding LOCAL nI, cPart, cEncoding
@@ -822,7 +820,7 @@ STATIC FUNCTION ParseRequestBody( cRequest )
IF ( nI := At( "CHARSET=", Upper( server[ "CONTENT_TYPE" ] ) ) ) > 0 IF ( nI := At( "CHARSET=", Upper( server[ "CONTENT_TYPE" ] ) ) ) > 0
cEncoding := Upper( SubStr( server[ "CONTENT_TYPE" ], nI + 8 ) ) cEncoding := Upper( SubStr( server[ "CONTENT_TYPE" ], nI + 8 ) )
ENDIF ENDIF
IF !( cRequest == "" ) IF ! cRequest == ""
IF cEncoding == "UTF-8" IF cEncoding == "UTF-8"
FOR EACH cPart IN hb_ATokens( cRequest, "&" ) FOR EACH cPart IN hb_ATokens( cRequest, "&" )
IF ( nI := At( "=", cPart ) ) > 0 IF ( nI := At( "=", cPart ) ) > 0
@@ -843,7 +841,7 @@ STATIC FUNCTION ParseRequestBody( cRequest )
ENDIF ENDIF
ENDIF ENDIF
RETURN NIL RETURN
STATIC FUNCTION MakeResponse( hConfig ) STATIC FUNCTION MakeResponse( hConfig )
@@ -856,47 +854,47 @@ STATIC FUNCTION MakeResponse( hConfig )
cRet := iif( server[ "SERVER_PROTOCOL" ] == "HTTP/1.0", "HTTP/1.0 ", "HTTP/1.1 " ) cRet := iif( server[ "SERVER_PROTOCOL" ] == "HTTP/1.0", "HTTP/1.0 ", "HTTP/1.1 " )
SWITCH t_nStatusCode SWITCH t_nStatusCode
CASE 100 ; cStatus := "100 Continue" ; EXIT CASE 100 ; cStatus := "100 Continue" ; EXIT
CASE 101 ; cStatus := "101 Switching Protocols" ; EXIT CASE 101 ; cStatus := "101 Switching Protocols" ; EXIT
CASE 200 ; cStatus := "200 OK" ; EXIT CASE 200 ; cStatus := "200 OK" ; EXIT
CASE 201 ; cStatus := "201 Created" ; EXIT CASE 201 ; cStatus := "201 Created" ; EXIT
CASE 202 ; cStatus := "202 Accepted" ; EXIT CASE 202 ; cStatus := "202 Accepted" ; EXIT
CASE 203 ; cStatus := "203 Non-Authoritative Information" ; EXIT CASE 203 ; cStatus := "203 Non-Authoritative Information" ; EXIT
CASE 204 ; cStatus := "204 No Content" ; EXIT CASE 204 ; cStatus := "204 No Content" ; EXIT
CASE 205 ; cStatus := "205 Reset Content" ; EXIT CASE 205 ; cStatus := "205 Reset Content" ; EXIT
CASE 206 ; cStatus := "206 Partial Content" ; EXIT CASE 206 ; cStatus := "206 Partial Content" ; EXIT
CASE 300 ; cStatus := "300 Multiple Choices" ; EXIT CASE 300 ; cStatus := "300 Multiple Choices" ; EXIT
CASE 301 ; cStatus := "301 Moved Permanently" ; EXIT CASE 301 ; cStatus := "301 Moved Permanently" ; EXIT
CASE 302 ; cStatus := "302 Found" ; EXIT CASE 302 ; cStatus := "302 Found" ; EXIT
CASE 303 ; cStatus := "303 See Other" ; EXIT CASE 303 ; cStatus := "303 See Other" ; EXIT
CASE 304 ; cStatus := "304 Not Modified" ; EXIT CASE 304 ; cStatus := "304 Not Modified" ; EXIT
CASE 305 ; cStatus := "305 Use Proxy" ; EXIT CASE 305 ; cStatus := "305 Use Proxy" ; EXIT
CASE 307 ; cStatus := "307 Temporary Redirect" ; EXIT CASE 307 ; cStatus := "307 Temporary Redirect" ; EXIT
CASE 400 ; cStatus := "400 Bad Request" ; EXIT CASE 400 ; cStatus := "400 Bad Request" ; EXIT
CASE 401 ; cStatus := "401 Unauthorized" ; EXIT CASE 401 ; cStatus := "401 Unauthorized" ; EXIT
CASE 402 ; cStatus := "402 Payment Required" ; EXIT CASE 402 ; cStatus := "402 Payment Required" ; EXIT
CASE 403 ; cStatus := "403 Forbidden" ; EXIT CASE 403 ; cStatus := "403 Forbidden" ; EXIT
CASE 404 ; cStatus := "404 Not Found" ; EXIT CASE 404 ; cStatus := "404 Not Found" ; EXIT
CASE 405 ; cStatus := "405 Method Not Allowed" ; EXIT CASE 405 ; cStatus := "405 Method Not Allowed" ; EXIT
CASE 406 ; cStatus := "406 Not Acceptable" ; EXIT CASE 406 ; cStatus := "406 Not Acceptable" ; EXIT
CASE 407 ; cStatus := "407 Proxy Authentication Required" ; EXIT CASE 407 ; cStatus := "407 Proxy Authentication Required" ; EXIT
CASE 408 ; cStatus := "408 Request Timeout" ; EXIT CASE 408 ; cStatus := "408 Request Timeout" ; EXIT
CASE 409 ; cStatus := "409 Conflict" ; EXIT CASE 409 ; cStatus := "409 Conflict" ; EXIT
CASE 410 ; cStatus := "410 Gone" ; EXIT CASE 410 ; cStatus := "410 Gone" ; EXIT
CASE 411 ; cStatus := "411 Length Required" ; EXIT CASE 411 ; cStatus := "411 Length Required" ; EXIT
CASE 412 ; cStatus := "412 Precondition Failed" ; EXIT CASE 412 ; cStatus := "412 Precondition Failed" ; EXIT
CASE 413 ; cStatus := "413 Request Entity Too Large" ; EXIT CASE 413 ; cStatus := "413 Request Entity Too Large" ; EXIT
CASE 414 ; cStatus := "414 Request-URI Too Long" ; EXIT CASE 414 ; cStatus := "414 Request-URI Too Long" ; EXIT
CASE 415 ; cStatus := "415 Unsupprted Media Type" ; EXIT CASE 415 ; cStatus := "415 Unsupprted Media Type" ; EXIT
CASE 416 ; cStatus := "416 Requested Range Not Satisfiable" ; EXIT CASE 416 ; cStatus := "416 Requested Range Not Satisfiable" ; EXIT
CASE 417 ; cStatus := "417 Expectation Failed" ; EXIT CASE 417 ; cStatus := "417 Expectation Failed" ; EXIT
CASE 500 ; cStatus := "500 Internal Server Error" ; EXIT CASE 500 ; cStatus := "500 Internal Server Error" ; EXIT
CASE 501 ; cStatus := "501 Not Implemented" ; EXIT CASE 501 ; cStatus := "501 Not Implemented" ; EXIT
CASE 502 ; cStatus := "502 Bad Gateway" ; EXIT CASE 502 ; cStatus := "502 Bad Gateway" ; EXIT
CASE 503 ; cStatus := "503 Service Unavailable" ; EXIT CASE 503 ; cStatus := "503 Service Unavailable" ; EXIT
CASE 504 ; cStatus := "504 Gateway Timeout" ; EXIT CASE 504 ; cStatus := "504 Gateway Timeout" ; EXIT
CASE 505 ; cStatus := "505 HTTP Version Not Supported" ; EXIT CASE 505 ; cStatus := "505 HTTP Version Not Supported" ; EXIT
OTHERWISE; cStatus := "500 Internal Server Error" OTHERWISE; cStatus := "500 Internal Server Error"
ENDSWITCH ENDSWITCH
cRet += cStatus + CR_LF cRet += cStatus + CR_LF
@@ -943,13 +941,16 @@ STATIC FUNCTION HttpDateUnformat( cDate, tDate )
STATIC FUNCTION UErrorHandler( oErr, oServer ) STATIC FUNCTION UErrorHandler( oErr, oServer )
Eval( oServer:hConfig[ "Trace" ], "UErrorHandler" ) Eval( oServer:hConfig[ "Trace" ], "UErrorHandler" )
IF oErr:genCode == EG_ZERODIV; RETURN 0 DO CASE
ELSEIF oErr:genCode == EG_LOCK; RETURN .T. CASE oErr:genCode == EG_ZERODIV
ELSEIF ( oErr:genCode == EG_OPEN .AND. oErr:osCode == 32 .OR. ; RETURN 0
CASE oErr:genCode == EG_LOCK
RETURN .T.
CASE ( oErr:genCode == EG_OPEN .AND. oErr:osCode == 32 .OR. ;
oErr:genCode == EG_APPENDLOCK ) .AND. oErr:canDefault oErr:genCode == EG_APPENDLOCK ) .AND. oErr:canDefault
NetErr( .T. ) NetErr( .T. )
RETURN .F. RETURN .F.
ENDIF ENDCASE
oServer:LogError( GetErrorDesc( oErr ) ) oServer:LogError( GetErrorDesc( oErr ) )
IF oErr != NIL // Dummy check to avoid unreachable code warning for RETURN NIL IF oErr != NIL // Dummy check to avoid unreachable code warning for RETURN NIL
Break( oErr ) Break( oErr )
@@ -1124,9 +1125,7 @@ STATIC FUNCTION cvt2str( xI, lLong )
RETURN NIL RETURN NIL
/******************************************************************** /* Public functions */
Public functions
********************************************************************/
PROCEDURE USetStatusCode( nStatusCode ) PROCEDURE USetStatusCode( nStatusCode )
@@ -1139,7 +1138,7 @@ FUNCTION UGetHeader( cType )
LOCAL nI LOCAL nI
IF ( nI := AScan( t_aHeader, {| x | Upper( x[ 1 ] ) == Upper( cType ) } ) ) > 0 IF ( nI := AScan( t_aHeader, {| x | Upper( x[ 1 ] ) == Upper( cType ) } ) ) > 0
RETURN t_aHeader[ nI, 2 ] RETURN t_aHeader[ nI ][ 2 ]
ENDIF ENDIF
RETURN NIL RETURN NIL
@@ -1149,7 +1148,7 @@ PROCEDURE UAddHeader( cType, cValue )
LOCAL nI LOCAL nI
IF ( nI := AScan( t_aHeader, {| x | Upper( x[ 1 ] ) == Upper( cType ) } ) ) > 0 IF ( nI := AScan( t_aHeader, {| x | Upper( x[ 1 ] ) == Upper( cType ) } ) ) > 0
t_aHeader[ nI, 2 ] := cValue t_aHeader[ nI ][ 2 ] := cValue
ELSE ELSE
AAdd( t_aHeader, { cType, cValue } ) AAdd( t_aHeader, { cType, cValue } )
ENDIF ENDIF
@@ -1211,7 +1210,7 @@ PROCEDURE USessionStart()
t_aSessionData := httpd:hSession[ cSID ] t_aSessionData := httpd:hSession[ cSID ]
IF hb_mutexLock( t_aSessionData[ 1 ], 0 ) IF hb_mutexLock( t_aSessionData[ 1 ], 0 )
// No concurent sessions // No concurrent sessions
IF t_aSessionData[ 3 ] > hb_MilliSeconds() IF t_aSessionData[ 3 ] > hb_MilliSeconds()
t_aSessionData[ 3 ] := hb_MilliSeconds() + SESSION_TIMEOUT * 1000 t_aSessionData[ 3 ] := hb_MilliSeconds() + SESSION_TIMEOUT * 1000
session := t_aSessionData[ 2 ] session := t_aSessionData[ 2 ]
@@ -1221,7 +1220,7 @@ PROCEDURE USessionStart()
ENDIF ENDIF
ELSE ELSE
// Concurent process exists // Concurrent process exists
hb_mutexUnlock( httpd:hmtxSession ) hb_mutexUnlock( httpd:hmtxSession )
// Wait for session // Wait for session
@@ -1239,7 +1238,7 @@ PROCEDURE USessionStart()
USessionCreateInternal() USessionCreateInternal()
ENDIF ENDIF
ELSE ELSE
// Session was destroyed by concurent process // Session was destroyed by concurrent process
USessionCreateInternal() USessionCreateInternal()
ENDIF ENDIF
ENDIF ENDIF
@@ -1267,7 +1266,7 @@ PROCEDURE USessionDestroy()
FUNCTION UOsFileName( cFileName ) FUNCTION UOsFileName( cFileName )
IF !( hb_ps() == "/" ) IF ! hb_ps() == "/"
RETURN StrTran( cFileName, "/", hb_ps() ) RETURN StrTran( cFileName, "/", hb_ps() )
ENDIF ENDIF
@@ -1462,9 +1461,9 @@ PROCEDURE UProcFiles( cFileName, lIndex )
iif( Y[ 5 ] == "D", .F., X[ 1 ] < Y[ 1 ] ) ) } ) iif( Y[ 5 ] == "D", .F., X[ 1 ] < Y[ 1 ] ) ) } )
ENDIF ENDIF
UWrite( '<html><body><h1>Index of ' + server[ "SCRIPT_NAME" ] + '</h1><pre> ' ) UWrite( '<html><body><h1>Index of ' + server[ "SCRIPT_NAME" ] + '</h1><pre>' )
UWrite( '<a href="?s=n">Name</a> ' ) UWrite( '<a href="?s=n">Name</a>' )
UWrite( '<a href="?s=m">Modified</a> ' ) UWrite( '<a href="?s=m">Modified</a>' )
UWrite( '<a href="?s=s">Size</a>' + CR_LF + '<hr>' ) UWrite( '<a href="?s=s">Size</a>' + CR_LF + '<hr>' )
FOR EACH aF IN aDir FOR EACH aF IN aDir
IF Left( aF[ 1 ], 1 ) == "." IF Left( aF[ 1 ], 1 ) == "."
@@ -1721,7 +1720,7 @@ STATIC FUNCTION compile_buffer( cTpl, nStart, aCode )
RETURN Len( cTpl ) + 1 RETURN Len( cTpl ) + 1
STATIC FUNCTION SUBSTRCOUNT( cSub, cString, nStart, nEnd ) STATIC FUNCTION SubStrCount( cSub, cString, nStart, nEnd )
LOCAL nCount := 0 LOCAL nCount := 0

View File

@@ -303,7 +303,7 @@ STATIC FUNCTION proc_account_edit()
cName := users->NAME cName := users->NAME
IF hb_HHasKey( session, "formdata_account/edit" ) IF hb_HHasKey( session, "formdata_account/edit" )
cName := session[ "formdata_account/edit", "name" ] cName := session[ "formdata_account/edit" ][ "name" ]
ENDIF ENDIF
IF server[ "REQUEST_METHOD" ] == "POST" IF server[ "REQUEST_METHOD" ] == "POST"
cName := hb_HGetDef( post, "name", "" ) cName := hb_HGetDef( post, "name", "" )
@@ -349,8 +349,8 @@ STATIC FUNCTION proc_register()
cUser := "" cUser := ""
cName := "" cName := ""
IF hb_HHasKey( session, "formdata_register" ) IF hb_HHasKey( session, "formdata_register" )
cUser := session[ "formdata_register", "user" ] cUser := session[ "formdata_register" ][ "user" ]
cName := session[ "formdata_register", "name" ] cName := session[ "formdata_register" ][ "name" ]
ENDIF ENDIF
IF server[ "REQUEST_METHOD" ] == "POST" IF server[ "REQUEST_METHOD" ] == "POST"
dbUseArea( .T., , "users", "users", .T., .F. ) dbUseArea( .T., , "users", "users", .T., .F. )
@@ -363,7 +363,7 @@ STATIC FUNCTION proc_register()
IF Empty( cUser ) .OR. Empty( cName ) .OR. Empty( cPassword1 ) .OR. Empty( cPassword2 ) IF Empty( cUser ) .OR. Empty( cName ) .OR. Empty( cPassword1 ) .OR. Empty( cPassword2 )
session[ "formdata_register" ] := { "user" => cUser, "name" => cName } session[ "formdata_register" ] := { "user" => cUser, "name" => cName }
URedirect( "?err=1" ) URedirect( "?err=1" )
ELSEIF !( cPassword1 == cPassword2 ) ELSEIF ! cPassword1 == cPassword2
session[ "formdata_register" ] := { "user" => cUser, "name" => cName } session[ "formdata_register" ] := { "user" => cUser, "name" => cName }
URedirect( "?err=2" ) URedirect( "?err=2" )
ELSEIF dbSeek( cUser, .F. ) ELSEIF dbSeek( cUser, .F. )

View File

@@ -21,7 +21,7 @@ FUNCTION UWMainNew()
LOCAL oW := UWMain() LOCAL oW := UWMain()
session[ "_uthis", "main" ] := oW session[ "_uthis" ][ "main" ] := oW
RETURN oW RETURN oW
@@ -92,7 +92,7 @@ METHOD Add( oWidget, nRow, nCol ) CLASS UWLayoutGrid
AEval( ::aChilds, {| x | AAdd( x, {} ) } ) AEval( ::aChilds, {| x | AAdd( x, {} ) } )
NEXT NEXT
ENDIF ENDIF
AAdd( ::aChilds[ nRow, nCol ], oWidget ) AAdd( ::aChilds[ nRow ][ nCol ], oWidget )
RETURN Self RETURN Self
@@ -311,11 +311,11 @@ METHOD Paint() CLASS UWMenu
LOCAL nI LOCAL nI
UWrite( '<div>' ) UWrite( '<div>' )
FOR nI := 1 TO Len( Self:aItems ) FOR nI := 1 TO Len( ::aItems )
IF nI != 1 IF nI != 1
UWrite( '&nbsp;|&nbsp;' ) UWrite( '&nbsp;|&nbsp;' )
ENDIF ENDIF
UWrite( '<a href="' + Self:aItems[ nI, 2 ] + '">' + UHtmlEncode( Self:aItems[ nI, 1 ] ) + '</a>' ) UWrite( '<a href="' + ::aItems[ nI ][ 2 ] + '">' + UHtmlEncode( ::aItems[ nI ][ 1 ] ) + '</a>' )
NEXT NEXT
UWrite( '</div>' ) UWrite( '</div>' )
@@ -351,8 +351,8 @@ METHOD Output() CLASS UWBrowse
// Header // Header
cRet += '<tr>' cRet += '<tr>'
FOR nI := 1 TO Len( Self:aColumns ) FOR nI := 1 TO Len( ::aColumns )
cRet += '<th>' + UHtmlEncode( Self:aColumns[ nI, 2 ] ) + '</th>' cRet += '<th>' + UHtmlEncode( ::aColumns[ nI ][ 2 ] ) + '</th>'
NEXT NEXT
cRet += '</tr>' cRet += '</tr>'
@@ -364,20 +364,21 @@ METHOD Output() CLASS UWBrowse
ENDIF ENDIF
DO WHILE ! Eof() DO WHILE ! Eof()
cRet += '<tr>' cRet += '<tr>'
FOR nI := 1 TO Len( Self:aColumns ) FOR nI := 1 TO Len( ::aColumns )
xField := Self:aColumns[ nI, 3 ] xField := ::aColumns[ nI ][ 3 ]
IF HB_ISSTRING( xField ) DO CASE
CASE HB_ISSTRING( xField )
xI := FieldGet( FieldPos( xField ) ) xI := FieldGet( FieldPos( xField ) )
ELSEIF HB_ISEVALITEM( xField ) CASE HB_ISEVALITEM( xField )
xI := Eval( xField ) xI := Eval( xField )
ENDIF ENDCASE
SWITCH ValType( xI ) SWITCH ValType( xI )
CASE "C" ; xI := RTrim( xI ); EXIT CASE "C" ; xI := RTrim( xI ); EXIT
CASE "N" ; xI := Str( xI ); EXIT CASE "N" ; xI := Str( xI ); EXIT
CASE "D" ; xI := DToC( xI ); EXIT CASE "D" ; xI := DToC( xI ); EXIT
OTHERWISE ; xI := "ValType()==" + ValType( xI ) OTHERWISE ; xI := "ValType()==" + ValType( xI )
ENDSWITCH ENDSWITCH
IF ! Self:aColumns[ nI, 4 ] IF ! ::aColumns[ nI ][ 4 ]
xI := UHtmlEncode( xI ) xI := UHtmlEncode( xI )
ENDIF ENDIF
cRet += '<td><nobr>' + xI + '</nobr></td>' cRet += '<td><nobr>' + xI + '</nobr></td>'
@@ -462,7 +463,7 @@ PROCEDURE UProcWidgets( cURL, aMap )
nI := 1 nI := 1
nL := Min( Len( aURL ), Len( aStack ) ) nL := Min( Len( aURL ), Len( aStack ) )
DO WHILE nI <= nL DO WHILE nI <= nL
IF aStack[ nI, 1 ] == aURL[ nI ] IF aStack[ nI ][ 1 ] == aURL[ nI ]
nI++ nI++
ELSE ELSE
EXIT EXIT
@@ -523,7 +524,7 @@ PROCEDURE UWDefaultHandler( cMethod )
IF cMethod == "GET" IF cMethod == "GET"
IF ( cID := hb_HGetDef( get, "ajax" ) ) == NIL IF ( cID := hb_HGetDef( get, "ajax" ) ) == NIL
session[ "_uthis", "main" ]:Paint() session[ "_uthis" ][ "main" ]:Paint()
ELSE ELSE
IF ( oW := UGetWidgetById( cID ) ) != NIL IF ( oW := UGetWidgetById( cID ) ) != NIL
UAddHeader( "Content-type", "text/html; charset=UTF-8" ) UAddHeader( "Content-type", "text/html; charset=UTF-8" )
@@ -538,13 +539,13 @@ STATIC PROCEDURE SetWId( oW, cID )
IF cID != NIL IF cID != NIL
oW:cID := cID oW:cID := cID
session[ "_uthis", "idhash", cID ] := oW session[ "_uthis" ][ "idhash" ][ cID ] := oW
ENDIF ENDIF
RETURN RETURN
FUNCTION UGetWidgetById( cID ) FUNCTION UGetWidgetById( cID )
RETURN hb_HGetDef( session[ "_uthis", "idhash" ], cID ) RETURN hb_HGetDef( session[ "_uthis" ][ "idhash" ], cID )
STATIC FUNCTION uhttpd_split( cSeparator, cString ) STATIC FUNCTION uhttpd_split( cSeparator, cString )

View File

@@ -1100,7 +1100,7 @@ STATIC FUNCTION __AttrToStr( cName, cValue, aAttr, oTHtmlNode )
RETURN oTHtmlNode:error( "Invalid HTML attribute for: <" + oTHtmlNode:htmlTagName + ">", oTHtmlNode:className(), cName, EG_ARG, { cName, cValue } ) RETURN oTHtmlNode:error( "Invalid HTML attribute for: <" + oTHtmlNode:htmlTagName + ">", oTHtmlNode:className(), cName, EG_ARG, { cName, cValue } )
ENDIF ENDIF
IF aAttr[ nPos, 2 ] == HTML_ATTR_TYPE_BOOL IF aAttr[ nPos ][ 2 ] == HTML_ATTR_TYPE_BOOL
RETURN " " + cName RETURN " " + cName
ENDIF ENDIF
@@ -1326,7 +1326,7 @@ METHOD setAttribute( cName, cValue ) CLASS THtmlNode
RETURN ::error( "Invalid HTML attribute for: <" + ::htmlTagName + ">", ::className(), cName, EG_ARG, { cName, cValue } ) RETURN ::error( "Invalid HTML attribute for: <" + ::htmlTagName + ">", ::className(), cName, EG_ARG, { cName, cValue } )
ENDIF ENDIF
IF aAttr[ nPos, 2 ] == HTML_ATTR_TYPE_BOOL IF aAttr[ nPos ][ 2 ] == HTML_ATTR_TYPE_BOOL
hHash[ cName ] := "" hHash[ cName ] := ""
ELSE ELSE
hHash[ cName ] := cValue hHash[ cName ] := cValue

View File

@@ -143,14 +143,14 @@ METHOD addWindows( nRow ) CLASS HBDbObject
nMaxLen := 0 nMaxLen := 0
AEval( ::pItems, {| x | nMaxLen := Max( nMaxLen, Len( x[ OMSG_NAME ] ) ) } ) AEval( ::pItems, {| x | nMaxLen := Max( nMaxLen, Len( x[ OMSG_NAME ] ) ) } )
oBrwSets:AddColumn( oCol := HBDbColumnNew( "", {|| ::pItems[ ::arrayindex, OMSG_NAME ] } ) ) oBrwSets:AddColumn( oCol := HBDbColumnNew( "", {|| ::pItems[ ::arrayindex ][ OMSG_NAME ] } ) )
oCol:width := nMaxLen oCol:width := nMaxLen
oCol:DefColor := { 1, 2 } oCol:DefColor := { 1, 2 }
oBrwSets:Freeze := 1 oBrwSets:Freeze := 1
oBrwSets:AddColumn( oCol := HBDbColumnNew( "", {|| iif( ! ::pItems[ ::ArrayIndex, OMSG_EDIT ], ; oBrwSets:AddColumn( oCol := HBDbColumnNew( "", {|| iif( ! ::pItems[ ::ArrayIndex ][ OMSG_EDIT ], ;
::pItems[ ::ArrayIndex, OMSG_VALUE ], ; ::pItems[ ::ArrayIndex ][ OMSG_VALUE ], ;
__dbgValToExp( __dbgObjGetValue( ::TheObj, ::pItems[ ::arrayindex, OMSG_NAME ] ) ) ) } ) ) __dbgValToExp( __dbgObjGetValue( ::TheObj, ::pItems[ ::arrayindex ][ OMSG_NAME ] ) ) ) } ) )
oCol:DefColor := { 1, 3 } oCol:DefColor := { 1, 3 }
oCol:width := oWndSets:nRight - oWndSets:nLeft - nMaxLen - 2 oCol:width := oWndSets:nRight - oWndSets:nLeft - nMaxLen - 2

View File

@@ -141,10 +141,9 @@ FUNCTION sx_IniHeader( cHeaderName, nArea )
nArea := Select() nArea := Select()
ENDIF ENDIF
IF nArea $ SxIniInfo IF nArea $ SxIniInfo .AND. ;
IF cHeaderName $ SxIniInfo[ nArea ] cHeaderName $ SxIniInfo[ nArea ]
RETURN SxIniInfo[ nArea, cHeaderName ] RETURN SxIniInfo[ nArea ][ cHeaderName ]
ENDIF
ENDIF ENDIF
RETURN {} RETURN {}

View File

@@ -322,7 +322,7 @@ STATIC FUNCTION __i18n_ItemToStr( item )
cSource := "~" + Left( cSource, tmp - 1 ) + Str( Val( SubStr( cSource, tmp + 1 ) ), 10, 0 ) cSource := "~" + Left( cSource, tmp - 1 ) + Str( Val( SubStr( cSource, tmp + 1 ) ), 10, 0 )
ENDIF ENDIF
RETURN cSource + item[ _I18N_MSGID, 1 ] RETURN cSource + item[ _I18N_MSGID ][ 1 ]
FUNCTION __i18n_potArrayClean( aTrans, lKeepSource, lKeepVoidTranslations, bTransformTranslation ) FUNCTION __i18n_potArrayClean( aTrans, lKeepSource, lKeepVoidTranslations, bTransformTranslation )
@@ -337,7 +337,7 @@ FUNCTION __i18n_potArrayClean( aTrans, lKeepSource, lKeepVoidTranslations, bTran
FOR EACH item IN aTrans FOR EACH item IN aTrans
IF HB_ISEVALITEM( bTransformTranslation ) IF HB_ISEVALITEM( bTransformTranslation )
FOR EACH cString IN item[ _I18N_MSGSTR ] FOR EACH cString IN item[ _I18N_MSGSTR ]
tmp := Eval( bTransformTranslation, cString, item[ _I18N_MSGID, cString:__enumIndex() ] ) tmp := Eval( bTransformTranslation, cString, item[ _I18N_MSGID ][ cString:__enumIndex() ] )
IF HB_ISSTRING( tmp ) IF HB_ISSTRING( tmp )
cString := tmp cString := tmp
ENDIF ENDIF
@@ -352,7 +352,7 @@ FUNCTION __i18n_potArrayClean( aTrans, lKeepSource, lKeepVoidTranslations, bTran
FOR EACH item IN aTrans DESCEND FOR EACH item IN aTrans DESCEND
lVoid := .T. lVoid := .T.
FOR EACH cString IN item[ _I18N_MSGSTR ] FOR EACH cString IN item[ _I18N_MSGSTR ]
IF ! Empty( cString ) .AND. !( cString == item[ _I18N_MSGID, cString:__enumIndex() ] ) IF ! Empty( cString ) .AND. ! cString == item[ _I18N_MSGID ][ cString:__enumIndex() ]
lVoid := .F. lVoid := .F.
EXIT EXIT
ENDIF ENDIF
@@ -371,31 +371,31 @@ FUNCTION __i18n_potArraySave( cFile, aTrans, /* @ */ cErrorMsg, lVersionNo, lSou
LOCAL aItem LOCAL aItem
LOCAL hFile LOCAL hFile
LOCAL lRet, lPlural LOCAL lRet, lPlural
LOCAL cEol, cPOT, cFlg LOCAL cEOL, cPOT, cFlg
LOCAL msg LOCAL msg
hb_default( @lVersionNo, .T. ) hb_default( @lVersionNo, .T. )
hb_default( @lSourceRef, .T. ) hb_default( @lSourceRef, .T. )
lRet := .F. lRet := .F.
cEol := hb_eol() cEOL := hb_eol()
cFlg := "#, c-format" + cEol cFlg := "#, c-format" + cEOL
cPOT := iif( hb_FileExists( cFile ) .AND. __i18n_IsBOM_UTF8( cFile ), _UTF8_BOM + cEol, "" ) + ; /* Put it in separate line to less confuse non-BOM aware parsers */ cPOT := iif( hb_FileExists( cFile ) .AND. __i18n_IsBOM_UTF8( cFile ), _UTF8_BOM + cEOL, "" ) + ; /* Put it in separate line to less confuse non-BOM aware parsers */
"#" + cEol + ; "#" + cEOL + ;
"# This file is generated by " + iif( lVersionNo, hb_Version(), "Harbour" ) + cEol + ; "# This file is generated by " + iif( lVersionNo, hb_Version(), "Harbour" ) + cEOL + ;
"#" + cEol "#" + cEOL
FOR EACH aItem IN aTrans FOR EACH aItem IN aTrans
cPOT += cEol cPOT += cEOL
IF lSourceRef .AND. ! Empty( aItem[ _I18N_SOURCE ] ) IF lSourceRef .AND. ! Empty( aItem[ _I18N_SOURCE ] )
cPOT += "#: " cPOT += "#: "
cPOT += aItem[ _I18N_SOURCE ] cPOT += aItem[ _I18N_SOURCE ]
cPOT += cEol cPOT += cEOL
ENDIF ENDIF
cPOT += cFlg cPOT += cFlg
IF ! aItem[ _I18N_CONTEXT ] == "" IF ! aItem[ _I18N_CONTEXT ] == ""
cPOT += "msgctxt " cPOT += "msgctxt "
cPOT += __i18n_strEncode( aItem[ _I18N_CONTEXT ] ) cPOT += __i18n_strEncode( aItem[ _I18N_CONTEXT ] )
cPOT += cEol cPOT += cEOL
ENDIF ENDIF
FOR EACH msg IN aItem[ _I18N_MSGID ] FOR EACH msg IN aItem[ _I18N_MSGID ]
SWITCH msg:__enumIndex() SWITCH msg:__enumIndex()
@@ -409,7 +409,7 @@ FUNCTION __i18n_potArraySave( cFile, aTrans, /* @ */ cErrorMsg, lVersionNo, lSou
cPOT += "msgid_plural" + hb_ntos( msg:__enumIndex() - 1 ) + " " cPOT += "msgid_plural" + hb_ntos( msg:__enumIndex() - 1 ) + " "
ENDSWITCH ENDSWITCH
cPOT += __i18n_strEncode( msg ) cPOT += __i18n_strEncode( msg )
cPOT += cEol cPOT += cEOL
NEXT NEXT
lPlural := aItem[ _I18N_PLURAL ] .OR. Len( aItem[ _I18N_MSGSTR ] ) > 1 lPlural := aItem[ _I18N_PLURAL ] .OR. Len( aItem[ _I18N_MSGSTR ] ) > 1
FOR EACH msg IN aItem[ _I18N_MSGSTR ] FOR EACH msg IN aItem[ _I18N_MSGSTR ]
@@ -419,7 +419,7 @@ FUNCTION __i18n_potArraySave( cFile, aTrans, /* @ */ cErrorMsg, lVersionNo, lSou
cPOT += "msgstr " cPOT += "msgstr "
ENDIF ENDIF
cPOT += __i18n_strEncode( msg ) cPOT += __i18n_strEncode( msg )
cPOT += cEol cPOT += cEOL
NEXT NEXT
NEXT NEXT
@@ -449,21 +449,21 @@ FUNCTION __i18n_potArrayToHash( aTrans, lEmpty, hI18N )
hTrans := hI18N[ "CONTEXT" ] hTrans := hI18N[ "CONTEXT" ]
FOR EACH aItem IN aTrans FOR EACH aItem IN aTrans
IF lEmpty .OR. ! Empty( aItem[ _I18N_MSGSTR, 1 ] ) IF lEmpty .OR. ! Empty( aItem[ _I18N_MSGSTR ][ 1 ] )
cContext := aItem[ _I18N_CONTEXT ] cContext := aItem[ _I18N_CONTEXT ]
IF cContext $ hTrans IF cContext $ hTrans
hContext := hTrans[ cContext ] hContext := hTrans[ cContext ]
ELSE ELSE
hTrans[ cContext ] := hContext := { => } hTrans[ cContext ] := hContext := { => }
ENDIF ENDIF
IF Empty( aItem[ _I18N_MSGSTR, 1 ] ) IF Empty( aItem[ _I18N_MSGSTR ][ 1 ] )
IF ! aItem[ _I18N_MSGID, 1 ] $ hContext IF ! aItem[ _I18N_MSGID ][ 1 ] $ hContext
hContext[ aItem[ _I18N_MSGID, 1 ] ] := iif( aItem[ _I18N_PLURAL ], ; hContext[ aItem[ _I18N_MSGID ][ 1 ] ] := iif( aItem[ _I18N_PLURAL ], ;
AClone( aItem[ _I18N_MSGID ] ), aItem[ _I18N_MSGID, 1 ] ) AClone( aItem[ _I18N_MSGID ] ), aItem[ _I18N_MSGID ][ 1 ] )
ENDIF ENDIF
ELSE ELSE
hContext[ aItem[ _I18N_MSGID, 1 ] ] := iif( aItem[ _I18N_PLURAL ], ; hContext[ aItem[ _I18N_MSGID ][ 1 ] ] := iif( aItem[ _I18N_PLURAL ], ;
AClone( aItem[ _I18N_MSGSTR ] ), aItem[ _I18N_MSGSTR, 1 ] ) AClone( aItem[ _I18N_MSGSTR ] ), aItem[ _I18N_MSGSTR ][ 1 ] )
ENDIF ENDIF
ENDIF ENDIF
NEXT NEXT
@@ -484,9 +484,9 @@ FUNCTION __i18n_potArrayTrans( aTrans, hI18N )
cContext := aItem[ _I18N_CONTEXT ] cContext := aItem[ _I18N_CONTEXT ]
IF cContext $ hTrans IF cContext $ hTrans
hContext := hTrans[ cContext ] hContext := hTrans[ cContext ]
IF Empty( aItem[ _I18N_MSGSTR, 1 ] ) IF Empty( aItem[ _I18N_MSGSTR ][ 1 ] )
IF aItem[ _I18N_MSGID, 1 ] $ hContext IF aItem[ _I18N_MSGID ][ 1 ] $ hContext
xTrans := hContext[ aItem[ _I18N_MSGID, 1 ] ] xTrans := hContext[ aItem[ _I18N_MSGID ][ 1 ] ]
IF aItem[ _I18N_PLURAL ] IF aItem[ _I18N_PLURAL ]
aItem[ _I18N_MSGSTR ] := iif( HB_ISARRAY( xTrans ), ; aItem[ _I18N_MSGSTR ] := iif( HB_ISARRAY( xTrans ), ;
AClone( xTrans ), { xTrans } ) AClone( xTrans ), { xTrans } )
@@ -533,13 +533,13 @@ FUNCTION __i18n_potArrayJoin( aTrans, aTrans2, hIndex )
IF ! HB_ISHASH( hIndex ) IF ! HB_ISHASH( hIndex )
hIndex := { => } hIndex := { => }
FOR EACH aItem in aTrans FOR EACH aItem in aTrans
ctx := aItem[ _I18N_CONTEXT ] + _I18N_DELIM + aItem[ _I18N_MSGID, 1 ] ctx := aItem[ _I18N_CONTEXT ] + _I18N_DELIM + aItem[ _I18N_MSGID ][ 1 ]
hIndex[ ctx ] := aItem:__enumIndex() hIndex[ ctx ] := aItem:__enumIndex()
NEXT NEXT
ENDIF ENDIF
FOR EACH aItem in aTrans2 FOR EACH aItem in aTrans2
ctx := aItem[ _I18N_CONTEXT ] + _I18N_DELIM + aItem[ _I18N_MSGID, 1 ] ctx := aItem[ _I18N_CONTEXT ] + _I18N_DELIM + aItem[ _I18N_MSGID ][ 1 ]
IF ctx $ hIndex IF ctx $ hIndex
aDest := aTrans[ hIndex[ ctx ] ] aDest := aTrans[ hIndex[ ctx ] ]
IF aItem[ _I18N_PLURAL ] IF aItem[ _I18N_PLURAL ]
@@ -561,7 +561,7 @@ FUNCTION __i18n_potArrayJoin( aTrans, aTrans2, hIndex )
IF ! Empty( aItem[ _I18N_MSGSTR ] ) .AND. ; IF ! Empty( aItem[ _I18N_MSGSTR ] ) .AND. ;
( Empty( aDest[ _I18N_MSGSTR ] ) .OR. ; ( Empty( aDest[ _I18N_MSGSTR ] ) .OR. ;
( Len( aDest[ _I18N_MSGSTR ] ) == 1 .AND. ; ( Len( aDest[ _I18N_MSGSTR ] ) == 1 .AND. ;
Empty( aDest[ _I18N_MSGSTR, 1 ] ) ) ) Empty( aDest[ _I18N_MSGSTR ][ 1 ] ) ) )
aDest[ _I18N_MSGSTR ] := AClone( aItem[ _I18N_MSGSTR ] ) aDest[ _I18N_MSGSTR ] := AClone( aItem[ _I18N_MSGSTR ] )
ENDIF ENDIF
ELSE ELSE
@@ -595,7 +595,7 @@ FUNCTION hb_i18n_SavePOT( cFile, pI18N, /* @ */ cErrorMsg )
LOCAL hI18N LOCAL hI18N
LOCAL hFile LOCAL hFile
LOCAL lRet := .T. LOCAL lRet := .T.
LOCAL cEol, cPOT, cFlg LOCAL cEOL, cPOT, cFlg
LOCAL context, trans, msgctxt, msgstr LOCAL context, trans, msgctxt, msgstr
IF HB_ISPOINTER( pI18N ) IF HB_ISPOINTER( pI18N )
@@ -605,35 +605,35 @@ FUNCTION hb_i18n_SavePOT( cFile, pI18N, /* @ */ cErrorMsg )
cErrorMsg := "wrong translation set item" cErrorMsg := "wrong translation set item"
lRet := .F. lRet := .F.
ELSE ELSE
cEol := hb_eol() cEOL := hb_eol()
cFlg := "#, c-format" + cEol cFlg := "#, c-format" + cEOL
cPOT := ; cPOT := ;
"#" + cEol + ; "#" + cEOL + ;
"# This file is generated by " + hb_Version() + cEol + ; "# This file is generated by " + hb_Version() + cEOL + ;
"#" + cEol "#" + cEOL
FOR EACH context IN hI18N[ "CONTEXT" ] FOR EACH context IN hI18N[ "CONTEXT" ]
msgctxt := iif( context:__enumKey() == "", NIL, ; msgctxt := iif( context:__enumKey() == "", NIL, ;
"msgctxt " + __i18n_strEncode( context:__enumKey() ) + cEol ) "msgctxt " + __i18n_strEncode( context:__enumKey() ) + cEOL )
FOR EACH trans IN context FOR EACH trans IN context
cPOT += cEol + cFlg cPOT += cEOL + cFlg
IF msgctxt != NIL IF msgctxt != NIL
cPOT += msgctxt cPOT += msgctxt
ENDIF ENDIF
cPOT += "msgid " cPOT += "msgid "
cPOT += __i18n_strEncode( trans:__enumKey() ) cPOT += __i18n_strEncode( trans:__enumKey() )
cPOT += cEol cPOT += cEOL
IF HB_ISARRAY( trans ) IF HB_ISARRAY( trans )
FOR EACH msgstr IN trans FOR EACH msgstr IN trans
cPOT += "msgstr[" cPOT += "msgstr["
cPOT += hb_ntos( msgstr:__enumIndex() - 1 ) cPOT += hb_ntos( msgstr:__enumIndex() - 1 )
cPOT += "] " cPOT += "] "
cPOT += __i18n_strEncode( msgstr ) cPOT += __i18n_strEncode( msgstr )
cPOT += cEol cPOT += cEOL
NEXT NEXT
ELSE ELSE
cPOT += "msgstr " cPOT += "msgstr "
cPOT += __i18n_strEncode( trans ) cPOT += __i18n_strEncode( trans )
cPOT += cEol cPOT += cEOL
ENDIF ENDIF
NEXT NEXT
NEXT NEXT

View File

@@ -547,8 +547,8 @@ METHOD colorRect( aRect, aColors ) CLASS TBrowse
FOR nRow := aRect[ 1 ] TO aRect[ 3 ] FOR nRow := aRect[ 1 ] TO aRect[ 3 ]
::readRecord( nRow ) ::readRecord( nRow )
FOR nCol := aRect[ 2 ] TO aRect[ 4 ] FOR nCol := aRect[ 2 ] TO aRect[ 4 ]
::aCellColors[ nRow, nCol ][ 1 ] := aColors[ 1 ] ::aCellColors[ nRow ][ nCol ][ 1 ] := aColors[ 1 ]
::aCellColors[ nRow, nCol ][ 2 ] := aColors[ 2 ] ::aCellColors[ nRow ][ nCol ][ 2 ] := aColors[ 2 ]
NEXT NEXT
::dispRow( nRow ) ::dispRow( nRow )
NEXT NEXT
@@ -612,7 +612,7 @@ METHOD readRecord( nRow ) CLASS TBrowse
IF nRow <= ::nLastRow IF nRow <= ::nLastRow
nToMove := nRow - ::nBufferPos nToMove := nRow - ::nBufferPos
nMoved := _SKIP_RESULT( Eval( ::bSkipBlock, nToMove ) ) nMoved := _SKIP_RESULT( Eval( ::bSkipBlock, nToMove ) )
/* TOFIX: add protection against unexpected results /* FIXME: add protection against unexpected results
* CA-Cl*pper does not fully respect here the returned * CA-Cl*pper does not fully respect here the returned
* value and current code below replicates what Clipper * value and current code below replicates what Clipper
* seems to do but it means that in network environment * seems to do but it means that in network environment
@@ -802,7 +802,7 @@ METHOD stabilize() CLASS TBrowse
::nRowPos := ::nLastRow ::nRowPos := ::nLastRow
ENDIF ENDIF
IF ::nBufferPos != ::nRowPos IF ::nBufferPos != ::nRowPos
/* TOFIX: add protection against unexpected results /* FIXME: add protection against unexpected results
* CA-Cl*pper does not fully respect here the returned * CA-Cl*pper does not fully respect here the returned
* value and current code below replicates what Clipper * value and current code below replicates what Clipper
* seems to do but it means that in network environment * seems to do but it means that in network environment
@@ -881,7 +881,7 @@ METHOD cellValue( nRow, nCol ) CLASS TBrowse
nCol >= 1 .AND. nCol <= ::colCount .AND. ; nCol >= 1 .AND. nCol <= ::colCount .AND. ;
::aCellStatus[ nRow ] ::aCellStatus[ nRow ]
RETURN ::aCellValues[ nRow, nCol ] RETURN ::aCellValues[ nRow ][ nCol ]
ENDIF ENDIF
RETURN NIL RETURN NIL
@@ -893,7 +893,7 @@ METHOD cellColor( nRow, nCol ) CLASS TBrowse
nCol >= 1 .AND. nCol <= ::colCount .AND. ; nCol >= 1 .AND. nCol <= ::colCount .AND. ;
::aCellStatus[ nRow ] ::aCellStatus[ nRow ]
RETURN ::aCellColors[ nRow, nCol ] RETURN ::aCellColors[ nRow ][ nCol ]
ENDIF ENDIF
RETURN NIL RETURN NIL

View File

@@ -387,11 +387,11 @@ PROCEDURE Main_ARRAY()
HBTEST AScan( saAllTypes, sbBlock ) IS 0 HBTEST AScan( saAllTypes, sbBlock ) IS 0
HBTEST AScan( saAllTypes, sbBlockC ) IS 0 HBTEST AScan( saAllTypes, sbBlockC ) IS 0
HBTEST AScan( saAllTypes, saArray ) IS 0 HBTEST AScan( saAllTypes, saArray ) IS 0
SET EXACT ON Set( _SET_EXACT, .T. )
HBTEST AScan( saAllTypes, scString ) IS 1 HBTEST AScan( saAllTypes, scString ) IS 1
HBTEST AScan( saAllTypes, scStringE ) IS 2 HBTEST AScan( saAllTypes, scStringE ) IS 2
HBTEST AScan( saAllTypes, scStringZ ) IS 3 HBTEST AScan( saAllTypes, scStringZ ) IS 3
SET EXACT OFF Set( _SET_EXACT, .F. )
HBTEST TAEVSM() IS "N10N 9N 8N 7N 6N 5N 4N 3N 2N 1 0" /* Bug in CA-Cl*pper 5.x */, "N10N 9N 8N 7N 6 5" HBTEST TAEVSM() IS "N10N 9N 8N 7N 6N 5N 4N 3N 2N 1 0" /* Bug in CA-Cl*pper 5.x */, "N10N 9N 8N 7N 6 5"
HBTEST TASOSM1() IS "NN 5NN 4NN 3NN 2NN 1NN 0NN 0NN 0NN 0NN 0NN 0NN 0 0{ }" , "NN 5NN 4 3{ 2, 1, 3 }" HBTEST TASOSM1() IS "NN 5NN 4NN 3NN 2NN 1NN 0NN 0NN 0NN 0NN 0NN 0NN 0 0{ }" , "NN 5NN 4 3{ 2, 1, 3 }"