diff --git a/ChangeLog.txt b/ChangeLog.txt index 27422fae7d..4f5f16ae0a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,31 @@ Entries may not always be in chronological/commit order. 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) * contrib/hbwin/hbwin.hbp * contrib/hbwin/wapi_winbase.c -> contrib/hbwin/wapi_winbase_1.c diff --git a/contrib/gtwvg/class.prg b/contrib/gtwvg/class.prg index f436324f0e..b104ffb2cf 100644 --- a/contrib/gtwvg/class.prg +++ b/contrib/gtwvg/class.prg @@ -222,13 +222,13 @@ METHOD WvtDialog:Create() LOCAL aPalette, i, j ::oldToolTipActive := wvt_SetToolTipActive( .T. ) - IF ::nTooltipWidth != nil + IF ::nTooltipWidth != NIL wvt_SetToolTipWidth( ::nTooltipWidth ) ENDIF - IF ::nTooltipBkColor != nil + IF ::nTooltipBkColor != NIL wvt_SetToolTipBkColor( ::nTooltipBkColor ) ENDIF - IF ::nTooltipTextColor != nil + IF ::nTooltipTextColor != NIL wvt_SetToolTipTextColor( ::nTooltipTextColor ) ENDIF @@ -268,7 +268,7 @@ METHOD WvtDialog:Create() IF ! Empty( ::aObjects[ i ]:aPaint ) FOR j := 1 TO Len( ::aObjects[ i ]:aPaint ) 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 ENDIF NEXT @@ -531,7 +531,7 @@ METHOD WvtDialog:Inkey() IF ::nCurObj > 0 IF ! Empty( ::aDialogKeys ) IF ( n := AScan( ::aDialogKeys, {| e_ | e_[ 1 ] == ::nKey } ) ) > 0 - Eval( ::aDialogKeys[ n, 2 ], Self, ::oCurObj ) + Eval( ::aDialogKeys[ n ][ 2 ], Self, ::oCurObj ) ENDIF ENDIF @@ -540,7 +540,7 @@ METHOD WvtDialog:Inkey() IF ::lEventHandled IF ::oCurObj:nChildren > 0 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 ) ENDIF NEXT @@ -571,7 +571,7 @@ METHOD WvtDialog:MouseOver() mCol >= o:nLeft .AND. mCol <= o:nRight } ) ::nObjOver := nObj - ::oObjOver := iif( nObj > 0, ::aObjects[ nObj ], nil ) + ::oObjOver := iif( nObj > 0, ::aObjects[ nObj ], NIL ) IF nObj > 0 ::aObjects[ nObj ]:nmRow := mRow ::aObjects[ nObj ]:nmCol := mCol @@ -879,9 +879,9 @@ METHOD WvtObject:Destroy() ::hFont := NIL ENDIF - IF ::hPopup != nil + IF ::hPopup != NIL wvt_DestroyMenu( ::hPopup ) - ::hPopup := nil + ::hPopup := NIL ENDIF RETURN NIL @@ -890,16 +890,16 @@ METHOD WvtObject:CreatePopup() LOCAL i, nID - IF ! Empty( ::aPopup ) .AND. ::hPopup == nil + IF ! Empty( ::aPopup ) .AND. ::hPopup == NIL ::hPopup := wvt_CreatePopupMenu() FOR i := 1 TO Len( ::aPopup ) ASize( ::aPopup[ i ], 3 ) 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 ENDIF @@ -909,7 +909,7 @@ METHOD WvtObject:ShowPopup() LOCAL lRet := .F., nRet, n, aPos - IF ::hPopup != nil + IF ::hPopup != NIL aPos := wvt_GetCursorPos() nRet := wvt_TrackPopupMenu( ::hPopup, TPM_CENTERALIGN + TPM_RETURNCMD, ; @@ -918,8 +918,8 @@ METHOD WvtObject:ShowPopup() IF ( n := AScan( ::aPopup, {| e_ | e_[ 3 ] == nRet } ) ) > 0 lRet := .T. - IF HB_ISBLOCK( ::aPopup[ n, 2 ] ) - Eval( ::aPopup[ n, 2 ] ) + IF HB_ISBLOCK( ::aPopup[ n ][ 2 ] ) + Eval( ::aPopup[ n ][ 2 ] ) ENDIF ENDIF ENDIF @@ -1090,23 +1090,23 @@ METHOD WvtBrowse:NotifyChild( nIndex, nKey, oCurObj ) LOCAL xData, i IF nIndex > 0 .AND. nIndex <= Len( ::aChildren ) - IF HB_ISBLOCK( ::aChildren[ nIndex, OBJ_CHILD_DATABLOCK ] ) - xData := Eval( ::aChildren[ nIndex, OBJ_CHILD_DATABLOCK ] ) + IF HB_ISBLOCK( ::aChildren[ nIndex ][ OBJ_CHILD_DATABLOCK ] ) + xData := Eval( ::aChildren[ nIndex ][ OBJ_CHILD_DATABLOCK ] ) ENDIF - Eval( ::aChildren[ nIndex, OBJ_CHILD_REFRESHBLOCK ], ; - ::aChildren[ nIndex, OBJ_CHILD_OBJ ], ; - ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:oParent:cPaintBlockID, ; - ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:oBrw, ; + Eval( ::aChildren[ nIndex ][ OBJ_CHILD_REFRESHBLOCK ], ; + ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ], ; + ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ]:oParent:cPaintBlockID, ; + ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ]:oBrw, ; nKey, ; 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 */ - 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 - ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:NotifyChild( i, nKey, ::aChildren[ nIndex, OBJ_CHILD_OBJ ] ) + FOR i := 1 to ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ]:nChildren + ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ]:NotifyChild( i, nKey, ::aChildren[ nIndex ][ OBJ_CHILD_OBJ ] ) NEXT /* Restore previous environments */ @@ -1149,7 +1149,7 @@ METHOD WvtBrowse:SetTooltip() ::RestSettings() ENDIF - IF cTip != nil + IF cTip != NIL ::Tooltip := cTip ENDIF @@ -1271,7 +1271,7 @@ METHOD WvtStatusBar:SetPanels( aPanels ) AAdd( ::aPanels, oPanel ) - IF aPanels != nil + IF aPanels != NIL FOR i := 1 TO Len( aPanels ) IF ::oParent:MaxCol() > aPanels[ i ] oPanel := WvtPanel():New( ::oParent, ++nID, ::nTop, aPanels[ i ] ) @@ -2002,11 +2002,11 @@ METHOD WvtGets:Create() FOR i := 1 TO Len( ::aGetList ) - __defaultNIL( @::aGetList[ i, 7 ], "N/W*,N/W*,,,N/GR*" ) - __defaultNIL( @::aGetList[ i, 5 ], {|| .T. } ) - __defaultNIL( @::aGetList[ i, 6 ], {|| .T. } ) + __defaultNIL( @::aGetList[ i ][ 7 ], "N/W*,N/W*,,,N/GR*" ) + __defaultNIL( @::aGetList[ i ][ 5 ], {|| .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() ::PaintBlock( i ) @@ -2022,13 +2022,13 @@ METHOD WvtGets:PaintBlock( nIndex ) 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, ; - { WVT_BLOCK_GETS, ::aGetList[ nIndex, 1 ] - 1, ::aGetList[ nIndex, 2 ] - 1, ; - ::aGetList[ nIndex, 1 ] - 1, ::aGetList[ nIndex, 2 ] + nLen } } ) + { WVT_BLOCK_GETS, ::aGetList[ nIndex ][ 1 ] - 1, ::aGetList[ nIndex ][ 2 ] - 1, ; + ::aGetList[ nIndex ][ 1 ] - 1, ::aGetList[ nIndex ][ 2 ] + nLen } } ) RETURN Self @@ -3009,8 +3009,8 @@ METHOD wvtMenu:DelItem( nItemNum ) LOCAL lResult := .F. IF nItemNum > 0 .AND. nItemNum <= ::NumItems() - IF ::aItems[ nItemNum, WVT_MENU_TYPE ] == MF_POPUP - ::aItems[ nItemNum, WVT_MENU_MENUOBJ ]:Destroy() + IF ::aItems[ nItemNum ][ WVT_MENU_TYPE ] == MF_POPUP + ::aItems[ nItemNum ][ WVT_MENU_MENUOBJ ]:Destroy() ENDIF IF ( lResult := wvt_DeleteMenu( ::hMenu, nItemNum - 1, MF_BYPOSITION ) ) /* Remember ZERO base */ @@ -3064,9 +3064,9 @@ METHOD wvtMenu:FindMenuItemById( nId ) IF ! Empty( nId ) x := ::NumItems() DO WHILE x > 0 .AND. Empty( aResult ) - IF ::aItems[ x, WVT_MENU_TYPE ] == MF_POPUP - aResult := ::aItems[ x, WVT_MENU_MENUOBJ ]:FindMenuItemById( nId ) - ELSEIF ::aItems[ x, WVT_MENU_IDENTIFIER ] == nId + IF ::aItems[ x ][ WVT_MENU_TYPE ] == MF_POPUP + aResult := ::aItems[ x ][ WVT_MENU_MENUOBJ ]:FindMenuItemById( nId ) + ELSEIF ::aItems[ x ][ WVT_MENU_IDENTIFIER ] == nId aResult := ::aItems[ x ] ENDIF x-- diff --git a/contrib/gtwvg/menubar.prg b/contrib/gtwvg/menubar.prg index b591e9d9cf..97f39b0923 100644 --- a/contrib/gtwvg/menubar.prg +++ b/contrib/gtwvg/menubar.prg @@ -214,8 +214,8 @@ METHOD WvgMenuBar:delItem( nItemNum ) LOCAL lResult := .F. IF nItemNum > 0 .AND. nItemNum <= ::numItems() - IF ::aMenuItems[ nItemNum, WVT_MENU_TYPE ] == MF_POPUP - ::aMenuItems[ nItemNum, WVT_MENU_MENUOBJ ]:Destroy() + IF ::aMenuItems[ nItemNum ][ WVT_MENU_TYPE ] == MF_POPUP + ::aMenuItems[ nItemNum ][ WVT_MENU_MENUOBJ ]:Destroy() ENDIF IF ( lResult := wvg_DeleteMenu( ::hMenu, nItemNum - 1, MF_BYPOSITION ) ) /* Remember ZERO base */ @@ -336,11 +336,11 @@ METHOD WvgMenuBar:findMenuItemById( nId ) x := ::numItems() DO WHILE x > 0 .AND. Empty( aResult ) - IF ::aMenuItems[ x, WVT_MENU_TYPE ] == MF_POPUP - aResult := ::aMenuItems[ x, WVT_MENU_MENUOBJ ]:findMenuItemById( nId ) + IF ::aMenuItems[ x ][ WVT_MENU_TYPE ] == MF_POPUP + aResult := ::aMenuItems[ x ][ WVT_MENU_MENUOBJ ]:findMenuItemById( nId ) - ELSEIF ::aMenuItems[ x, WVT_MENU_IDENTIFIER ] == nId - aResult := { x, ::aMenuItems[ x, WVT_MENU_ACTION ], ::sl_itemSelected, Self } + ELSEIF ::aMenuItems[ x ][ WVT_MENU_IDENTIFIER ] == nId + aResult := { x, ::aMenuItems[ x ][ WVT_MENU_ACTION ], ::sl_itemSelected, Self } ENDIF x-- @@ -357,10 +357,10 @@ METHOD WvgMenuBar:findMenuPosById( nId ) x := ::numItems() DO WHILE x > 0 .AND. Empty( nPos ) - IF ::aMenuItems[ x, WVT_MENU_TYPE ] == MF_POPUP - nPos := ::aMenuItems[ x, WVT_MENU_MENUOBJ ]:findMenuPosById( nId ) + IF ::aMenuItems[ x ][ WVT_MENU_TYPE ] == MF_POPUP + nPos := ::aMenuItems[ x ][ WVT_MENU_MENUOBJ ]:findMenuPosById( nId ) - ELSEIF ::aMenuItems[ x, WVT_MENU_IDENTIFIER ] == nId + ELSEIF ::aMenuItems[ x ][ WVT_MENU_IDENTIFIER ] == nId nPos := x ENDIF @@ -405,7 +405,11 @@ METHOD WvgMenuBar:disableItem( nItemNum ) METHOD WvgMenuBar:getItem( nItemNum ) 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 RETURN NIL diff --git a/contrib/gtwvg/paint.prg b/contrib/gtwvg/paint.prg index 15cc94d645..2b8c93510b 100644 --- a/contrib/gtwvg/paint.prg +++ b/contrib/gtwvg/paint.prg @@ -73,48 +73,48 @@ FUNCTION WvtPaintObjects() FOR i := 1 TO nBlocks 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 type of object and attributes contained in aAttr */ DO CASE - CASE aBlocks[ i, 3, 1 ] == WVT_BLOCK_GRID_V - b := aBlocks[ i, 3, 6 ] + CASE aBlocks[ i ][ 3 ][ 1 ] == WVT_BLOCK_GRID_V + b := aBlocks[ i ][ 3 ][ 6 ] IF Len( b:aColumnsSep ) == 0 lExe := .F. ELSE nLeft := b:aColumnsSep[ 1 ] nRight := b:aColumnsSep[ Len( b:aColumnsSep ) ] - IF !( tlbr_[ 1 ] <= aBlocks[ i, 3, 4 ] .AND. ; /* top < bottom */ - tlbr_[ 3 ] >= aBlocks[ i, 3, 2 ] .AND. ; /* bootm > top */ - tlbr_[ 2 ] <= nRight + 1 .AND. ; /* left < right */ - tlbr_[ 4 ] >= nLeft - 2 ) /* right > left */ + IF tlbr_[ 1 ] > aBlocks[ i ][ 3 ][ 4 ] .OR. ; /* top > bottom */ + tlbr_[ 3 ] < aBlocks[ i ][ 3 ][ 2 ] .OR. ; /* bottom < top */ + tlbr_[ 2 ] > nRight + 1 .OR. ; /* left > right */ + tlbr_[ 4 ] < nLeft - 2 /* right < left */ lExe := .F. ENDIF ENDIF - CASE aBlocks[ i, 3, 1 ] == WVT_BLOCK_GETS - IF !( tlbr_[ 1 ] <= aBlocks[ i, 3, 4 ] .AND. ; /* top < bott */ - tlbr_[ 3 ] >= aBlocks[ i, 3, 2 ] .AND. ; /* bootm > top */ - tlbr_[ 2 ] <= aBlocks[ i, 3, 5 ] .AND. ; /* left < righ */ - tlbr_[ 4 ] >= aBlocks[ i, 3, 3 ] ) /* right > left */ + CASE aBlocks[ i ][ 3 ][ 1 ] == WVT_BLOCK_GETS + IF tlbr_[ 1 ] > aBlocks[ i ][ 3 ][ 4 ] .OR. ; /* top > bottom */ + tlbr_[ 3 ] < aBlocks[ i ][ 3 ][ 2 ] .OR. ; /* bottom < top */ + tlbr_[ 2 ] > aBlocks[ i ][ 3 ][ 5 ] .OR. ; /* left > right */ + tlbr_[ 4 ] < aBlocks[ i ][ 3 ][ 3 ] /* right < left */ lExe := .F. ENDIF OTHERWISE - /* If refreshing rectangle's top is less than objects' bottom */ - /* and left is less than objects' right */ - /* */ - IF !( tlbr_[ 1 ] <= aBlocks[ i, 3, 4 ] .AND. ; /* top <= bottom */ - tlbr_[ 3 ] >= aBlocks[ i, 3, 2 ] .AND. ; /* bootm >= top */ - tlbr_[ 2 ] <= aBlocks[ i, 3, 5 ] .AND. ; /* left < right */ - tlbr_[ 4 ] >= aBlocks[ i, 3, 3 ] ) /* right > left */ + /* If refreshing rectangle's top is less than objects' bottom + * and left is less than objects' right + */ + IF tlbr_[ 1 ] > aBlocks[ i ][ 3 ][ 4 ] .OR. ; /* top > bottom */ + tlbr_[ 3 ] < aBlocks[ i ][ 3 ][ 2 ] .OR. ; /* bottom < top */ + tlbr_[ 2 ] > aBlocks[ i ][ 3 ][ 5 ] .OR. ; /* left > right */ + tlbr_[ 4 ] < aBlocks[ i ][ 3 ][ 3 ] /* right < left */ lExe := .F. ENDIF ENDCASE ENDIF IF lExe - Eval( aBlocks[ i, 2 ] ) + Eval( aBlocks[ i ][ 2 ] ) ENDIF NEXT ENDIF @@ -145,17 +145,17 @@ FUNCTION wvg_SetPaint( cID, nAction, xData, aAttr ) IF xData != NIL IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 - IF ( n1 := AScan( t_paint_[ n, 2 ], {| e_ | e_[ 1 ] == nAction } ) ) > 0 - oldData := t_paint_[ n, 2, n1, 2 ] - t_paint_[ n, 2, n1, 2 ] := xData - t_paint_[ n, 2, n1, 3 ] := aAttr + IF ( n1 := AScan( t_paint_[ n ][ 2 ], {| e_ | e_[ 1 ] == nAction } ) ) > 0 + oldData := t_paint_[ n ][ 2 ][ n1 ][ 2 ] + t_paint_[ n ][ 2 ][ n1 ][ 2 ] := xData + t_paint_[ n ][ 2 ][ n1 ][ 3 ] := aAttr ELSE - AAdd( t_paint_[ n, 2 ], { nAction, xData, aAttr } ) + AAdd( t_paint_[ n ][ 2 ], { nAction, xData, aAttr } ) ENDIF ELSE AAdd( t_paint_, { cID, {} } ) n := Len( t_paint_ ) - AAdd( t_paint_[ n, 2 ], { nAction, xData, aAttr } ) + AAdd( t_paint_[ n ][ 2 ], { nAction, xData, aAttr } ) ENDIF ENDIF @@ -166,7 +166,7 @@ FUNCTION wvg_GetPaint( cID ) LOCAL n IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 - RETURN t_paint_[ n, 2 ] + RETURN t_paint_[ n ][ 2 ] ENDIF RETURN {} @@ -176,9 +176,9 @@ FUNCTION wvg_DelPaint( cID, nAction ) LOCAL xData, n1, n IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 - IF ( n1 := AScan( t_paint_[ n, 2 ], {| e_ | e_[ 1 ] == nAction } ) ) > 0 - xData := t_paint_[ n, 2, n1, 2 ] - t_paint_[ n, 2, n1, 2 ] := {|| .T. } + IF ( n1 := AScan( t_paint_[ n ][ 2 ], {| e_ | e_[ 1 ] == nAction } ) ) > 0 + xData := t_paint_[ n ][ 2 ][ n1 ][ 2 ] + t_paint_[ n ][ 2 ][ n1 ][ 2 ] := {|| .T. } ENDIF ENDIF @@ -362,7 +362,7 @@ FUNCTION wvt_AddDlgItem( aDlg, nTop, nLeft, nRows, nCols, aOffSet, ; nH := nRows ENDIF - aDlg[ 1, 4 ]++ /* item count */ + aDlg[ 1 ][ 4 ]++ /* item count */ AAdd( aDlg[ 2 ], iif( HB_ISNUMERIC( nHelpId ), nHelpId, 0 ) ) AAdd( aDlg[ 3 ], iif( HB_ISNUMERIC( nExStyle ), nExStyle, 0 ) ) diff --git a/contrib/gtwvg/tests/_activex.prg b/contrib/gtwvg/tests/_activex.prg index 6802084838..257e0a9d0e 100644 --- a/contrib/gtwvg/tests/_activex.prg +++ b/contrib/gtwvg/tests/_activex.prg @@ -1,9 +1,9 @@ -/* - * Pritpal Bedi - */ +/* Pritpal Bedi */ #include "inkey.ch" +#include "setcurs.ch" #include "hbgtinfo.ch" +#include "hbver.ch" // The function has to be called via hb_threadStart( {|| ExecuteActiveX( nActiveX ) } ) @@ -13,15 +13,17 @@ FUNCTION ExecuteActiveX( nActiveX, xParam ) LOCAL oListBox, oStatic2, oDA LOCAL oPanel, oPanel1, oPanel2 -// LOCAL cVarA := "Test A", cVarB := "Test B" -// LOCAL aState := {"not selected", "selected", "undefined"} +#if 0 + LOCAL oCheck, oRadio, oMLE, cText + LOCAL cVarA := "Test A", cVarB := "Test B" + LOCAL aState := { "not selected", "selected", "undefined" } +#endif LOCAL aParts := {} -// LOCAL oCheck, oRadio, oMLE, cText HB_SYMBOL_UNUSED( xParam ) HB_SYMBOL_UNUSED( oCom ) - // --------------------------- Dialog -------------------------------\\ + // --- Dialog --- #if 1 oCrt := WvgDialog():new( , , { 30, 30 }, { 800, 600 }, , .T. ) oCrt:closable := .T. @@ -36,13 +38,13 @@ FUNCTION ExecuteActiveX( nActiveX, xParam ) oDA := oCrt:drawingArea - // --------------------------- Menu --------------------------------\\ + // --- Menu --- ActiveXBuildMenu( oCrt, @oStatic, @oStatic2 ) - // --------------------------- ToolBar -----------------------------\\ - oTBar := BuildWvgToolBar( oDA, nActiveX ) + // --- ToolBar --- + oTBar := BuildWvgToolBar( oDA ) - // --------------------------- StatusBar ---------------------------\\ + // --- StatusBar --- oSBar := WvgStatusBar():new( oDA ):create( , , , , , .T. ) oSBar:panelClick := {| oPanel | Wvg_MessageBox( , oPanel:caption ) } oPanel := oSBar:getItem( 1 ) @@ -52,17 +54,17 @@ FUNCTION ExecuteActiveX( nActiveX, xParam ) oPanel2 := oSBar:addItem() oPanel2:caption := "Click on any part!" - // --------------------------- Static ------------------------------\\ + // --- Static --- oStatic := WvgStatic():new( oDA ) oStatic:type := WVGSTATIC_TYPE_TEXT 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 ] - ; oTBar:currentSize()[ 2 ] - oSBar:currentSize()[ 2 ] - 4 }, , .T. ) oStatic:setColorBG( RGB( 198, 198, 198 ) ) #if 0 // panel - // --------------------------- Static + Radio + Checkbox ----------\\ + // --- Static + Radio + Checkbox --- oStatic2 := WvgStatic():New( oCrt, , { 150, 150 }, { 500, 310 }, , .F. ) // oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME oStatic2:exStyle += WS_EX_WINDOWEDGE @@ -138,39 +140,39 @@ FUNCTION ExecuteActiveX( nActiveX, xParam ) oMLE:setData() #endif - // --------------------------- ListBox -----------------------------\\ + // --- ListBox --- oListBox := WvgListBox():new() oListBox:create( oStatic, , { 5, 55 }, { 107, 380 } ) oListBox:setColorFG( RGB( 218, 61, 34 ) ) - AAdd( aParts, "XbpDialog" ) - AAdd( aParts, "XbpMenuBar" ) - AAdd( aParts, "XbpToolBar" ) - AAdd( aParts, "XbpStatusBar" ) - AAdd( aParts, "XbpStatic" ) - AAdd( aParts, "XbpTreeView" ) - AAdd( aParts, "XbpActiveX" ) - AAdd( aParts, "XbpListBox" ) - AAdd( aParts, "XbpPushButton" ) - AAdd( aParts, "XbpCheckBox" ) + AAdd( aParts, "XbpDialog" ) + AAdd( aParts, "XbpMenuBar" ) + AAdd( aParts, "XbpToolBar" ) + AAdd( aParts, "XbpStatusBar" ) + AAdd( aParts, "XbpStatic" ) + AAdd( aParts, "XbpTreeView" ) + AAdd( aParts, "XbpActiveX" ) + AAdd( aParts, "XbpListBox" ) + AAdd( aParts, "XbpPushButton" ) + AAdd( aParts, "XbpCheckBox" ) AAdd( aParts, "XbpRadioButton" ) - AAdd( aParts, "Xbp3State" ) - AAdd( aParts, "XbpSLE" ) - AAdd( aParts, "XbpMLE" ) - AAdd( aParts, "DataRef" ) + AAdd( aParts, "Xbp3State" ) + AAdd( aParts, "XbpSLE" ) + AAdd( aParts, "XbpMLE" ) + AAdd( aParts, "DataRef" ) AEval( aParts, {| e | oListBox:addItem( e ) } ) oListBox:itemSelected := {|| Wvg_MessageBox( , oListBox:getCurItem() ) } oListBox:setData( 3 ) - // --------------------------- PushButton --------------------------\\ + // --- PushButton --- oXbp := WvgPushButton():new( oStatic ) oXbp:caption := "Hide" oXbp:create( , , { 20, 440 }, { 80, 30 } ) oXbp:activate := {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } - // --------------------------- TreeView ---------------------------\\ + // --- TreeView --- oTree := WvgTreeView():new( oDA, , { oCrt:currentSize()[ 1 ] - 160, oTBar:currentSize()[ 2 ] + 3 }, ; { 160, oCrt:currentSize()[ 2 ] - ; oTBar:currentSize()[ 2 ] - oSBar:currentSize()[ 2 ] - 4 }, , .T. ) @@ -201,7 +203,7 @@ FUNCTION ExecuteActiveX( nActiveX, xParam ) oTree:setData( oItem2 ) - // --------------------------- Misc Config ------------------------\\ + // --- Misc Config --- oTBar:buttonClick := {| oBtn | iif( oBtn:caption == "Hide", oStatic:hide(), NIL ), ; iif( oBtn:caption == "Show", oStatic:show(), 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 ) } #if 1 - // --------------------------- Active-X ---------------------------\\ + // --- Active-X --- oCom := BuildActiveXControl( nActiveX, oDA ) IF HB_ISOBJECT( oCom ) oCrt:sendMessage( WM_SIZE, 0, 0 ) @@ -340,7 +342,7 @@ STATIC FUNCTION BuildActiveXControl( nActiveX, oDA ) CASE nActiveX == 3 hb_gtInfo( HB_GTI_WINTITLE, "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 hb_gtInfo( HB_GTI_WINTITLE, "RM Chart [ Attributes Next Charts ]" ) @@ -348,7 +350,7 @@ STATIC FUNCTION BuildActiveXControl( nActiveX, oDA ) // RMChart does not have event interface. // 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 hb_gtInfo( HB_GTI_WINTITLE, "Image Viewer" ) @@ -368,9 +370,9 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam ) // After :CREATE() Messages 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:Navigate( iif( Empty( xParam ), "http://hbide.vouch.info", xParam ) ) + oCom:Navigate( iif( Empty( xParam ), hb_Version( HB_VERSION_URL_BASE ), xParam ) ) ELSEIF nActiveX == 4 ConfigureRMChart( oCom ) @@ -408,7 +410,7 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam ) oCom:RMCStyle := 2 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. ) ENDIF @@ -427,137 +429,143 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam ) hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Stacked Bars" ) // SetMode( 30, 100 ) - sData += "00003600|00004450|000051|000061|000073|00008-6972|00009412|00011Tahoma|100011|10" - sData += "0035|1000410|10005-5|10006-5|1000911|100101|100111|100181|100200|1002150000|1002" - sData += "211|100238|100331|100341|100356|100378|100411|100468|100484|100494|10051-6972|10" - sData += "052-16777216|10053-1828|100541|100558|10056-16777216|10057-16777216|10060-167772" - sData += "16|10061-16777216|1006315|10064-32|100652|10066-16776961|10180this is the footer" - sData += "|10181Example of stacked bars|10182Apples*Pears*Cherries*Strawberries|10183 $|10" - sData += "184This is an optional axis text, sized 9 points and bold\9b|10187Label Nr. 1*La" - sData += "bel Nr. 2*Label Nr. 3*Label Nr. 4*Label Nr. 5*Label Nr. 6|10196This is an option" - sData += "al label axis text|110011|110023|110033|110045|110055|11006-1|1100923|110131|110" - sData += "14-1|110171|11019-16777077|1102111|110221|110236|1105310000*10000*16000*12000*20" - sData += "000*10000|120011|120023|120033|120045|120055|12006-1|1200927|120131|12014-1|1201" - sData += "71|12019-16751616|1202111|120221|120236|120535000*7000*4000*15000*10000*10000|13" - sData += "0011|130023|130033|130045|130055|13006-1|1300982|130131|13014-1|130171|13019-838" - sData += "8608|1302111|130221|130236|1305310000*3000*12000*10000*5000*20000|140011|140023|" - sData += "140033|140045|140055|14006-1|1400925|140131|14014-1|140171|14019-4684277|1402111" - sData += "|140221|140236|140535000*9000*12000*6000*10000*5000" + sData := ; + "00003600|00004450|000051|000061|000073|00008-6972|00009412|00011Tahoma|100011|10" + ; + "0035|1000410|10005-5|10006-5|1000911|100101|100111|100181|100200|1002150000|1002" + ; + "211|100238|100331|100341|100356|100378|100411|100468|100484|100494|10051-6972|10" + ; + "052-16777216|10053-1828|100541|100558|10056-16777216|10057-16777216|10060-167772" + ; + "16|10061-16777216|1006315|10064-32|100652|10066-16776961|10180this is the footer" + ; + "|10181Example of stacked bars|10182Apples*Pears*Cherries*Strawberries|10183 $|10" + ; + "184This is an optional axis text, sized 9 points and bold\9b|10187Label Nr. 1*La" + ; + "bel Nr. 2*Label Nr. 3*Label Nr. 4*Label Nr. 5*Label Nr. 6|10196This is an option" + ; + "al label axis text|110011|110023|110033|110045|110055|11006-1|1100923|110131|110" + ; + "14-1|110171|11019-16777077|1102111|110221|110236|1105310000*10000*16000*12000*20" + ; + "000*10000|120011|120023|120033|120045|120055|12006-1|1200927|120131|12014-1|1201" + ; + "71|12019-16751616|1202111|120221|120236|120535000*7000*4000*15000*10000*10000|13" + ; + "0011|130023|130033|130045|130055|13006-1|1300982|130131|13014-1|130171|13019-838" + ; + "8608|1302111|130221|130236|1305310000*3000*12000*10000*5000*20000|140011|140023|" + ; + "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 hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Floating Bars" ) // SetMode( 20, 90 ) - sData += "00003550|00004300|000051|000073|00008-2894893|00009412|00011Tahoma|100011|100035" - sData += "|100045|10005-5|10006-5|1000911|100101|100111|100131|100181|100201|1002113|10022" - sData += "13|100238|100331|100341|100356|100378|100411|100468|100482|10052-16777216|10053-" - sData += "1120086|100544|100555|10056-16777216|10057-16777216|10060-16777216|10061-1677721" - sData += "6|1006316|10064-5383962|100652|10066-16777011|10181Birth of a Killer App|10182Sc" - sData += "hedule*Reality|10187Design*Development*Testing*Bug Fixing*Documentation*Marketin" - 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" - sData += "5/01|110011|110026|110044|110101|110131|11019-6751336|1102111|110221|1102312|110" - sData += "531*3*4*6*6*4*7*4*9*3*10*3|120011|120026|120044|120101|120132|12019-47872|120211" - sData += "1|120221|1202312|120531*.5*1.5*10.5*12*1*12*1*12.5*.5*2*11" + sData := ; + "00003550|00004300|000051|000073|00008-2894893|00009412|00011Tahoma|100011|100035" + ; + "|100045|10005-5|10006-5|1000911|100101|100111|100131|100181|100201|1002113|10022" + ; + "13|100238|100331|100341|100356|100378|100411|100468|100482|10052-16777216|10053-" + ; + "1120086|100544|100555|10056-16777216|10057-16777216|10060-16777216|10061-1677721" + ; + "6|1006316|10064-5383962|100652|10066-16777011|10181Birth of a Killer App|10182Sc" + ; + "hedule*Reality|10187Design*Development*Testing*Bug Fixing*Documentation*Marketin" + ; + "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" + ; + "5/01|110011|110026|110044|110101|110131|11019-6751336|1102111|110221|1102312|110" + ; + "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 hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Four Regions" ) // SetMode( 40, 120 ) - sData += "00003700|00004500|000054|000061|000071|00008-984833|00009412|00011Tahoma|100011|" - sData += "100032|100042|10005348|10006248|1000910|100101|100111|100181|100200|10021100|100" - sData += "2211|100238|100331|100341|100355|100378|100481|100491|10051-984833|10052-1677721" - sData += "6|10053-657956|100541|100558|10056-16777216|10057-16777216|10060-16777216|10061-" - sData += "16777216|10187Label 1*Label 2*Label 3*Label 4*Label 5|110011|110021|110031|11004" - sData += "6|110056|11006-1|110091|110131|11014-1|110171|1102111|110221|110235|1105330*40*7" - sData += "0*60*20|200011|20003352|200042|20005-2|20006248|2000910|200101|200111|200181|200" - sData += "200|20021100|2002211|200238|200331|200341|200355|200378|200484|200491|20051-9848" - sData += "33|20052-16777216|20053-657956|200544|200555|20056-16777216|20057-16777216|20060" - sData += "-16777216|20061-16777216|20187Label 1*Label 2*Label 3*Label 4*Label 5|210011|210" - sData += "023|210033|210045|210055|21006-1|210091|210101|210131|21014-1|210171|2102111|210" - sData += "221|210235|2105320*10*15*25*30|220011|220023|220033|220045|220055|22006-1|220091" - sData += "|220101|220131|22014-1|220171|2202111|220221|220235|2205325*30*10*20*15|230011|2" - sData += "30023|230033|230045|230055|23006-1|230091|230101|230131|23014-1|230171|2302111|2" - sData += "30221|230235|2305310*20*40*20*30|240011|240023|240033|240045|240055|24006-1|2400" - sData += "91|240101|240131|24014-1|240171|2402111|240221|240235|2405340*30*20*30*20|300011" - sData += "|300032|30004252|30005348|30006-2|3000910|300101|300181|300481|300491|30051-9848" - sData += "33|30052-16777216|30053-657956|310011|3100251|310031|3100454|310054|310071|31009" - sData += "1|310121|310151|310161|310171|310182|310211|310221|310235|3105330*50*20*40*60|40" - sData += "0011|40003352|40004252|40005-2|40006-2|4000910|400101|400111|400131|400181|40020" - sData += "100|40021250|4002211|400238|400281|400292|400300|400310|400322|400331|400341|400" - sData += "3510|400378|400482|400492|40051-984833|40052-16777216|40053-984833|400541|400558" - sData += "|40056-16776961|40057-16777216|400592|40060-16777216|40061-16777216|40183$ |4018" - sData += "5 %|410011|410021|410031|410043|410053|41006-1|4100950|410131|41014-1|410171|410" - sData += "19-10496|4102111|410221|4102310|41053240*230*220*180*170*160*145*130*125*115|420" - sData += "011|4200221|420035|4200422|420052|420061|420071|4200963|420111|420121|420131|420" - sData += "171|42019-16744448|4202115|420221|4202310|420261|420538.1*6.2*4.3*2.2*1.2*3.1*5." - sData += "2*11.4*7.3*4.2" + sData := ; + "00003700|00004500|000054|000061|000071|00008-984833|00009412|00011Tahoma|100011|" + ; + "100032|100042|10005348|10006248|1000910|100101|100111|100181|100200|10021100|100" + ; + "2211|100238|100331|100341|100355|100378|100481|100491|10051-984833|10052-1677721" + ; + "6|10053-657956|100541|100558|10056-16777216|10057-16777216|10060-16777216|10061-" + ; + "16777216|10187Label 1*Label 2*Label 3*Label 4*Label 5|110011|110021|110031|11004" + ; + "6|110056|11006-1|110091|110131|11014-1|110171|1102111|110221|110235|1105330*40*7" + ; + "0*60*20|200011|20003352|200042|20005-2|20006248|2000910|200101|200111|200181|200" + ; + "200|20021100|2002211|200238|200331|200341|200355|200378|200484|200491|20051-9848" + ; + "33|20052-16777216|20053-657956|200544|200555|20056-16777216|20057-16777216|20060" + ; + "-16777216|20061-16777216|20187Label 1*Label 2*Label 3*Label 4*Label 5|210011|210" + ; + "023|210033|210045|210055|21006-1|210091|210101|210131|21014-1|210171|2102111|210" + ; + "221|210235|2105320*10*15*25*30|220011|220023|220033|220045|220055|22006-1|220091" + ; + "|220101|220131|22014-1|220171|2202111|220221|220235|2205325*30*10*20*15|230011|2" + ; + "30023|230033|230045|230055|23006-1|230091|230101|230131|23014-1|230171|2302111|2" + ; + "30221|230235|2305310*20*40*20*30|240011|240023|240033|240045|240055|24006-1|2400" + ; + "91|240101|240131|24014-1|240171|2402111|240221|240235|2405340*30*20*30*20|300011" + ; + "|300032|30004252|30005348|30006-2|3000910|300101|300181|300481|300491|30051-9848" + ; + "33|30052-16777216|30053-657956|310011|3100251|310031|3100454|310054|310071|31009" + ; + "1|310121|310151|310161|310171|310182|310211|310221|310235|3105330*50*20*40*60|40" + ; + "0011|40003352|40004252|40005-2|40006-2|4000910|400101|400111|400131|400181|40020" + ; + "100|40021250|4002211|400238|400281|400292|400300|400310|400322|400331|400341|400" + ; + "3510|400378|400482|400492|40051-984833|40052-16777216|40053-984833|400541|400558" + ; + "|40056-16776961|40057-16777216|400592|40060-16777216|40061-16777216|40183$ |4018" + ; + "5 %|410011|410021|410031|410043|410053|41006-1|4100950|410131|41014-1|410171|410" + ; + "19-10496|4102111|410221|4102310|41053240*230*220*180*170*160*145*130*125*115|420" + ; + "011|4200221|420035|4200422|420052|420061|420071|4200963|420111|420121|420131|420" + ; + "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 hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "10 Biggest Companies" ) // SetMode( 25, 90 ) - sData += "00003670|00004450|000051|000061|000071|00008-10185235|00009412|00011Tahoma|10001" - sData += "1|100035|1000410|10005-5|10006-5|1000912|100101|100111|100131|100181|10020100000" - sData += "|10021250000|1002211|100239|100281|100292|100300|100310|100322|100331|100341|100" - sData += "3510|100378|100482|100492|10051-32944|10052-1296|10053-983041|100541|100558|1005" - sData += "6-1828|10057-16777216|100592|10060-1828|10061-16777216|10180data source: F.A.Z|1" - sData += "0181The world's 10 biggest industrial companies 2003|10183$ |10184Total turnover" - sData += " in Mill. Dollar|10185 %|10186Net operating margin|10187Exxon Mobil*Royal Dutch " - sData += "/ Shell*BP*General Motors*Daimler Chrysler*Ford Motor*Toyota Motor*General Elect" - sData += "ric*TOTAL*Chevron Texaco|110011|110021|110031|110043|110053|11006-1|1100950|1101" - sData += "31|11014-1|110171|11019-10496|1102111|110221|1102310|11053242365*235598*232571*1" - sData += "85524*170457*164196*149321*132797*130067*119703|120011|1200221|120035|1200422|12" - sData += "0052|120061|120071|1200970|120111|120121|120131|1201421|120171|12019-16744448|12" - sData += "02115|120221|1202310|120261|120538.9*4.1*4.4*2.1*.3*.3*5.9*11.3*6.7*6" + sData := ; + "00003670|00004450|000051|000061|000071|00008-10185235|00009412|00011Tahoma|10001" + ; + "1|100035|1000410|10005-5|10006-5|1000912|100101|100111|100131|100181|10020100000" + ; + "|10021250000|1002211|100239|100281|100292|100300|100310|100322|100331|100341|100" + ; + "3510|100378|100482|100492|10051-32944|10052-1296|10053-983041|100541|100558|1005" + ; + "6-1828|10057-16777216|100592|10060-1828|10061-16777216|10180data source: F.A.Z|1" + ; + "0181The world's 10 biggest industrial companies 2003|10183$ |10184Total turnover" + ; + " in Mill. Dollar|10185 %|10186Net operating margin|10187Exxon Mobil*Royal Dutch " + ; + "/ Shell*BP*General Motors*Daimler Chrysler*Ford Motor*Toyota Motor*General Elect" + ; + "ric*TOTAL*Chevron Texaco|110011|110021|110031|110043|110053|11006-1|1100950|1101" + ; + "31|11014-1|110171|11019-10496|1102111|110221|1102310|11053242365*235598*232571*1" + ; + "85524*170457*164196*149321*132797*130067*119703|120011|1200221|120035|1200422|12" + ; + "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 hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Grouped Bars" ) // SetMode( 25, 80 ) - sData += "00003600|00004450|000051|000061|000075|00008-2|00009412|00010paper.jpg|00011Taho" - sData += "ma|100011|100035|100045|10005-5|10006-5|1000910|100101|100111|100181|100200|1002" - sData += "1100|1002211|100238|100331|100341|100355|100378|100468|100484|10053-2|100541|100" - sData += "558|100631|100651|10182First quarter*Second quarter*Third quarter*Fourth quarter" - sData += "|101872000*2001*2002*2003*2004|110011|110022|110044|110131|1102111|110221|110235" - sData += "|1105330*20*40*60*10|120011|120022|120044|120131|1202111|120221|120235|1205330*2" - sData += "0*50*70*60|130011|130022|130044|130131|1302111|130221|130235|1305340*10*30*20*80" - sData += "|140011|140022|140044|140131|1402111|140221|140235|1405370*50*80*40*30" + sData := ; + "00003600|00004450|000051|000061|000075|00008-2|00009412|00010paper.jpg|00011Taho" + ; + "ma|100011|100035|100045|10005-5|10006-5|1000910|100101|100111|100181|100200|1002" + ; + "1100|1002211|100238|100331|100341|100355|100378|100468|100484|10053-2|100541|100" + ; + "558|100631|100651|10182First quarter*Second quarter*Third quarter*Fourth quarter" + ; + "|101872000*2001*2002*2003*2004|110011|110022|110044|110131|1102111|110221|110235" + ; + "|1105330*20*40*60*10|120011|120022|120044|120131|1202111|120221|120235|1205330*2" + ; + "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 hb_gtInfo( HB_GTI_WINTITLE, "RMChart [ Next:F11 ] " + "Flow Chart" ) // SetMode( 30, 50 ) - sData += "00003305|00004400|000051|00008-984833|00009412|00011Tahoma|100011|100035|100045|" - sData += "10005-5|10006-5|10180\7C|010011|010051|010072|010081|0101050|0101125|01012100|01" - sData += "01325|01014-5952982|01015-5952982|01016255|010191|0102010|01026Start|01030-256|0" - sData += "10012|010054|0100721|01014-16776961|010222|01024100*100|0102550*75|01026|010272|" - sData += "010293|010013|010051|010071|010081|0101050|0101175|01012100|0101325|01014-669788" - sData += "2|01015-6697882|01016255|010191|0102010|01026i = 1|01030-16777216|010014|010054|" - sData += "0100721|01014-16776961|010222|01024100*100|01025100*150|01026|010272|010293|0100" - sData += "15|010051|010073|010081|0101050|01011150|01012100|0101350|01014-65536|01015-6553" - sData += "6|01016255|010191|0102010|01026i = 39?|01030-256|010016|010054|0100721|01014-167" - sData += "76961|010222|01024100*100|01025200*225|01026|010272|010293|010017|010051|010071|" - sData += "010081|0101050|01011225|01012100|0101325|01014-6697882|01015-6697882|01016255|01" - sData += "0191|0102010|01026i = i + 1|01030-16777216|010018|010054|0100721|01014-16776961" - sData += "|010222|01024100*100|01025250*275|01026|010272|010293|010019|010051|010073|01008" - sData += "1|0101050|01011275|01012100|0101350|01014-65536|01015-65536|01016255|010191|0102" - sData += "010|01026i <= 100|01030-256|0100110|010054|0100721|01014-16776961|010222|0102410" - sData += "0*100|01025325*350|01026|010272|010293|0100111|010051|010072|010081|0101050|0101" - sData += "1350|01012100|0101325|01014-5952982|01015-5952982|01016255|010191|0102010|01026S" - sData += "top|01030-256|0100113|010054|0100721|01014-16776961|010222|01024150*200|01025175" - sData += "*175|01026|010272|010293|0100114|010051|010081|01010145|01011157|0101250|01014-1" - sData += "6776961|01015-5383962|01016255|010191|0102010|01026yes|01030-16777216|0100115|01" - sData += "0051|010071|010081|01010200|01011162|01012100|0101325|01014-6697882|01015-669788" - sData += "2|01016255|010191|0102010|01026i = 69|01030-16777216|0100116|010054|0100721|0101" - sData += "4-16776961|010224|0102450*10*10*100|01025300*300*125*125|01026|010272|010293|010" - sData += "0117|010054|0100721|01014-16776961|010223|01024250*250*100|01025162*125*125|0102" - sData += "6|010272|010293|0100118|010051|010081|01010100|01011200|0101250|0101325|01014-16" - sData += "776961|01016255|010191|0102010|01026no|01030-16777216|0100119|010051|010081|0101" - sData += "010|01011280|0101240|01014-16776961|01016255|010191|0102010|01026yes|01030-16777" - sData += "216|0100120|010051|010081|01010100|01011322|0101250|01014-16776961|01016255|0101" - sData += "91|0102010|01026no|01030-16777216|0100120|010051|010079|01010180|01011280|010121" - sData += "20|01013100|01015-39322|010191|010209|01026RMChart is not a flowchart tool. This" - sData += " is just an example for the use of CustomObjects!|01030-256" + sData := ; + "00003305|00004400|000051|00008-984833|00009412|00011Tahoma|100011|100035|100045|" + ; + "10005-5|10006-5|10180\7C|010011|010051|010072|010081|0101050|0101125|01012100|01" + ; + "01325|01014-5952982|01015-5952982|01016255|010191|0102010|01026Start|01030-256|0" + ; + "10012|010054|0100721|01014-16776961|010222|01024100*100|0102550*75|01026|010272|" + ; + "010293|010013|010051|010071|010081|0101050|0101175|01012100|0101325|01014-669788" + ; + "2|01015-6697882|01016255|010191|0102010|01026i = 1|01030-16777216|010014|010054|" + ; + "0100721|01014-16776961|010222|01024100*100|01025100*150|01026|010272|010293|0100" + ; + "15|010051|010073|010081|0101050|01011150|01012100|0101350|01014-65536|01015-6553" + ; + "6|01016255|010191|0102010|01026i = 39?|01030-256|010016|010054|0100721|01014-167" + ; + "76961|010222|01024100*100|01025200*225|01026|010272|010293|010017|010051|010071|" + ; + "010081|0101050|01011225|01012100|0101325|01014-6697882|01015-6697882|01016255|01" + ; + "0191|0102010|01026i = i + 1|01030-16777216|010018|010054|0100721|01014-16776961" + ; + "|010222|01024100*100|01025250*275|01026|010272|010293|010019|010051|010073|01008" + ; + "1|0101050|01011275|01012100|0101350|01014-65536|01015-65536|01016255|010191|0102" + ; + "010|01026i <= 100|01030-256|0100110|010054|0100721|01014-16776961|010222|0102410" + ; + "0*100|01025325*350|01026|010272|010293|0100111|010051|010072|010081|0101050|0101" + ; + "1350|01012100|0101325|01014-5952982|01015-5952982|01016255|010191|0102010|01026S" + ; + "top|01030-256|0100113|010054|0100721|01014-16776961|010222|01024150*200|01025175" + ; + "*175|01026|010272|010293|0100114|010051|010081|01010145|01011157|0101250|01014-1" + ; + "6776961|01015-5383962|01016255|010191|0102010|01026yes|01030-16777216|0100115|01" + ; + "0051|010071|010081|01010200|01011162|01012100|0101325|01014-6697882|01015-669788" + ; + "2|01016255|010191|0102010|01026i = 69|01030-16777216|0100116|010054|0100721|0101" + ; + "4-16776961|010224|0102450*10*10*100|01025300*300*125*125|01026|010272|010293|010" + ; + "0117|010054|0100721|01014-16776961|010223|01024250*250*100|01025162*125*125|0102" + ; + "6|010272|010293|0100118|010051|010081|01010100|01011200|0101250|0101325|01014-16" + ; + "776961|01016255|010191|0102010|01026no|01030-16777216|0100119|010051|010081|0101" + ; + "010|01011280|0101240|01014-16776961|01016255|010191|0102010|01026yes|01030-16777" + ; + "216|0100120|010051|010081|01010100|01011322|0101250|01014-16776961|01016255|0101" + ; + "91|0102010|01026no|01030-16777216|0100120|010051|010079|01010180|01011280|010121" + ; + "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 @@ -575,7 +583,7 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam ) RETURN NIL -STATIC FUNCTION ConfigureRMChart( RMChart ) +STATIC PROCEDURE ConfigureRMChart( RMChart ) LOCAL oRegion LOCAL oCaption @@ -595,7 +603,7 @@ STATIC FUNCTION ConfigureRMChart( RMChart ) RMChart:AddRegion() oRegion := RMChart:Region( 1 ) - oRegion:Footer := "http://vouch.info" + oRegion:Footer := hb_Version( HB_VERSION_URL_BASE ) oRegion:AddCaption() @@ -616,9 +624,9 @@ STATIC FUNCTION ConfigureRMChart( RMChart ) oChart:StartAngle := 0 oChart:DataString := "10*5*20*25" - RETURN NIL + RETURN -STATIC FUNCTION MyFunction( nMode ) +STATIC PROCEDURE MyFunction( nMode ) #define MUSIC_WAITON { 800, 1600 } @@ -646,4 +654,4 @@ STATIC FUNCTION MyFunction( nMode ) ENDCASE - RETURN NIL + RETURN diff --git a/contrib/gtwvg/tests/_dyndlgs.prg b/contrib/gtwvg/tests/_dyndlgs.prg index 5f308ae8ca..b5d44f9250 100644 --- a/contrib/gtwvg/tests/_dyndlgs.prg +++ b/contrib/gtwvg/tests/_dyndlgs.prg @@ -1,6 +1,4 @@ -/* - * Pritpal Bedi - */ +/* Pritpal Bedi */ #include "inkey.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 - 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 ) + " ] " + ; iif( nInfo % 2 == 0, "Modeless", "Modal" ), " Dialog !", nStyle ) // Multi line edit control nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_AUTOVSCROLL + ES_MULTILINE + ; 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 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 - aDlg := Wvt_AddDlgItem( aDlg, 17, 2, 1, 56, {}, 112 , "STATIC" , nStyle ) + aDlg := wvt_AddDlgItem( aDlg, 17, 2, 1, 56, {}, 112 , "STATIC" , nStyle ) // Icon 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 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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, 10, 43, 1, 14, {}, ID_RDO_XBASE , "BUTTON" , nStyle, "Xbase++" ) + 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, 10, 43, 1, 14, {}, ID_RDO_XBASE , "BUTTON" , nStyle, "Xbase++" ) 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 - 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 - 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 - 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 - 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() Wvt_AppendMenu( hMenu, MF_STRING + MF_ENABLED, ID_MNU_FILE , "File" ) @@ -105,14 +103,14 @@ FUNCTION DynWinDialog( nInfo ) IF nInfo == 2 // Modal Dialog - //hDlg := Wvt_DialogBox( aDlg, bDlgProc, Wvt_GetWindowHandle() ) - hDlg := Wvt_DialogBox( aDlg, cDlgProc, Wvt_GetWindowHandle() ) + //hDlg := wvt_DialogBox( aDlg, bDlgProc, Wvt_GetWindowHandle() ) + hDlg := wvt_DialogBox( aDlg, cDlgProc, Wvt_GetWindowHandle() ) ELSE // Modeless Dialog - hDlg := Wvt_CreateDialog( aDlg, lOnTop, cDlgProc, cDlgIcon, /*nTimerTicks*/, hMenu ) + hDlg := wvt_CreateDialog( aDlg, lOnTop, cDlgProc, cDlgIcon, /*nTimerTicks*/, hMenu ) // Using Function name. - //hDlg := Wvt_CreateDialog( aDlg, lOnTop, cDlgProc, cDlgIcon, nTimerTicks, hMenu, lModal ) + //hDlg := wvt_CreateDialog( aDlg, lOnTop, cDlgProc, cDlgIcon, nTimerTicks, hMenu, lModal ) ENDIF RETURN hDlg @@ -124,163 +122,161 @@ FUNCTION DynDlgProc( hDlg, nMsg, wParam, lParam ) SWITCH nMsg CASE WM_TIMER - Wvg_SetDlgItemText( hDlg, ID_EDT_TIME, Time() ) + wvg_SetDlgItemText( hDlg, ID_EDT_TIME, Time() ) EXIT CASE WM_COMMAND DO CASE CASE wParam == ID_CHK_SATIS - lClicked := ( Wvg_IsDlgButtonChecked( hDlg, ID_CHK_SATIS ) == 1 ) - Wvg_MessageBox( hDlg, iif( lClicked, "Satisfied", "UnSatisfied" ), "CheckBoxStatus" ) + lClicked := ( wvg_IsDlgButtonChecked( hDlg, ID_CHK_SATIS ) == 1 ) + wvg_MessageBox( hDlg, iif( lClicked, "Satisfied", "UnSatisfied" ), "CheckBoxStatus" ) CASE wParam == ID_RDO_XH - Wvg_MessageBox( hDlg, "Harbour", "Compiler" ) + wvg_MessageBox( hDlg, "Harbour", "Compiler" ) CASE wParam == ID_RDO_CLIP - Wvg_MessageBox( hDlg, "Clipper", "Compiler" ) + wvg_MessageBox( hDlg, "Clipper", "Compiler" ) CASE wParam == ID_RDO_XBASE - Wvg_MessageBox( hDlg, "Xbase++", "Compiler" ) + wvg_MessageBox( hDlg, "Xbase++", "Compiler" ) CASE wParam == ID_MNU_FILE - Wvg_MessageBox( hDlg, "Execute Menu Action!", "File" ) + wvg_MessageBox( hDlg, "Execute Menu Action!", "File" ) 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 - IF Wvg_HIWORD( wParam ) == LBN_SELCHANGE - nIndex := Wvg_SendMessage( Wvg_GetDlgItem( hDlg, ID_LST_LIST ), LB_GETCURSEL, 0, 0 ) + CASE wvg_LOWORD( wParam ) == ID_LST_LIST + IF wvg_HIWORD( wParam ) == LBN_SELCHANGE + nIndex := wvg_SendMessage( wvg_GetDlgItem( hDlg, ID_LST_LIST ), LB_GETCURSEL, 0, 0 ) cPrompt := Space( 20 ) - Wvg_SendMessage( Wvg_GetDlgItem( hDlg, ID_LST_LIST ), LB_GETTEXT, nIndex, @cPrompt ) - Wvg_MessageBox( hDlg, cPrompt, "ListBox" ) + wvg_SendMessage( wvg_GetDlgItem( hDlg, ID_LST_LIST ), LB_GETTEXT, nIndex, @cPrompt ) + wvg_MessageBox( hDlg, cPrompt, "ListBox" ) ENDIF - CASE Wvg_LOWORD( wParam ) == ID_CMB_COMBO - IF Wvg_HIWORD( wParam ) == CBN_SELCHANGE - nIndex := Wvg_SendMessage( Wvg_GetDlgItem( hDlg, ID_CMB_COMBO ), CB_GETCURSEL, 0, 0 ) + CASE wvg_LOWORD( wParam ) == ID_CMB_COMBO + IF wvg_HIWORD( wParam ) == CBN_SELCHANGE + nIndex := wvg_SendMessage( wvg_GetDlgItem( hDlg, ID_CMB_COMBO ), CB_GETCURSEL, 0, 0 ) cPrompt := Space( 20 ) - Wvg_SendMessage( Wvg_GetDlgItem( hDlg, ID_CMB_COMBO ), CB_GETLBTEXT, nIndex, @cPrompt ) - Wvg_MessageBox( hDlg, cPrompt, "Combo Box" ) + wvg_SendMessage( wvg_GetDlgItem( hDlg, ID_CMB_COMBO ), CB_GETLBTEXT, nIndex, @cPrompt ) + wvg_MessageBox( hDlg, cPrompt, "Combo Box" ) ENDIF ENDCASE EXIT CASE WM_CTLCOLOREDIT - IF Wvg_GetDlgItem( hDlg, ID_MLE ) == lParam - Wvg_SetTextColor( wParam, RGB( 0, 0, 255 ) ) - Wvg_SetBkColor( wParam, RGB( 255, 255, 200 ) ) + IF wvg_GetDlgItem( hDlg, ID_MLE ) == lParam + wvg_SetTextColor( wParam, RGB( 0, 0, 255 ) ) + wvg_SetBkColor( wParam, RGB( 255, 255, 200 ) ) RETURN 1 - ELSEIF Wvg_GetDlgItem( hDlg, ID_EDT_TEXT ) == lParam - Wvg_SetTextColor( wParam, RGB( 255, 255, 255 ) ) - Wvg_SetBkColor( wParam, RGB( 10, 200, 45 ) ) + ELSEIF wvg_GetDlgItem( hDlg, ID_EDT_TEXT ) == lParam + wvg_SetTextColor( wParam, RGB( 255, 255, 255 ) ) + wvg_SetBkColor( wParam, RGB( 10, 200, 45 ) ) RETURN 1 ENDIF EXIT CASE WM_CTLCOLORSTATIC - IF Wvg_GetDlgItem( hDlg, ID_STA_TEXT ) == lParam - Wvg_SetTextColor( wParam, RGB( 255, 255, 255 ) ) + IF wvg_GetDlgItem( hDlg, ID_STA_TEXT ) == lParam + wvg_SetTextColor( wParam, RGB( 255, 255, 255 ) ) RETURN 1 ENDIF EXIT CASE WM_INITDIALOG - Wvg_SetTimer( hDlg, 5001, 1000 ) // 1 sec + wvg_SetTimer( hDlg, 5001, 1000 ) // 1 sec IF Empty( aHFonts := SetFonts() ) - IF ( hFont := Wvt_CreateFont( "Times New Roman", 18 ) ) != 0 + IF ( hFont := wvt_CreateFont( "Times New Roman", 18 ) ) != 0 SetFonts( hFont ) ENDIF ENDIF 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 IF Empty( SetIcons() ) - SetIcons( Wvg_LoadIcon( "vr_1.ico" ) ) + SetIcons( wvg_LoadIcon( "vr_1.ico" ) ) ENDIF 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 /* IF t_hImage == NIL - t_hImage := Wvg_LoadImage( "vouch1.bmp", 2 ) + t_hImage := wvg_LoadImage( "vouch1.bmp", 2 ) ENDIF 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 */ - Wvg_SetDlgItemText( hDlg, ID_MLE, GetEditText() ) - Wvg_CheckDlgButton( hDlg, ID_CHK_SATIS, .T. ) + wvg_SetDlgItemText( hDlg, ID_MLE, GetEditText() ) + 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, "Gtwvt" ) - Wvt_LBAddString( hDlg, ID_LST_LIST, "Wvtgui" ) - Wvt_LBAddString( hDlg, ID_LST_LIST, "Modeless" ) - Wvt_LBAddString( hDlg, ID_LST_LIST, "Dialogs" ) - Wvt_LBAddString( hDlg, ID_LST_LIST, "WVT" ) + wvt_LBAddString( hDlg, ID_LST_LIST, "Harbour" ) + wvt_LBAddString( hDlg, ID_LST_LIST, "Gtwvt" ) + wvt_LBAddString( hDlg, ID_LST_LIST, "Wvtgui" ) + wvt_LBAddString( hDlg, ID_LST_LIST, "Modeless" ) + wvt_LBAddString( hDlg, ID_LST_LIST, "Dialogs" ) + 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, "Second" ) - Wvt_CBAddString( hDlg, ID_CMB_COMBO, "Third" ) - Wvt_CBAddString( hDlg, ID_CMB_COMBO, "Fourth" ) - Wvt_CBAddString( hDlg, ID_CMB_COMBO, "Fifth" ) + wvt_CBAddString( hDlg, ID_CMB_COMBO, "First" ) + wvt_CBAddString( hDlg, ID_CMB_COMBO, "Second" ) + wvt_CBAddString( hDlg, ID_CMB_COMBO, "Third" ) + wvt_CBAddString( hDlg, ID_CMB_COMBO, "Fourth" ) + 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 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. - /* cText := */ - Wvg_GetDlgItemText( hDlg, ID_MLE ) +#if 0 + cText := "" +#endif + wvg_GetDlgItemText( hDlg, ID_MLE ) EXIT ENDSWITCH RETURN 0 STATIC FUNCTION GetEditText() - - LOCAL cText := "" - - cText += "Welcome in the Wonderful World of Harbour!" - cText += hb_eol() + hb_eol() - cText += "When Peter Rees first published GTWVT, a Windows " - cText += "Terminal Driver, on 22 Dec 2003, everybody took it " - cText += "lightly, except for me, as I was aware that what " - cText += "wonderful contribution to Harbour he has made, " - cText += "what immense possibilities he has opened for Harbour " - cText += "developers, what limitations he has cleared for Clipper " - cText += "savvy user base." - cText += hb_eol() + hb_eol() - cText += "With a little effort I could extend GTWVT " - cText += "to give it a GUI look. I also tried to give it " - cText += "an event driven functionality, and up came Wvt*Classes." - cText += hb_eol() + hb_eol() - cText += "And yet another feather is added in the cap of GTWVT " - cText += "as it is now capable of firing modeless dialogs like the one " - cText += "you are viewing. These dialogs can be constructed dynamically ( Courtesy hbwhat32 ) " - cText += "at run time or can be one of resources. At present 20 such dialogs " - cText += "can be active at any given time. Also note that dialogs created " - cText += "dynamically respect Top, Left, Rows, Cols coordinates, which is an " - cText += "undisputed productivity boost!" - cText += hb_eol() + hb_eol() - cText += "Enjoy!" + hb_eol() - cText += "Pritpal Bedi, INDIA" - - RETURN cText + RETURN ; + "Welcome in the Wonderful World of Harbour!" + ; + hb_eol() + hb_eol() + ; + "When Peter Rees first published GTWVT, a Windows " + ; + "Terminal Driver, on 22 Dec 2003, everybody took it " + ; + "lightly, except for me, as I was aware that what " + ; + "wonderful contribution to Harbour he has made, " + ; + "what immense possibilities he has opened for Harbour " + ; + "developers, what limitations he has cleared for Cl*pper " + ; + "savvy user base." + ; + hb_eol() + hb_eol() + ; + "With a little effort I could extend GTWVT " + ; + "to give it a GUI look. I also tried to give it " + ; + "an event driven functionality, and up came Wvt*Classes." + ; + hb_eol() + hb_eol() + ; + "And yet another feather is added in the cap of GTWVT " + ; + "as it is now capable of firing modeless dialogs like the one " + ; + "you are viewing. These dialogs can be constructed dynamically ( Courtesy hbwhat ) " + ; + "at run time or can be one of resources. At present 20 such dialogs " + ; + "can be active at any given time. Also note that dialogs created " + ; + "dynamically respect Top, Left, Rows, Cols coordinates, which is an " + ; + "undisputed productivity boost!" + ; + hb_eol() + hb_eol() + ; + "Enjoy!" + hb_eol() + ; + "Pritpal Bedi, INDIA" FUNCTION DlgSlideShow() @@ -290,9 +286,9 @@ FUNCTION DlgSlideShow() 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 @@ -325,17 +321,17 @@ FUNCTION DlgSlideShowProc( hDlg, nMsg, wParam, lParam ) RETURN 0 -FUNCTION DrawSlide( hDlg, nSlide ) +STATIC PROCEDURE DrawSlide( hDlg, nSlide ) LOCAL hDC, aRect - hDC := Wvg_GetDC( hDlg ) - aRect := Wvg_GetClientRect( hDlg ) + hDC := wvg_GetDC( hDlg ) + aRect := wvg_GetClientRect( hDlg ) 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 ] ) - Wvg_ReleaseDC( hDlg, hDC ) + wvg_ReleaseDC( hDlg, hDC ) - RETURN NIL + RETURN diff --git a/contrib/gtwvg/tests/_modal.prg b/contrib/gtwvg/tests/_modal.prg index ae105ea6b8..fcbb56d330 100644 --- a/contrib/gtwvg/tests/_modal.prg +++ b/contrib/gtwvg/tests/_modal.prg @@ -1,9 +1,8 @@ -/* - * Pritpal Bedi - */ +/* Pritpal Bedi */ #include "inkey.ch" #include "hbgtinfo.ch" +#include "setcurs.ch" #xuntranslate Alert( => @@ -110,7 +109,7 @@ FUNCTION DialogAlert( cCaption, aText_, aButtons_, sel, aMessage_, nTop, nTime ) // check for columns // place 2 spaces before and after the buttons - nColCap := Len( cCaption ) + 7 // " - "+" "+caption+" " + nColCap := Len( cCaption ) + 7 // " - " + " " + cCaption + " " nColTxt := 0 IF ! Empty( aText_ ) 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 ) ) 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 nTop := -1 @@ -156,11 +155,11 @@ FUNCTION DialogAlert( cCaption, aText_, aButtons_, sel, aMessage_, nTop, nTime ) DispBegin() SetColor( pal_[ DLG_CLR_TEXT ] ) - Wvg_BoxRaised( nTop, nLeft, nBottom, nRight ) + wvg_BoxRaised( nTop, nLeft, nBottom, nRight ) SetColor( pal_[ DLG_CLR_TEXT ] ) 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 ) NEXT ENDIF @@ -181,7 +180,7 @@ FUNCTION DialogAlert( cCaption, aText_, aButtons_, sel, aMessage_, nTop, nTime ) SetColor( pal_[ DLG_CLR_HISEL ] ) @ 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() @@ -303,14 +302,13 @@ FUNCTION CreateOCrt( nT, nL, nB, nR, cTitle, xIcon, lModal, lRowCols, lHidden, ; RETURN oCrt -FUNCTION DoModalWindow() +PROCEDURE DoModalWindow() LOCAL oCrt, nSel, pGT LOCAL aLastPaint := WvtSetBlocks( {} ) - /* This part can be clubbed in a separate prg for different dialogs - * OR can be loaded from a data dictionary. - */ + /* This part can be clubbed in a separate .prg for different dialogs + OR can be loaded from a data dictionary. */ oCrt := WvgCrt():New( , , { 4, 8 }, { 12, 49 }, , .T. ) @@ -329,15 +327,14 @@ FUNCTION DoModalWindow() pGT := SetGT( 3, hb_gtSelect() ) - // Here goes the Clipper Code + // Here goes the Cl*pper Code SetColor( "N/W" ) CLS DO WHILE .T. 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 - ENDIF ENDDO @@ -346,4 +343,4 @@ FUNCTION DoModalWindow() WvtSetBlocks( aLastPaint ) - RETURN NIL + RETURN diff --git a/contrib/gtwvg/tests/_tbrowse.prg b/contrib/gtwvg/tests/_tbrowse.prg index 89bd85f1d0..a3579f935a 100644 --- a/contrib/gtwvg/tests/_tbrowse.prg +++ b/contrib/gtwvg/tests/_tbrowse.prg @@ -1,15 +1,18 @@ -/* - * TBrowse Demonstration with GUI Elements +/* TBrowse Demonstration with GUI Elements * - * This protocol can be clubbed with pure console implementation - * AND can be called IN a separate thread as well as modal TO - * current window. + * This protocol can be clubbed with pure console implementation + * and can be called in a separate thread as well as modal to + * current window. * - * Pritpal Bedi + * Pritpal Bedi */ +#include "button.ch" +#include "dbstruct.ch" #include "inkey.ch" +#include "setcurs.ch" #include "hbgtinfo.ch" +#include "hbver.ch" #define K_MOVING 1001 @@ -26,25 +29,24 @@ #define K_SBTHUMBTRACKVERT 1059 #define K_SBTHUMBTRACKHORZ 1060 -FUNCTION WvtMyBrowse() +PROCEDURE WvtMyBrowse() IF hb_mtvm() hb_threadStart( {| oCrt | oCrt := WvgCrt():new( , , { -1, -2 }, { 34, 69 }, , .T. ), ; oCrt:resizeMode := HB_GTI_RESIZEMODE_ROWS, ; oCrt:icon := GetResource( "dia_excl.ico" ), ; oCrt:create(), ; - Wvt_SetGUI( .T. ), ; + wvt_SetGUI( .T. ), ; ExecBrowser( oCrt ), ; - oCrt:destroy(); - } ) + oCrt:destroy() } ) ELSE ExecBrowser() ENDIF - RETURN NIL + RETURN -FUNCTION ExecBrowser( oCrt ) +STATIC PROCEDURE ExecBrowser( oCrt ) LOCAL nKey, bBlock, oBrowse, aLastPaint, i, pGT LOCAL cFileIndex, cFileDbf, cRDD, nIndex, oTBar, cScr, info_ // , oLB @@ -59,7 +61,7 @@ FUNCTION ExecBrowser( oCrt ) LOCAL nCol := Col() LOCAL cColor := SetColor( "N/W*,N/GR*,,,N/W*" ) LOCAL aObjects := WvtSetObjects( {} ) - LOCAL hPopup := Wvt_SetPopupMenu() + LOCAL hPopup := wvt_SetPopupMenu() LOCAL oVBar, oHBar, oCom, oTre, oChk, oSLE, oLBx, aNvg, oIdx STATIC s_nStyle := 0 @@ -75,7 +77,7 @@ FUNCTION ExecBrowser( oCrt ) oTBar := BrwBuildToolBar( oCrt ) 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() ) @@ -85,7 +87,7 @@ FUNCTION ExecBrowser( oCrt ) USE ( cFileDbf ) NEW SHARED VIA ( cRDD ) IF NetErr() - RETURN NIL + RETURN ENDIF IF FLock() INDEX ON Test->FIRST TAG "001" TO ( cFileIndex ) @@ -119,14 +121,14 @@ FUNCTION ExecBrowser( oCrt ) IF s_nStyle > 5 s_nStyle := 0 ENDIF - Wvt_SetPen( s_nStyle, 0, RGB( 210,1210,210 ) ) + wvt_SetPen( s_nStyle, 0, RGB( 210,1210,210 ) ) 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_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_DrawGridVert( oBrowse:nTop, oBrowse:nBottom, oBrowse:aColumnsSep, Len( oBrowse:aColumnsSep ) ) } ) + 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_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 ) ) } ) Vou_BrwAddScrollBars( oCrt, oBrowse, @oVBar, @oHBar ) @@ -144,7 +146,7 @@ FUNCTION ExecBrowser( oCrt ) BrwBuildButtons( 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 DispBegin() @@ -198,7 +200,7 @@ FUNCTION ExecBrowser( oCrt ) ENDCASE ENDDO - Wvt_SetPen( 0 ) + wvt_SetPen( 0 ) WvtSetBlocks( aLastPaint ) WvtSetObjects( aObjects ) @@ -207,13 +209,14 @@ FUNCTION ExecBrowser( oCrt ) SetCursor( nCursor ) dbCloseArea() + IF oCrt == NIL RestScreen( 0, 0, MaxRow(), MaxCol(), cScr ) ENDIF - Wvt_SetPopupMenu( hPopup ) + wvt_SetPopupMenu( hPopup ) SetGT( 2, pGT ) - RETURN NIL + RETURN 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() oHBar:setPosAndSize() oCom:setPosAndSize() -// oSLE:setPosAndSize() -// oLBx:setPosAndSize() -// oIdx:setPosAndSize() +#if 0 + oSLE:setPosAndSize() + oLBx:setPosAndSize() + oIdx:setPosAndSize() +#endif oTre:setPosAndSize() -// oChk:setPosAndSize() +#if 0 + oChk:setPosAndSize() +#endif 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. -STATIC FUNCTION BrwShowColumn( oBrw, cHeading ) +STATIC PROCEDURE BrwShowColumn( oBrw, cHeading ) LOCAL i, j, nCur @@ -281,7 +288,7 @@ STATIC FUNCTION BrwShowColumn( oBrw, cHeading ) oBrw:refreshCurrent() oBrw:forceStable() - RETURN NIL + RETURN STATIC FUNCTION BrwBuildTree( oCrt /*, oBrw*/ ) @@ -294,7 +301,7 @@ STATIC FUNCTION BrwBuildTree( oCrt /*, oBrw*/ ) oTree:create( , , { -24, -1 }, { {|| -( MaxRow() - 1 - 24 ) }, -10 } ) oTree:setColorFG( "W+" ) 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" ) @@ -322,9 +329,11 @@ STATIC FUNCTION BrwBuildActiveX( oCrt, oBrw ) oCom := WvgActiveXControl():new( oCrt, , { -24, -13 }, { {|| -( MaxRow() - 1 - 24 ) }, {|| -( MaxCol() - 1 - 13 ) } }, , .F. ) 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:navigate( "http://hbide.vouch.info" ) + oCom:navigate( hb_Version( HB_VERSION_URL_BASE ) ) RETURN oCom @@ -345,13 +354,13 @@ STATIC FUNCTION BrwBuildListBox( oCrt, oBrw ) RETURN oXbp -STATIC FUNCTION BrwSetThisOrder( oBrw, nOrd ) +STATIC PROCEDURE BrwSetThisOrder( oBrw, nOrd ) dbSetOrder( nOrd ) oBrw:refreshAll() oBrw:forceStable() - RETURN NIL + RETURN STATIC FUNCTION BrwBuildListBoxIdx( oCrt, oBrw ) @@ -419,8 +428,8 @@ STATIC FUNCTION BrwBuildNvg( oCrt, oBrw, oCom ) oXbp:setColorFG( "N" ) oXbp:setColorBG( "BG+" ) oXbp:returnPressed := {| m1, m2, o | m1 := m2, oCom:navigate( RTrim( o:getData() ) ) } - oXbp:tooltipText := "Type-in a http:// address and press ENTER" - oXbp:setData( "http://hbide.vouch.info/" ) + oXbp:tooltipText := "Type-in a web address and press ENTER" + oXbp:setData( hb_Version( HB_VERSION_URL_BASE ) ) RETURN { oLbl, oXbp } @@ -433,16 +442,16 @@ STATIC FUNCTION BrwBuildCheckBox( oCrt, oBrw, lActiveX ) oXbp := WvgCheckBox():new( oCrt ) oXbp:pointerFocus := .F. 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:create( , , { -23, -1 }, { -1, -10 } ) oXbp:setColorFG( "R+" ) oXbp:setColorBG( "W" ) - oXbp:tooltipText := "Naviagate: http://hbide.vouch.info" + oXbp:tooltipText := "Navigate: " + hb_Version( HB_VERSION_URL_BASE ) RETURN oXbp -STATIC FUNCTION BrwReposButtons( oCrt ) +STATIC PROCEDURE BrwReposButtons( oCrt ) LOCAL oXbp, nOff, nTtl, nG, i LOCAL aW := { 10, 10, 10, 10, 10 } @@ -462,20 +471,20 @@ STATIC FUNCTION BrwReposButtons( oCrt ) ENDIF NEXT - RETURN NIL + RETURN -STATIC FUNCTION BrwBuildButtons( oCrt, oBrw ) +STATIC PROCEDURE BrwBuildButtons( oCrt, oBrw ) LOCAL oPB, nOff, nTtl, nG, i LOCAL aPmt := { "Modal Window", "Maximize", "Go Top", "Go Bottom", "Right Most" } - LOCAL aAct := { {|| Wvt_Keyboard( K_F3 ) }, ; - {|| Wvt_Keyboard( K_F4 ) }, ; + LOCAL aAct := { {|| wvt_Keyboard( K_F3 ) }, ; + {|| wvt_Keyboard( K_F4 ) }, ; {|| oBrw:goTop(), oBrw:forceStable() }, ; {|| oBrw:goBottom(), oBrw:forceStable() }, ; {|| oBrw:panEnd(), oBrw:forceStable() } } LOCAL aW := { 10, 10, 10, 10, 10 } - nG := 2 + nG := 2 nTtl := 0 AEval( aW, {| e | nTtl += e } ) nTtl += ( Len( aW ) - 1 ) * nG @@ -501,25 +510,25 @@ STATIC FUNCTION BrwBuildButtons( oCrt, oBrw ) nOff += aW[ i ] + nG 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 ) } } ) oHBar:range := { 1, oBrw:colCount } oHBar:type := WVGSCROLL_HORIZONTAL oHBar:create() 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 } } ) oVBar:range := { 1, LastRec() } oVBar:type := WVGSCROLL_VERTICAL oVBar:create() oVBar:scroll := {| mp1 | Vou_BrwSetVScroll( mp1, oBrw ) } - RETURN NIL + RETURN STATIC FUNCTION BrwBuildMenu( oCrt ) @@ -673,7 +682,7 @@ STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd ) RETURN lRet -FUNCTION Vou_NavigateToCell( oBrowse ) +STATIC FUNCTION Vou_NavigateToCell( oBrowse ) LOCAL nCount @@ -686,23 +695,23 @@ FUNCTION Vou_NavigateToCell( oBrowse ) nCount := oBrowse:mRowPos - oBrowse:RowPos DispBegin() - WHILE nCount < 0 + DO WHILE nCount < 0 nCount++ oBrowse:Up() ENDDO - WHILE nCount > 0 - nCount -- + DO WHILE nCount > 0 + nCount-- oBrowse:Down() ENDDO nCount := oBrowse:mColPos - oBrowse:ColPos - WHILE nCount < 0 + DO WHILE nCount < 0 nCount++ oBrowse:Left() ENDDO - WHILE nCount > 0 + DO WHILE nCount > 0 nCount-- oBrowse:Right() ENDDO @@ -733,7 +742,7 @@ STATIC FUNCTION DbSkipBlock( n ) ENDDO ENDIF - RETURN nSkipped + RETURN nSkipped STATIC FUNCTION TBNext() @@ -743,7 +752,7 @@ STATIC FUNCTION TBNext() IF Eof() lMoved := .F. ELSE - dbSkip( 1 ) + dbSkip() IF Eof() lMoved := .F. dbGoto( nSaveRecNum ) @@ -770,28 +779,28 @@ STATIC FUNCTION VouBlockField( i ) RETURN {|| FieldGet( i ) } -STATIC FUNCTION Vou_ExecTBarAction( oBtn ) +STATIC PROCEDURE Vou_ExecTBarAction( oBtn ) SWITCH oBtn:caption CASE "New" - Wvt_Keyboard( K_DOWN ); EXIT + wvt_Keyboard( K_DOWN ); EXIT CASE "Select" - Wvt_Keyboard( K_UP ); EXIT + wvt_Keyboard( K_UP ); EXIT CASE "Calendar" - Wvt_Keyboard( K_RIGHT ); EXIT + wvt_Keyboard( K_RIGHT ); EXIT CASE "Tools" - Wvt_Keyboard( K_LEFT ); EXIT + wvt_Keyboard( K_LEFT ); EXIT CASE "Index" - Wvt_Keyboard( K_PGDN ); EXIT + wvt_Keyboard( K_PGDN ); EXIT CASE "Show" - Wvt_Keyboard( K_PGUP ); EXIT + wvt_Keyboard( K_PGUP ); EXIT CASE "Hide" - Wvt_Keyboard( K_CTRL_HOME ); EXIT + wvt_Keyboard( K_CTRL_HOME ); EXIT ENDSWITCH - RETURN NIL + RETURN -FUNCTION Vou_BrwSetVScroll( mp1, oBrowse ) +STATIC PROCEDURE Vou_BrwSetVScroll( mp1, oBrowse ) SWITCH mp1[ 2 ] @@ -830,7 +839,7 @@ FUNCTION Vou_BrwSetVScroll( mp1, oBrowse ) oBrowse:forceStable() - RETURN NIL + RETURN /* For brosers inside WvtDialog() */ diff --git a/contrib/gtwvg/tests/_utils.prg b/contrib/gtwvg/tests/_utils.prg index f8727da3de..5d44338a8c 100644 --- a/contrib/gtwvg/tests/_utils.prg +++ b/contrib/gtwvg/tests/_utils.prg @@ -1,6 +1,4 @@ -/* - * Pritpal Bedi - */ +/* Pritpal Bedi */ #include "inkey.ch" #include "hbgtinfo.ch" @@ -35,18 +33,18 @@ THREAD STATIC t_keys_ := {, , , , , , , , , , , , , , , , , , , } THREAD STATIC t_pic_ := {, , , , , , , , , , , , , , , , , , , } -FUNCTION WvtSetKeys( lSet ) +PROCEDURE WvtSetKeys( lSet ) IF lSet t_keys_[ 2 ] := SetKey( K_F2, {|| WvtNextGets() } ) t_keys_[ 3 ] := SetKey( K_F3, {|| WvtWindowExpand( 1 ) } ) t_keys_[ 4 ] := SetKey( K_F4, {|| WvtWindowExpand( -1 ) } ) 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_[ 8 ] := SetKey( K_F8, {|| WvtLines() } ) - t_keys_[ 9 ] := SetKey( K_F9, {|| Wvt_ChooseFont() } ) - t_keys_[ 10 ] := SetKey( K_F10, {|| Wvt_ChooseColor() } ) + t_keys_[ 9 ] := SetKey( K_F9, {|| wvt_ChooseFont() } ) + t_keys_[ 10 ] := SetKey( K_F10, {|| wvt_ChooseColor() } ) ELSE SetKey( K_F2, t_keys_[ 2 ] ) SetKey( K_F3, t_keys_[ 3 ] ) @@ -59,12 +57,12 @@ FUNCTION WvtSetKeys( lSet ) SetKey( K_F10, t_keys_[ 10 ] ) ENDIF - RETURN NIL + RETURN -// Wvt_Paint() must be a FUNCTION in your application -// as it is called when Window gets WM_PAINT message. +// wvt_Paint() must be a FUNCTION in your application +// 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() @@ -74,13 +72,13 @@ FUNCTION Wvt_Paint() 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 // received by the window. #if 0 -FUNCTION Wvt_SetFocus() +PROCEDURE wvt_SetFocus() /* must be a public function */ LOCAL nRow := Row() LOCAL nCol := Col() @@ -89,17 +87,17 @@ FUNCTION Wvt_SetFocus() DevPos( nRow, nCol ) - RETURN NIL + RETURN #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 // received by the window. #if 0 -FUNCTION Wvt_KillFocus() +PROCEDURE wvt_KillFocus() /* must be a public function */ LOCAL nRow := Row() LOCAL nCol := Col() @@ -108,11 +106,11 @@ FUNCTION Wvt_KillFocus() DevPos( nRow, nCol ) - RETURN NIL + RETURN #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. FUNCTION Wvt_Mouse( nKey, nRow, nCol ) @@ -134,15 +132,15 @@ FUNCTION Wvt_Mouse( nKey, nRow, nCol ) IF nKey == -1000001 FOR nObj := 1 TO nLen DO CASE - CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_DISP - Eval( aObjects[ nObj, WVT_OBJ_ONDISP ] ) - CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_MOUSEOVER - Eval( aObjects[ nObj, WVT_OBJ_ONMOUSEOVER ] ) - CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_BUTTONDOWN - Eval( aObjects[ nObj, WVT_OBJ_ONBUTTONDOWN ] ) - CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_BUTTONUP - Eval( aObjects[ nObj, WVT_OBJ_ONDISP ] ) - CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_HIDE + CASE aObjects[ nObj ][ WVT_OBJ_STATE ] == OBJ_STATE_DISP + Eval( aObjects[ nObj ][ WVT_OBJ_ONDISP ] ) + CASE aObjects[ nObj ][ WVT_OBJ_STATE ] == OBJ_STATE_MOUSEOVER + Eval( aObjects[ nObj ][ WVT_OBJ_ONMOUSEOVER ] ) + CASE aObjects[ nObj ][ WVT_OBJ_STATE ] == OBJ_STATE_BUTTONDOWN + Eval( aObjects[ nObj ][ WVT_OBJ_ONBUTTONDOWN ] ) + CASE aObjects[ nObj ][ WVT_OBJ_STATE ] == OBJ_STATE_BUTTONUP + Eval( aObjects[ nObj ][ WVT_OBJ_ONDISP ] ) + CASE aObjects[ nObj ][ WVT_OBJ_STATE ] == OBJ_STATE_HIDE ENDCASE NEXT @@ -155,8 +153,8 @@ FUNCTION Wvt_Mouse( nKey, nRow, nCol ) e_[ WVT_OBJ_COLTO ] >= nCol } ) IF nObj == 0 IF s_nLastObj > 0 - aObjects[ s_nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_DISP - Eval( aObjects[ s_nLastObj, WVT_OBJ_ONDISP ] ) + aObjects[ s_nLastObj ][ WVT_OBJ_STATE ] := OBJ_STATE_DISP + Eval( aObjects[ s_nLastObj ][ WVT_OBJ_ONDISP ] ) s_nLastObj := 0 ENDIF RETURN NIL @@ -171,23 +169,23 @@ FUNCTION Wvt_Mouse( nKey, nRow, nCol ) DO CASE CASE nKey == K_MOUSEMOVE - IF 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 - Eval( aObjects[ nObj, WVT_OBJ_ONMOUSEOVER ] ) + IF 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 + Eval( aObjects[ nObj ][ WVT_OBJ_ONMOUSEOVER ] ) ENDIF ENDIF CASE nKey == K_LBUTTONDOWN - aObjects[ s_nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_BUTTONDOWN - IF aObjects[ nObj, WVT_OBJ_ONBUTTONDOWN ] != NIL - Eval( aObjects[ nObj, WVT_OBJ_ONBUTTONDOWN ] ) + aObjects[ s_nLastObj ][ WVT_OBJ_STATE ] := OBJ_STATE_BUTTONDOWN + IF aObjects[ nObj ][ WVT_OBJ_ONBUTTONDOWN ] != NIL + Eval( aObjects[ nObj ][ WVT_OBJ_ONBUTTONDOWN ] ) ENDIF CASE nKey == K_LBUTTONUP - aObjects[ s_nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_DISP - IF aObjects[ nObj, WVT_OBJ_ONBUTTONUP ] != NIL - Eval( aObjects[ nObj, WVT_OBJ_ONBUTTONUP ] ) + aObjects[ s_nLastObj ][ WVT_OBJ_STATE ] := OBJ_STATE_DISP + IF aObjects[ nObj ][ WVT_OBJ_ONBUTTONUP ] != NIL + Eval( aObjects[ nObj ][ WVT_OBJ_ONBUTTONUP ] ) ENDIF ENDCASE @@ -256,7 +254,7 @@ FUNCTION WvtWindowExpand( nUnits ) s_nUnits += nUnits - Wvt_SetFont( "Courier New", s_nUnits ) + wvt_SetFont( "Courier New", s_nUnits ) RETURN .T. @@ -284,12 +282,14 @@ FUNCTION Hb_Clear() FUNCTION MyMenuProcedure( nID ) - DO CASE - CASE nID == 101 + SWITCH nID + CASE 101 Alert( "Procedure 101" ) - CASE nID == 102 + EXIT + CASE 102 Alert( "Procedure 102" ) - ENDCASE + EXIT + ENDSWITCH RETURN .T. @@ -363,13 +363,13 @@ FUNCTION SetIcons( hIcon ) FUNCTION Popups( nID, lDestroy ) + THREAD STATIC t_hPop_ := { , , , , , , , , } + LOCAL hPop, hPop1 LOCAL nPrompt := MF_ENABLED + MF_STRING - THREAD STATIC t_hPop_ := { , , , , , , , , } - IF nID == NIL - Wvt_SetPopupMenu() + wvt_SetPopupMenu() RETURN NIL ENDIF @@ -428,11 +428,11 @@ FUNCTION Popups( nID, lDestroy ) t_hPop_[ nID ] := hPop - RETURN Wvt_SetPopupMenu( t_hPop_[ nID ] ) + RETURN wvt_SetPopupMenu( t_hPop_[ nID ] ) 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. @@ -447,31 +447,30 @@ FUNCTION ClearStatusMsg() RETURN .T. -FUNCTION WvtPictures( nSlot, cFilePic ) +PROCEDURE WvtPictures( nSlot, cFilePic ) IF nSlot != NIL .AND. nSlot <= 20 .AND. hb_FileExists( cFilePic ) IF !( t_pic_[ nSlot ] == cFilePic ) - IF Wvt_LoadPicture( cFilePic, nSlot ) + IF wvt_LoadPicture( cFilePic, nSlot ) t_pic_[ nSlot ] := cFilePic 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 - Wvt_DrawPicture( nTop, nLeft, nBottom, nRight, nSlot, aOffSet ) + wvt_DrawPicture( nTop, nLeft, nBottom, nRight, nSlot, aOffSet ) ENDIF - RETURN NIL + RETURN FUNCTION GetResource( cName ) - RETURN hb_DirBase() + cName -FUNCTION uiDebug( ... ) +PROCEDURE uiDebug( ... ) LOCAL aP := hb_AParams() LOCAL s := "" @@ -480,9 +479,9 @@ FUNCTION uiDebug( ... ) wapi_OutputDebugString( s ) - RETURN NIL + RETURN -FUNCTION MyError( oError ) +PROCEDURE MyError( oError ) ? oError:description ? oError:operation @@ -494,4 +493,4 @@ FUNCTION MyError( oError ) DO WHILE Inkey() != K_ESC ENDDO - RETURN NIL + RETURN diff --git a/contrib/gtwvg/tests/_wvtcls.prg b/contrib/gtwvg/tests/_wvtcls.prg index 93710bc7c1..b5b48cf274 100644 --- a/contrib/gtwvg/tests/_wvtcls.prg +++ b/contrib/gtwvg/tests/_wvtcls.prg @@ -1,17 +1,16 @@ -/* - * Wvt*Classes Demonstration +/* Wvt*Classes Demonstration * - * This protocol can be clubbed with pure console implementation - * AND can be called IN a separate thread as well as modal TO - * current window. + * This protocol can be clubbed with pure console implementation + * and can be called in a separate thread as well as modal to + * current window. * - * Pritpal Bedi + * Pritpal Bedi */ #include "inkey.ch" #include "hbgtinfo.ch" -FUNCTION DialogWvgClassesOne( nMode ) +PROCEDURE DialogWvgClassesOne( nMode ) LOCAL bBlock @@ -34,9 +33,9 @@ FUNCTION DialogWvgClassesOne( nMode ) MyDialogOne() ENDIF - RETURN NIL + RETURN -STATIC FUNCTION MyDialogOne( oCrt ) +STATIC PROCEDURE MyDialogOne( oCrt ) LOCAL aObjects := WvtSetBlocks( {} ) LOCAL nWinRows, nWinCols, cWinTitle, cFont, nHeight @@ -53,7 +52,7 @@ STATIC FUNCTION MyDialogOne( oCrt ) WvtSetKeys( .F. ) lChkMouse := SetMouseCheck( .F. ) - hPopup := Wvt_SetPopupMenu() + hPopup := wvt_SetPopupMenu() Popups() 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_selct1.bmp" ) ) ? "." - Wvt_ShowWindow( 1 ) + wvt_ShowWindow( 1 ) nWinRows := 55 nWinCols := 185 cWinTitle := "WvtGui Dialog One" @@ -141,7 +140,7 @@ STATIC FUNCTION MyDialogOne( oCrt ) oBtn := WvtPushButton():New( oDlg, 124, 6, 129, 7, 137 ) oBtn:cCaption := "Print" - oBtn:bOnLeftUp := {|| Wvt_Keyboard( 379 ) } + oBtn:bOnLeftUp := {|| wvt_Keyboard( 379 ) } oBtn:Tooltip := "Open Printing Dialog for the Browser in Focus" oDlg:AddObject( oBtn ) @@ -183,7 +182,7 @@ STATIC FUNCTION MyDialogOne( oCrt ) oGet:AddGets( 12, nGetCol, "GTWvt ", "@! ", "W+/B*,N/W*" ) oGet:AddGets( 14, nGetCol, Date() ) 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:bOnCreate := bBlock oDlg:AddObject( oGet ) @@ -282,7 +281,7 @@ STATIC FUNCTION MyDialogOne( oCrt ) oMenu:Caption := "Other Dialogs" oMenu:AddItem( "Dialog Two", {|| DialogWvgClassesTwo() } ) oMenu:AddItem( "-" ) - oMenu:AddItem( "Exit", {|| Wvt_Keyboard( K_ESC ) } ) + oMenu:AddItem( "Exit", {|| wvt_Keyboard( K_ESC ) } ) g_oMenuBar:addItem( "", oMenu ) oDlg:oMenu := g_oMenuBar @@ -322,12 +321,12 @@ STATIC FUNCTION MyDialogOne( oCrt ) WvtSetBlocks( aObjects ) WvtSetKeys( .T. ) - Wvt_SetPopupMenu( hPopup ) + wvt_SetPopupMenu( hPopup ) SetMouseCheck( lChkMouse ) - RETURN NIL + RETURN -FUNCTION DialogWvgClassesTwo() +PROCEDURE DialogWvgClassesTwo() LOCAL aObjects := WvtSetBlocks( {} ) LOCAL oDlg := WvtDialog():New( 30, 90, "My Dialog Two" ) @@ -339,7 +338,7 @@ FUNCTION DialogWvgClassesTwo() oMenu:Caption := "Miscellaneous" oMenu:AddItem( "Progressbar", {|| ExeProgBar( oPBar, oPBar1, oPBar2, oPBar3, oPBar4 ) } ) oMenu:AddItem( "-" ) - oMenu:AddItem( "Exit", {|| Wvt_Keyboard( K_ESC ) } ) + oMenu:AddItem( "Exit", {|| wvt_Keyboard( K_ESC ) } ) g_oMenuBar:addItem( "", oMenu ) oDlg:oMenu := g_oMenuBar @@ -385,9 +384,9 @@ FUNCTION DialogWvgClassesTwo() WvtSetBlocks( aObjects ) - RETURN NIL + RETURN -STATIC FUNCTION ExeProgBar( oPBar, oPBar1, oPBar2, oPBar3, oPBar4 ) +STATIC PROCEDURE ExeProgBar( oPBar, oPBar1, oPBar2, oPBar3, oPBar4 ) LOCAL i @@ -411,9 +410,9 @@ STATIC FUNCTION ExeProgBar( oPBar, oPBar1, oPBar2, oPBar3, oPBar4 ) oPBar3:DeActivate() oPBar4:DeActivate() - RETURN NIL + RETURN -STATIC FUNCTION ExeProgressBar( oPBar, oPBar3 ) +STATIC PROCEDURE ExeProgressBar( oPBar, oPBar3 ) LOCAL i @@ -427,4 +426,4 @@ STATIC FUNCTION ExeProgressBar( oPBar, oPBar3 ) oPBar:DeActivate() oPBar3:DeActivate() - RETURN NIL + RETURN diff --git a/contrib/gtwvg/tests/_xbp.prg b/contrib/gtwvg/tests/_xbp.prg index 10b98a20d2..a1d2d392b9 100644 --- a/contrib/gtwvg/tests/_xbp.prg +++ b/contrib/gtwvg/tests/_xbp.prg @@ -1,19 +1,12 @@ -/* - * Pritpal Bedi - */ - -// +/* Pritpal Bedi */ #include "inkey.ch" #include "hbgtinfo.ch" +#include "hbver.ch" #define MUSIC_WAITON {800, 1600} -// -// A Pure Xbase++ Implementation -// - -FUNCTION demoxbp() +PROCEDURE demoxbp() LOCAL oCrt, oTBar, oSBar, oStatic, oCom, oXbp, oTree, oItem1, oItem2 LOCAL oListBox, oCheck, oRadio, oStatic2, oMLE, oAddr @@ -22,7 +15,7 @@ FUNCTION demoxbp() LOCAL aState := { "not selected", "selected", "undefined" } LOCAL aParts := {} - // --------------------------- Dialog -------------------------------\\ + // --- Dialog --- oCrt := WvgDialog():new( , , { 30, 30 }, { 900, 600 }, , .T. ) oCrt:closable := .T. oCrt:icon := GetResource( "vr_1.ico" ) @@ -38,9 +31,9 @@ FUNCTION demoxbp() // --------------------------- ToolBar -----------------------------\\ oTBar := ActiveXBuildToolBarXbp( oDA ) - // --------------------------- StatusBar ---------------------------\\ + // --- StatusBar --- 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:caption := "My Root Panel" oPanel1 := oSBar:addItem() @@ -48,7 +41,7 @@ FUNCTION demoxbp() oPanel2 := oSBar:addItem() oPanel2:caption := "Click on any part!" - // --------------------------- Static ------------------------------\\ + // --- Static --- oStatic := WvgStatic():new( oDA ) oStatic:type := WVGSTATIC_TYPE_TEXT oStatic:options := WVGSTATIC_TEXT_CENTER @@ -58,47 +51,47 @@ FUNCTION demoxbp() oTBar:currentSize()[ 2 ] - oSBar:currentSize()[ 2 ] - 4 }, , .T. ) oStatic:setColorBG( RGB( 200, 200, 200 ) ) - // --------------------------- ListBox -----------------------------\\ + // --- ListBox --- oListBox := WvgListBox():new() oListBox:create( oStatic, , { 5, 55 }, { 107, 380 } ) oListBox:setColorFG( RGB( 218, 61, 34 ) ) // oListBox:setColorBG( RGB( 250,244,182 ) ) - AAdd( aParts, "XbpDialog" ) - AAdd( aParts, "XbpMenuBar" ) - AAdd( aParts, "XbpToolBar" ) - AAdd( aParts, "XbpToolBarButton" ) - AAdd( aParts, "XbpStatusBar" ) - AAdd( aParts, "XbpStatic" ) - AAdd( aParts, "XbpTreeView" ) - AAdd( aParts, "XbpTreeViewItem" ) + AAdd( aParts, "XbpDialog" ) + AAdd( aParts, "XbpMenuBar" ) + AAdd( aParts, "XbpToolBar" ) + AAdd( aParts, "XbpToolBarButton" ) + AAdd( aParts, "XbpStatusBar" ) + AAdd( aParts, "XbpStatic" ) + AAdd( aParts, "XbpTreeView" ) + AAdd( aParts, "XbpTreeViewItem" ) AAdd( aParts, "XbpActiveXControl" ) - AAdd( aParts, "XbpListBox" ) - AAdd( aParts, "XbpPushButton" ) - AAdd( aParts, "XbpCheckBox" ) - AAdd( aParts, "XbpRadioButton" ) - AAdd( aParts, "Xbp3State" ) - AAdd( aParts, "XbpSLE" ) - AAdd( aParts, "XbpMLE" ) - AAdd( aParts, "XbpHTMLViewer" ) - AAdd( aParts, "XbpSysWindow" ) - AAdd( aParts, "XbpFontDialog" ) - AAdd( aParts, "XbpFont" ) - AAdd( aParts, "-------------" ) - AAdd( aParts, "DataRef" ) + AAdd( aParts, "XbpListBox" ) + AAdd( aParts, "XbpPushButton" ) + AAdd( aParts, "XbpCheckBox" ) + AAdd( aParts, "XbpRadioButton" ) + AAdd( aParts, "Xbp3State" ) + AAdd( aParts, "XbpSLE" ) + AAdd( aParts, "XbpMLE" ) + AAdd( aParts, "XbpHTMLViewer" ) + AAdd( aParts, "XbpSysWindow" ) + AAdd( aParts, "XbpFontDialog" ) + AAdd( aParts, "XbpFont" ) + AAdd( aParts, "-------------" ) + AAdd( aParts, "DataRef" ) AEval( aParts, {| e | oListBox:addItem( e ) } ) - oListBox:itemSelected := {|| Wvg_MessageBox( , oListBox:getCurItem() ) } + oListBox:itemSelected := {|| wvg_MessageBox( , oListBox:getCurItem() ) } oListBox:setData( 3 ) // show selected "XbpToolBar" - // --------------------------- PushButton --------------------------\\ + // --- PushButton --- oXbp := WvgPushButton():new( oStatic ) oXbp:caption := "Hide" oXbp:create( , , { 20, 440 }, { 80, 30 } ) oXbp:activate := {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } - // --------------------------- TreeView ---------------------------\\ + // --- TreeView --- oTree := WvgTreeView():new( oDA, , { oCrt:currentSize()[ 1 ] - 160, oTBar:currentSize()[ 2 ] + 3 }, ; { 160, oCrt:currentSize()[ 2 ] - ; @@ -109,7 +102,7 @@ FUNCTION demoxbp() oTree:create() oTree:setColorBG( RGB( 120, 15, 240 ) ) 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" ) @@ -135,20 +128,20 @@ FUNCTION demoxbp() #if 0 oCom := WvgActiveXControl():New( oDA, , { 0, 0 }, { 100, 100 }, , .T. ) 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 oCom := WvgHtmlViewer():New( oDA, , { 0, 0 }, { 100, 100 }, , .T. ) oCom:beforeNavigate := {| cURL, x, oHTML | x := x, oHTML := oHTML, oPanel:caption := cURL } 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 oCom:create() - oCom:Navigate( "http://www.harbour.vouch.info" ) + oCom:Navigate( hb_Version( HB_VERSION_URL_BASE ) ) oAddr := WvgSLE():new() oAddr:bufferLength := 500 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:setColorFG( RGB( 0, 0, 255 ) ) oAddr:setColorBG( RGB( 0, 255, 255 ) ) @@ -156,48 +149,52 @@ FUNCTION demoxbp() oAddr:setData() 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:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME +#if 0 + oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME +#endif oStatic2:exStyle += WS_EX_WINDOWEDGE - // oStatic2:options := WVGSTATIC_FRAMETHICK +#if 0 + oStatic2:options := WVGSTATIC_FRAMETHICK +#endif oStatic2:create() oStatic2:setColorBG( RGB( 175, 175, 175 ) ) - oXbp := WvgPushButton():new( oStatic2 ) + oXbp := WvgPushButton():new( oStatic2 ) oXbp:caption := "Hide" oXbp:caption := "Hide" oXbp:create( , , { 430, 275 }, { 60, 25 } ) 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: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 := WvgRadioButton():new( oStatic2, , { 10, 35 }, { 100, 15 } ) + oRadio := WvgRadioButton():new( oStatic2, , { 10, 35 }, { 100, 15 } ) oRadio:caption := "Com 2" 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: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() - oXbp := Wvg3State():new() + oXbp := Wvg3State():new() oXbp:caption := "3 State A" oXbp:create( oStatic2, , { 10, 100 }, { 100, 15 } ) // Determine current state using mp1 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() - oXbp := Wvg3State():new( oStatic2, , { 10, 125 }, { 100, 15 } ) + oXbp := Wvg3State():new( oStatic2, , { 10, 125 }, { 100, 15 } ) oXbp:caption := "3 State B" oXbp:create( oStatic2 ) // 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() // 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 } // Read file into LOCAL variable - cText := MemoRead( GetResource( "gtwvg.hbc" ) ) + cText := hb_MemoRead( GetResource( __FILE__ ) ) // Create MLE, specify position using :create() and // assign data code block accessing LOCAL variable oMLE := WvgMLE():new() @@ -232,11 +229,11 @@ FUNCTION demoxbp() // Copy text from LOCAL variable into edit buffer via :dataLink oMLE:setData() - // --------------------------- Misc Config ------------------------\\ + // --- Misc Config --- oTBar:buttonClick := {| oBtn | iif( oBtn:caption == "Hide", oStatic:hide(), NIL ), ; iif( oBtn:caption == "Show", oStatic:show(), 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 ), ; oPanel2:caption := "Button [ " + oBtn:caption + " ] clicked!" } @@ -253,7 +250,7 @@ FUNCTION demoxbp() oCrt:Destroy() - RETURN NIL + RETURN 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 ) } } ) oSubMenu:addItem( { "~Show My Panel" , {|| oStatic2:show():toFront() } } ) oSubMenu:addItem() - oSubMenu:addItem( { "~Font Dialog" , {|| ExeFontDialogXbp( oCrt ) } } ) + oSubMenu:addItem( { "~Font Dialog" , {|| ExeFontDialog( oCrt ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) @@ -354,7 +351,7 @@ STATIC FUNCTION ActiveXBuildToolBarXbp( oCrt ) RETURN oTBar -STATIC FUNCTION MyFunctionXbp( nMode ) +STATIC PROCEDURE MyFunctionXbp( nMode ) DO CASE CASE nMode == 1 @@ -366,7 +363,7 @@ STATIC FUNCTION MyFunctionXbp( nMode ) Tone( MUSIC_WAITON[ 1 ], 1 ) CASE nMode == 3 - Wvg_MessageBox( , "Button clicked!" ) + wvg_MessageBox( , "Button clicked!" ) CASE nMode == 101 // Charge 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 - RETURN NIL + RETURN -STATIC FUNCTION ExeFontDialogXbp( oCrt ) +STATIC PROCEDURE ExeFontDialog( oCrt ) LOCAL oFontDlg @@ -397,17 +394,19 @@ STATIC FUNCTION ExeFontDialogXbp( oCrt ) oFontDlg:familyName := "Courier New" oFontDlg:strikeout := .T. 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:size := .F. -// oFontDlg:style := .F. +#if 0 + oFontDlg:size := .F. + oFontDlg:style := .F. +#endif oFontDlg:create() - // Every 2nd FontDialog will be MODAL + // Every 2nd FontDialog will be MODAL oFontDlg:display( ++s_nMode % 2 ) oFontDlg:destroy() - RETURN NIL + RETURN diff --git a/contrib/gtwvg/tests/demowvg.prg b/contrib/gtwvg/tests/demowvg.prg index 61e5f6c0f6..70f36e2bb4 100644 --- a/contrib/gtwvg/tests/demowvg.prg +++ b/contrib/gtwvg/tests/demowvg.prg @@ -1,25 +1,26 @@ /* - * GTWVT Console GUI Interface + * GTWVT Console GUI Interface * - * Pritpal Bedi + * Copyright (c) Pritpal Bedi * - * I have tried to simulate the gui controls through GDI - * functions and found a way to refresh those controls - * through WM_PAINT message issued to the Window. - * and - * I feel that IF this functionality is built - * into the GT itself, what a wonder! + * I have tried to simulate the GUI controls through GDI + * functions and found a way to refresh those controls + * through WIN_WM_PAINT message issued to the Window. + * and + * I feel that IF this functionality is built + * into the GT itself, what a wonder! * - * This protocol opens up the the distinct possibilities and hope - * you all will cooperate to enhance it further. + * This protocol opens up the the distinct possibilities and hope + * 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" #include "inkey.ch" #include "hbgtinfo.ch" +#include "hbver.ch" #include "wvgparts.ch" REQUEST DBFCDX @@ -51,11 +52,11 @@ EXIT PROCEDURE CleanHandles() LOCAL obj FOR EACH obj IN SetFonts() - Wvg_DeleteObject( obj ) + wvg_DeleteObject( obj ) obj := NIL NEXT FOR EACH obj IN SetIcons() - Wvg_DeleteObject( obj ) + wvg_DeleteObject( obj ) obj := NIL NEXT @@ -69,7 +70,7 @@ PROCEDURE Main() LOCAL cName := PadR( "Pritpal Bedi", 35 ) LOCAL cAdd1 := PadR( "60, New Professor Colony", 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 aBlocks := {} LOCAL nColGet := 8 @@ -91,56 +92,56 @@ PROCEDURE Main() Set( _SET_EVENTMASK, INKEY_ALL + HB_INKEY_GTEVENT ) - Wvt_SetGUI( .T. ) + wvt_SetGUI( .T. ) WvtSetKeys( .T. ) Popups( 1 ) - Wvt_SetMouseMove( .T. ) - Wvt_SetFont( "Courier New", 18, 0, 0 ) + wvt_SetMouseMove( .T. ) + wvt_SetFont( "Courier New", 18, 0, 0 ) CLS - Wvt_ShowWindow( SW_RESTORE ) + wvt_ShowWindow( SW_RESTORE ) /* Xbase++ compatible menu protocol */ oLastMenu := BuildMainMenu() oLastMenu:disableItem( 11 ) oLastMenu:checkItem( 1 ) 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" ) ) } } ) - 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_CTRL_V , {|| __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() ) /* 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_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_DrawBoxRecessed( 7, 61, 13, 70 ) } ) - AAdd( aBlocks, {|| Wvt_DrawBoxGroup( 15, 59, 18, 72 ) } ) - AAdd( aBlocks, {|| Wvt_DrawBoxGroup( 5, 6, 19, 44 ) } ) - AAdd( aBlocks, {|| Wvt_DrawImage( 8, 62, 12, 69, IMAGE_VOUCH, , .T. ) } ) - 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() - 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, {|| 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_DrawBoxRecessed( 7, 61, 13, 70 ) } ) + AAdd( aBlocks, {|| wvt_DrawBoxGroup( 15, 59, 18, 72 ) } ) + AAdd( aBlocks, {|| wvt_DrawBoxGroup( 5, 6, 19, 44 ) } ) + AAdd( aBlocks, {|| wvt_DrawImage( 8, 62, 12, 69, IMAGE_VOUCH, , .T. ) } ) + 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() - 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, {|| Wvt_Mouse( -1000001 ) } ) + AAdd( aBlocks, {|| wvt_Mouse( -1000001 ) } ) aLastPaint := WvtSetBlocks( aBlocks ) - /* XBase++ compatible pure GUI controls onto CUI console */ + /* Xbase++ compatible pure GUI controls onto CUI console */ BuildButtons() scr := SaveScreen( 0, 0, MaxRow(), MaxCol() ) @@ -155,8 +156,8 @@ PROCEDURE Main() dDate := hb_SToD( "20040401" ) - @ 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() ) + @ 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() @ 13, nColGet GET cAdd1 @ 15, nColGet GET cAdd2 @ 17, nColGet GET cAdd3 @@ -172,7 +173,7 @@ PROCEDURE Main() SetColor( clr ) RestScreen( 0, 0, MaxRow(), MaxCol(), scr ) WvtSetKeys( .F. ) - Wvt_SetPopupMenu( hPopup ) + wvt_SetPopupMenu( hPopup ) Popups( 1, .T. ) SetGT( 1, pGT ) @@ -181,14 +182,14 @@ PROCEDURE Main() RETURN -PROCEDURE WvtConsoleGets( nMode ) +STATIC PROCEDURE WvtConsoleGets( nMode ) hb_default( @nMode, 0 ) IF hb_mtvm() hb_threadStart( {| oCrt | hb_gtReload( "WVT" ), ; oCrt := hb_gtSelect(), ; - iif( nMode == 0, WvtNextGetsConsole(), GoogleMap() ), ; + iif( nMode == 0, WvtNextGetsConsole(), OnlineMap() ), ; oCrt := NIL } ) ENDIF @@ -196,14 +197,14 @@ PROCEDURE WvtConsoleGets( nMode ) PROCEDURE WvtNextGetsConsole() - LOCAL dDate := hb_SToD() - LOCAL cName := Space( 35 ) - LOCAL cAdd1 := Space( 35 ) - LOCAL cAdd2 := Space( 35 ) - LOCAL cAdd3 := Space( 35 ) - LOCAL nSlry := 0 - LOCAL nColGet := 8 - LOCAL GetList := {} + LOCAL dDate := hb_SToD() + LOCAL cName := Space( 35 ) + LOCAL cAdd1 := Space( 35 ) + LOCAL cAdd2 := Space( 35 ) + LOCAL cAdd3 := Space( 35 ) + LOCAL nSlry := 0 + LOCAL nColGet := 8 + LOCAL GetList := {} SetMode( 20, 51 ) SetColor( "N/W,N/GR*,,,N/W*" ) @@ -228,11 +229,11 @@ PROCEDURE WvtNextGetsConsole() RETURN -PROCEDURE WvtNextGets() +PROCEDURE WvtNextGets() /* must be a public function */ IF hb_mtvm() - hb_threadStart( {|| hb_gtReload( "WVG" ), Wvt_SetFont( "Terminal", 20 ), ; - hb_clear(), Wvt_ShowWindow( SW_RESTORE ), WvtNextGets_X() } ) + hb_threadStart( {|| hb_gtReload( "WVG" ), wvt_SetFont( "Terminal", 20 ), ; + hb_clear(), wvt_ShowWindow( SW_RESTORE ), WvtNextGets_X() } ) ELSE WvtNextGets_X() ENDIF @@ -257,32 +258,32 @@ PROCEDURE WvtNextGets_X() LOCAL nRow := Row() LOCAL nCol := Col() 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 - // 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. aNewPalette[ 8 ] := aNewPalette[ 8 ] + ( 100000 * ++s_nPalletMultiplier ) Wvt_SetPalette( aNewPalette ) AAdd( aBlocks, {|| Wvt_SetTitle( "Wvt Gets 2nd Window with Different Palette" ) } ) - AAdd( aBlocks, {|| Wvt_DrawLine( MaxRow() - 1, 0, MaxRow() - 1, MaxCol() ) } ) - AAdd( aBlocks, {|| Wvt_SetBrush( 0, RGB( 32, 255, 100 ) ) } ) - AAdd( aBlocks, {|| Wvt_DrawEllipse( 6, 50, 10, 58 ) } ) - AAdd( aBlocks, {|| Wvt_SetBrush( 2, RGB( 255, 255, 100 ), 1 ) } ) - AAdd( aBlocks, {|| Wvt_DrawRectangle( 11, 50, 13, 58 ) } ) - 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, {|| wvt_DrawLine( MaxRow() - 1, 0, MaxRow() - 1, MaxCol() ) } ) + AAdd( aBlocks, {|| wvt_SetBrush( 0, RGB( 32, 255, 100 ) ) } ) + AAdd( aBlocks, {|| wvt_DrawEllipse( 6, 50, 10, 58 ) } ) + AAdd( aBlocks, {|| wvt_SetBrush( 2, RGB( 255, 255, 100 ), 1 ) } ) + AAdd( aBlocks, {|| wvt_DrawRectangle( 11, 50, 13, 58 ) } ) + 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, {|| 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, 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, 26, 22, 29, "Flat", IMAGE_VR, 2 ) } ) - 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( 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, 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, 26, 22, 29, "Flat", IMAGE_VR, 2 ) } ) + 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 ) ) } ) aLastPaint := WvtSetBlocks( aBlocks ) @@ -312,54 +313,54 @@ PROCEDURE WvtNextGets_X() SetColor( clr ) RestScreen( 0, 0, MaxRow(), MaxCol(), scr ) - Wvt_RestScreen( wvtScr ) + wvt_RestScreen( wvtScr ) SetPos( nRow, nCol ) RETURN -FUNCTION WvtPartialScreen() +PROCEDURE WvtPartialScreen() /* must be a public function */ 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 aLastPaint - LOCAL hPopup := Wvt_SetPopupMenu() + LOCAL hPopup := wvt_SetPopupMenu() aLastPaint := WvtSetBlocks( {} ) hb_DispBox( 7, 20, 15, 60, " ", "W/GR*" ) - @ 10, 25 SAY "Wvt_SaveScreen()" COLOR "N/GR*" - @ 11, 25 SAY "Wvt_RestScreen()" COLOR "N/GR*" + @ 10, 25 SAY "wvt_SaveScreen()" COLOR "N/GR*" + @ 11, 25 SAY "wvt_RestScreen()" 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 ENDDO hb_DispBox( 7, 20, 15, 60, " ", "W/B*" ) - @ 10, 25 SAY "Wvt_SaveScreen()" COLOR "N/B*" - @ 11, 25 SAY "Wvt_RestScreen()" COLOR "N/B*" + @ 10, 25 SAY "wvt_SaveScreen()" COLOR "N/B*" + @ 11, 25 SAY "wvt_RestScreen()" 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 ENDDO - Wvt_RestScreen( 7, 20, 15, 60, wvtScr1 ) + wvt_RestScreen( 7, 20, 15, 60, wvtScr1 ) DO WHILE Inkey( 0 ) != K_ESC ENDDO RestScreen( 7, 20, 15, 60, scr ) - Wvt_RestScreen( 0, 0, MaxRow(), MaxCol(), wvtScr ) + wvt_RestScreen( 0, 0, MaxRow(), MaxCol(), wvtScr ) 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 clr := SetColor( "N/W" ) @@ -367,34 +368,34 @@ FUNCTION WvtLines() LOCAL nCols := MaxCol() LOCAL aLastPaint := WvtSetBlocks( {} ) LOCAL aObjects := WvtSetObjects( {} ) - LOCAL hPopup := Wvt_SetPopupMenu() + LOCAL hPopup := wvt_SetPopupMenu() LOCAL aBlocks := {} CLS - 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( 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( 4, 0, 4, nCols, WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_BOTTOM ) } ) + 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( 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( 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" @ 2, 21 SAY "Center Plain White 3 Pixels" @ 3, 31 SAY "Center Raised Dotted" @ 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" - 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, 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, 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, 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, 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, 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, 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, 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 ) ) } ) WvtSetBlocks( aBlocks ) @@ -412,13 +413,13 @@ FUNCTION WvtLines() WvtSetBlocks( aLastPaint ) WvtSetObjects( aObjects ) - Wvt_SetPopupMenu( hPopup ) + wvt_SetPopupMenu( hPopup ) RestScreen( 0, 0, MaxRow(), MaxCol(), scr ) - RETURN NIL + RETURN -FUNCTION BuildMainMenu() +STATIC FUNCTION BuildMainMenu() LOCAL oMenu LOCAL g_oMenuBar := WvgSetAppWindow():menuBar() @@ -445,7 +446,7 @@ FUNCTION BuildMainMenu() oMenu:AddItem( "-" ) oMenu:AddItem( "Wvt Lines . Main Window" , {|| WvtLines() } ) oMenu:AddItem( "-" ) - oMenu:AddItem( "Google Maps" , {|| WvtConsoleGets( 1 ) } ) + oMenu:AddItem( "Online Maps" , {|| WvtConsoleGets( 1 ) } ) oMenu:AddItem( "-" ) oMenu:AddItem( "Wvg Console with GCUI" , {|| ExecGCUI() } ) oMenu:AddItem( "-" ) @@ -454,9 +455,9 @@ FUNCTION BuildMainMenu() oMenu := WvgMenu():new( g_oMenuBar, , .T. ):create() oMenu:Caption := "Common Dialogs" - oMenu:AddItem( "Fonts" , {|| Wvt_ChooseFont() } ) + oMenu:AddItem( "Fonts" , {|| wvt_ChooseFont() } ) oMenu:AddItem( "-" ) - oMenu:AddItem( "Colors" , {|| Wvt_ChooseColor() } ) + oMenu:AddItem( "Colors" , {|| wvt_ChooseColor() } ) g_oMenuBar:addItem( { oMenu, "Common Dialogs" } ) oMenu := WvgMenu():new( g_oMenuBar, , .T. ):create() @@ -464,7 +465,7 @@ FUNCTION BuildMainMenu() oMenu:AddItem( "Expand" , {|| WvtWindowExpand( 1 ) } ) oMenu:AddItem( "Shrink" , {|| WvtWindowExpand( -1 ) } ) 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 ) } ) g_oMenuBar:addItem( { oMenu, "Functionality" } ) @@ -495,7 +496,7 @@ FUNCTION BuildMainMenu() RETURN oMenu /* The last submenu item */ -STATIC FUNCTION GoogleMap() +STATIC PROCEDURE OnlineMap() LOCAL mfrom1, mto1, mfrom2, mto2, mfrom3, mto3, mweb LOCAL nCursor := SetCursor() @@ -504,21 +505,21 @@ STATIC FUNCTION GoogleMap() SetMode( 22, 65 ) SetColor( "N/W,N/GR*,,,N/W*" ) cls - hb_gtInfo( HB_GTI_WINTITLE, "Google Maps" ) + hb_gtInfo( HB_GTI_WINTITLE, "Online Maps" ) - mfrom1 := mto1 := Space( 20 ) - mfrom2 := mto2 := Space( 40 ) - mfrom3 := mto3 := Space( 50 ) + mfrom1 := mto1 := Space( 20 ) + mfrom2 := mto2 := Space( 40 ) + mfrom3 := mto3 := Space( 50 ) - WHILE .T. + DO WHILE .T. @ 5, 01 SAY "FROM :" - @ 7, 01 SAY "State ...:" GET mfrom1 PICTURE "@!" - @ 8, 01 SAY "City ....:" GET mfrom2 PICTURE "@!" - @ 9, 01 SAY "Street ..:" GET mfrom3 PICTURE "@!" + @ 7, 01 SAY "State ...:" GET mfrom1 PICTURE "@!" + @ 8, 01 SAY "City ....:" GET mfrom2 PICTURE "@!" + @ 9, 01 SAY "Street ..:" GET mfrom3 PICTURE "@!" @ 11, 01 SAY "TO :" - @ 13, 01 SAY "State ...:" GET mto1 PICTURE "@!" - @ 14, 01 SAY "City ....:" GET mto2 PICTURE "@!" - @ 15, 01 SAY "Street ..:" GET mto3 PICTURE "@!" + @ 13, 01 SAY "State ...:" GET mto1 PICTURE "@!" + @ 14, 01 SAY "City ....:" GET mto2 PICTURE "@!" + @ 15, 01 SAY "Street ..:" GET mto3 PICTURE "@!" SetCursor( 1 ); read; SetCursor( nCursor ) @@ -526,16 +527,16 @@ STATIC FUNCTION GoogleMap() EXIT 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( mto3 ) + " " + AllTrim( mto2 ) + " " + AllTrim( mto1 ) hb_threadStart( {|| ExecuteActiveX( 1, mweb ) } ) ENDDO - RETURN NIL + RETURN -FUNCTION BuildButtons() +STATIC PROCEDURE BuildButtons() LOCAL oXbp @@ -543,40 +544,40 @@ FUNCTION BuildButtons() oXbp:pointerFocus := .F. oXbp:caption := "Hi" oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -1 }, { -2, -4 } ) - oXbp:activate := {|| Wvg_MessageBox( , "Harbour!" ) } + oXbp:activate := {|| wvg_MessageBox( , "Harbour!" ) } oXbp:toolTipText := "Harbour CUI/GUI Console" oXbp := WvgPushButton():new() oXbp:pointerFocus := .F. oXbp:caption := IMAGE_VOUCH 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 := WvgPushButton():new() oXbp:pointerFocus := .F. oXbp:caption := IMAGE_BROWSE 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 := WvgPushButton():new() oXbp:pointerFocus := .F. oXbp:caption := IMAGE_NOTES oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -16 }, { -2, -4 } ) - oXbp:activate := {|| Wvt_Keyboard( K_F3 ) } + oXbp:activate := {|| wvt_Keyboard( K_F3 ) } oXbp := WvgPushButton():new() oXbp:pointerFocus := .F. oXbp:caption := IMAGE_TOOLS oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -21 }, { -2, -4 } ) - oXbp:activate := {|| Wvt_Keyboard( K_F6 ) } + oXbp:activate := {|| wvt_Keyboard( K_F6 ) } oXbp := WvgPushButton():new() oXbp:pointerFocus := .F. oXbp:caption := IMAGE_HELP oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -26 }, { -2, -4 } ) - oXbp:activate := {|| Wvt_Keyboard( K_F7 ) } + oXbp:activate := {|| wvt_Keyboard( K_F7 ) } oXbp := WvgPushButton():new() oXbp:pointerFocus := .F. @@ -586,17 +587,17 @@ FUNCTION BuildButtons() oXbp:activate := {|| hb_threadStart( {|| demoXbp() } ) } oXbp:toolTipText := "Flat Button . Lines: press ESC when finished." - RETURN NIL + RETURN #if ! defined( __HBSCRIPT__HBSHELL ) -FUNCTION hb_GTSYS() +PROCEDURE hb_GTSYS() /* must be a public function */ REQUEST HB_GT_WVG_DEFAULT REQUEST HB_GT_WVT REQUEST HB_GT_WGU - RETURN NIL + RETURN #endif diff --git a/contrib/gtwvg/tests/demowvg1.prg b/contrib/gtwvg/tests/demowvg1.prg index 86bb688444..edf2011dec 100644 --- a/contrib/gtwvg/tests/demowvg1.prg +++ b/contrib/gtwvg/tests/demowvg1.prg @@ -1,11 +1,12 @@ -// GTWVT Console GUI Interface +// GTWVT Console GUI Interface // -// Pritpal Bedi +// Copyright (c) Pritpal Bedi #require "gtwvg" #include "inkey.ch" #include "hbgtinfo.ch" +#include "hbver.ch" #define IMAGE_VOUCH hb_DirBase() + "vouch1.bmp" #define IMAGE_BROWSE hb_DirBase() + "v_browse.ico" @@ -28,29 +29,29 @@ PROCEDURE Main() Set( _SET_EVENTMASK, INKEY_ALL + HB_INKEY_GTEVENT ) - Wvt_SetGUI( .T. ) - Wvt_SetFont( "Courier New", 18, 0, 0 ) - Wvt_SetMouseMove( .T. ) + wvt_SetGUI( .T. ) + wvt_SetFont( "Courier New", 18, 0, 0 ) + wvt_SetMouseMove( .T. ) SetColor( "N/W" ) CLS - Wvt_ShowWindow( SW_RESTORE ) + wvt_ShowWindow( SW_RESTORE ) 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() ) 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, { "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_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, { "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, { "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, { "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_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_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, { "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, { "Gets", {|| AEval( GetList, {| oGet | wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) }, NIL } ) ExecForm( aPaint ) @@ -58,23 +59,23 @@ PROCEDURE Main() /* This function must be linked with the application */ -FUNCTION Wvt_Paint() +FUNCTION wvt_Paint() /* must be a public function */ WvtPaintObjects() RETURN NIL -STATIC FUNCTION ExecForm( aPaint ) +STATIC PROCEDURE ExecForm( aPaint ) - LOCAL cColor := SetColor() + LOCAL cColor := SetColor() LOCAL aPnt - LOCAL dDate := Date() - LOCAL cName := PadR( "Pritpal Bedi", 35 ) - LOCAL cAdd1 := PadR( "60, New Professor Colony", 35 ) - LOCAL cAdd2 := PadR( "Ludhiana, INDIA", 35 ) - LOCAL cAdd3 := PadR( "http://hbide.vouch.info", 35 ) - LOCAL nSlry := 20000 - LOCAL nColGet := 8 + LOCAL dDate := Date() + LOCAL cName := PadR( "Pritpal Bedi", 35 ) + LOCAL cAdd1 := PadR( "60, New Professor Colony", 35 ) + LOCAL cAdd2 := PadR( "Ludhiana, INDIA", 35 ) + LOCAL cAdd3 := PadR( hb_Version( HB_VERSION_URL_BASE ), 35 ) + LOCAL nSlry := 20000 + LOCAL nColGet := 8 aPnt := WvtSetPaint( aPaint ) @@ -88,22 +89,21 @@ STATIC FUNCTION ExecForm( aPaint ) @ 9, nColGet SAY "<" + PadC( "Name", 33 ) + ">" @ 12, nColGet SAY "<" + PadC( "Address", 33 ) + ">" @ 16, 61 SAY "< Salary >" - @ 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 ) - @ 13, nColGet GET cAdd1 WHEN DispStatusMsg( "Press F2 to get 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" ) + @ 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 ) + @ 13, nColGet GET cAdd1 WHEN DispStatusMsg( "Press F2 to get 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, 61 GET nSlry PICTURE "@Z 9999999.99" WHEN ClearStatusMsg() - READ SetColor( cColor ) WvtSetPaint( aPnt ) - RETURN NIL + RETURN -FUNCTION SetGT( nIndex, pGT ) +STATIC FUNCTION SetGT( nIndex, pGT ) LOCAL oldGT STATIC s_pGT_ := { NIL, NIL, NIL } @@ -136,21 +136,22 @@ FUNCTION DispStatusMsg( cMsg ) ClearStatusMsg() /* 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. -FUNCTION ClearStatusMsg() +STATIC FUNCTION ClearStatusMsg() LOCAL nRow := Row() LOCAL nCol := Col() hb_DispOutAt( MaxRow(), 42, Space( 37 ), "W/W" ) + SetPos( nRow, nCol ) RETURN .T. -FUNCTION DoModalDialog() +STATIC PROCEDURE DoModalDialog() LOCAL oCrt, nSel LOCAL aPnt := WvtSetPaint( {} ) @@ -167,7 +168,7 @@ FUNCTION DoModalDialog() oCrt:Create() 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 ) SetColor( "N/W" ) @@ -183,16 +184,16 @@ FUNCTION DoModalDialog() WvtSetPaint( aPnt ) - RETURN NIL + RETURN #if ! defined( __HBSCRIPT__HBSHELL ) -FUNCTION hb_GTSYS() +PROCEDURE hb_GTSYS() /* must be a public function */ REQUEST HB_GT_WVG_DEFAULT REQUEST HB_GT_WVT REQUEST HB_GT_WGU - RETURN NIL + RETURN #endif diff --git a/contrib/gtwvg/tests/demoxbp.prg b/contrib/gtwvg/tests/demoxbp.prg index 7da2434752..b6b9d3c641 100644 --- a/contrib/gtwvg/tests/demoxbp.prg +++ b/contrib/gtwvg/tests/demoxbp.prg @@ -1,10 +1,10 @@ -// EnOnkar -// ( The Lord is ONE ) -// . -// Xbase++ Compatible XbpDialog() based Application +// EnOnkar +// ( The Lord is ONE ) +// . +// Xbase++ Compatible XbpDialog() based Application // -// Pritpal Bedi -// 2008-12-08 +// Pritpal Bedi +// 2008-12-08 #require "gtwvg" @@ -42,7 +42,7 @@ PROCEDURE Main() // --------------------------- StatusBar ---------------------------\\ 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:caption := "My Root Panel" oPanel1 := oSBar:addItem() @@ -91,7 +91,7 @@ PROCEDURE Main() AAdd( aParts, "DataRef" ) AEval( aParts, {| e | oListBox:addItem( e ) } ) - oListBox:itemSelected := {|| Wvg_MessageBox( , oListBox:getCurItem() ) } + oListBox:itemSelected := {|| wvg_MessageBox( , oListBox:getCurItem() ) } oListBox:setData( 3 ) // show selected "XbpToolBar" // --------------------------- PushButton --------------------------\\ @@ -111,7 +111,7 @@ PROCEDURE Main() oTree:create() oTree:setColorBG( RGB( 120, 15, 240 ) ) 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" ) @@ -174,7 +174,7 @@ PROCEDURE Main() oRadio := WvgRadioButton():new( oStatic2, , { 10, 10 }, { 100, 15 } ) oRadio:caption := "Com 1" 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 := WvgRadioButton():new( oStatic2, , { 10, 35 }, { 100, 15 } ) @@ -184,7 +184,7 @@ PROCEDURE Main() oCheck := WvgCheckBox():New( oStatic2, , { 10, 70 }, { 100, 15 }, , .T. ) oCheck:caption := "Checkbox A" 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() oXbp := Wvg3State():new() @@ -198,7 +198,7 @@ PROCEDURE Main() oXbp:caption := "3 State B" oXbp:create( oStatic2 ) // 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() // On :typeOut set the focus to the second SLE @@ -369,7 +369,7 @@ STATIC FUNCTION MyFunctionXbp( nMode ) Tone( MUSIC_WAITON[ 1 ], 1 ) CASE nMode == 3 - Wvg_MessageBox( , "Button clicked!" ) + wvg_MessageBox( , "Button clicked!" ) CASE nMode == 101 // Charge 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:strikeout := .T. 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:size := .F. diff --git a/contrib/hbhttpd/core.prg b/contrib/hbhttpd/core.prg index 11d4988648..a54cfce4a8 100644 --- a/contrib/hbhttpd/core.prg +++ b/contrib/hbhttpd/core.prg @@ -13,20 +13,18 @@ #pragma -km+ -/* - Docs: +/* Docs: - RFC 1945 - Hypertext Transfer Protocol -- HTTP/1.0 - RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1 - HTTP Made Really Easy (http://www.jmarshall.com/easy/http/) -*/ + RFC 1945 - Hypertext Transfer Protocol -- HTTP/1.0 - https://tools.ietf.org/html/rfc1945 + RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1 - https://tools.ietf.org/html/rfc2616 + 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 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 @@ -35,12 +33,14 @@ MEMVAR server, get, post, cookie, session, httpd CREATE CLASS UHttpd MODULE FRIENDLY EXPORTED: + METHOD Run( hConfig ) METHOD Stop() VAR cError INIT "" HIDDEN: + VAR hConfig VAR aFirewallFilter @@ -63,7 +63,6 @@ CREATE CLASS UHttpd MODULE FRIENDLY ENDCLASS FUNCTION UHttpdNew() - RETURN UHttpd() METHOD Run( hConfig ) CLASS UHttpd @@ -71,11 +70,11 @@ METHOD Run( hConfig ) CLASS UHttpd LOCAL hSocket, nI, aI, xValue, aThreads, nJobs, nWorkers IF ! hb_mtvm() - Self:cError := "Multithread support required" + ::cError := "Multithread support required" RETURN .F. ENDIF - Self:hConfig := { ; + ::hConfig := { ; "SSL" => .F., ; "Port" => 80, ; "BindAddress" => "0.0.0.0", ; @@ -89,67 +88,66 @@ METHOD Run( hConfig ) CLASS UHttpd "FirewallFilter" => "0.0.0.0/0" } FOR EACH xValue IN hConfig - IF ! hb_HHasKey( Self:hConfig, xValue:__enumKey ) .OR. !( ValType( xValue ) == ValType( Self:hConfig[ xValue:__enumKey ] ) ) - Self:cError := "Invalid config option '" + xValue:__enumKey + "'" + IF ! hb_HHasKey( ::hConfig, xValue:__enumKey ) .OR. !( ValType( xValue ) == ValType( ::hConfig[ xValue:__enumKey ] ) ) + ::cError := "Invalid config option '" + xValue:__enumKey + "'" RETURN .F. ENDIF - Self:hConfig[ xValue:__enumKey ] := xValue + ::hConfig[ xValue:__enumKey ] := xValue NEXT - - IF Self:hConfig[ "SSL" ] - IF Self:lHasSSL + IF ::hConfig[ "SSL" ] + IF ::lHasSSL SSL_init() DO WHILE RAND_status() != 1 RAND_add( Str( hb_Random(), 18, 15 ) + Str( hb_MilliSeconds(), 20 ), 1 ) ENDDO - Self:hSSLCtx := SSL_CTX_new( HB_SSL_CTX_NEW_METHOD_SSLV23_SERVER ) - SSL_CTX_set_options( Self:hSSLCtx, HB_SSL_OP_NO_TLSv1 ) - IF SSL_CTX_use_PrivateKey_file( Self:hSSLCtx, Self:hConfig[ "PrivateKeyFilename" ], HB_SSL_FILETYPE_PEM ) != 1 - Self:cError := "Invalid private key file" + ::hSSLCtx := SSL_CTX_new( HB_SSL_CTX_NEW_METHOD_SSLV23_SERVER ) + SSL_CTX_set_options( ::hSSLCtx, HB_SSL_OP_NO_TLSv1 ) + IF SSL_CTX_use_PrivateKey_file( ::hSSLCtx, ::hConfig[ "PrivateKeyFilename" ], HB_SSL_FILETYPE_PEM ) != 1 + ::cError := "Invalid private key file" RETURN .F. ENDIF - IF SSL_CTX_use_certificate_file( Self:hSSLCtx, Self:hConfig[ "CertificateFilename" ], HB_SSL_FILETYPE_PEM ) != 1 - Self:cError := "Invalid certificate file" + IF SSL_CTX_use_certificate_file( ::hSSLCtx, ::hConfig[ "CertificateFilename" ], HB_SSL_FILETYPE_PEM ) != 1 + ::cError := "Invalid certificate file" RETURN .F. ENDIF ELSE - Self:cError := "SSL not supported" + ::cError := "SSL not supported" RETURN .F. ENDIF ENDIF - IF Self:hConfig[ "Port" ] < 1 .OR. Self:hConfig[ "Port" ] > 65535 - Self:cError := "Invalid port number" + IF ::hConfig[ "Port" ] < 1 .OR. ::hConfig[ "Port" ] > 65535 + ::cError := "Invalid port number" RETURN .F. ENDIF - IF ParseFirewallFilter( Self:hConfig[ "FirewallFilter" ], @aI ) - Self:aFirewallFilter := aI + IF ParseFirewallFilter( ::hConfig[ "FirewallFilter" ], @aI ) + ::aFirewallFilter := aI ELSE - Self:cError := "Invalid firewall filter" + ::cError := "Invalid firewall filter" RETURN .F. ENDIF - Self:hmtxQueue := hb_mutexCreate() - Self:hmtxLog := hb_mutexCreate() - Self:hmtxSession := hb_mutexCreate() + ::hmtxQueue := hb_mutexCreate() + ::hmtxLog := hb_mutexCreate() + ::hmtxSession := hb_mutexCreate() - IF Empty( Self:hListen := hb_socketOpen() ) - Self:cError := "Socket create error: " + hb_socketErrorString() + IF Empty( ::hListen := hb_socketOpen() ) + ::cError := "Socket create error: " + hb_socketErrorString() RETURN .F. ENDIF - IF ! hb_socketBind( Self:hListen, { HB_SOCKET_AF_INET, Self:hConfig[ "BindAddress" ], Self:hConfig[ "Port" ] } ) - Self:cError := "Bind error: " + hb_socketErrorString() - hb_socketClose( Self:hListen ) + IF ! hb_socketBind( ::hListen, { HB_SOCKET_AF_INET, ::hConfig[ "BindAddress" ], ::hConfig[ "Port" ] } ) + ::cError := "Bind error: " + hb_socketErrorString() + hb_socketClose( ::hListen ) RETURN .F. ENDIF - IF ! hb_socketListen( Self:hListen ) - Self:cError := "Listen error: " + hb_socketErrorString() - hb_socketClose( Self:hListen ) + IF ! hb_socketListen( ::hListen ) + ::cError := "Listen error: " + hb_socketErrorString() + hb_socketClose( ::hListen ) RETURN .F. ENDIF @@ -158,49 +156,49 @@ METHOD Run( hConfig ) CLASS UHttpd AAdd( aThreads, hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @ProcessConnection(), Self ) ) NEXT - Self:lStop := .F. - Self:hSession := { => } + ::lStop := .F. + ::hSession := { => } 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 - Eval( Self:hConfig[ "Idle" ], Self ) - IF Self:lStop + Eval( ::hConfig[ "Idle" ], Self ) + IF ::lStop EXIT ENDIF ELSE - Self:LogError( "[error] Accept error: " + hb_socketErrorString() ) + ::LogError( "[error] Accept error: " + hb_socketErrorString() ) ENDIF ELSE - Eval( Self:hConfig[ "Trace" ], "New connection", hSocket ) - IF hb_mutexQueueInfo( Self:hmtxQueue, @nWorkers, @nJobs ) .AND. ; + Eval( ::hConfig[ "Trace" ], "New connection", hSocket ) + IF hb_mutexQueueInfo( ::hmtxQueue, @nWorkers, @nJobs ) .AND. ; Len( aThreads ) < THREAD_COUNT_MAX .AND. ; nJobs >= nWorkers AAdd( aThreads, hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @ProcessConnection(), Self ) ) ENDIF - hb_mutexNotify( Self:hmtxQueue, hSocket ) + hb_mutexNotify( ::hmtxQueue, hSocket ) ENDIF ENDDO - hb_socketClose( Self:hListen ) + hb_socketClose( ::hListen ) /* End child threads */ - AEval( aThreads, {|| hb_mutexNotify( Self:hmtxQueue, NIL ) } ) + AEval( aThreads, {|| hb_mutexNotify( ::hmtxQueue, NIL ) } ) AEval( aThreads, {| h | hb_threadJoin( h ) } ) RETURN .T. METHOD Stop() CLASS UHttpd - Eval( Self:hConfig[ "Trace" ], "stopping" ) - Self:lStop := .T. + Eval( ::hConfig[ "Trace" ], "stopping" ) + ::lStop := .T. RETURN NIL METHOD LogError( cError ) CLASS UHttpd - hb_mutexLock( Self:hmtxLog ) - Eval( Self:hConfig[ "LogError" ], DToS( Date() ) + " " + Time() + " " + cError ) - hb_mutexUnlock( Self:hmtxLog ) + hb_mutexLock( ::hmtxLog ) + Eval( ::hConfig[ "LogError" ], DToS( Date() ) + " " + Time() + " " + cError ) + hb_mutexUnlock( ::hmtxLog ) RETURN NIL @@ -208,15 +206,15 @@ METHOD LogAccess() CLASS UHttpd LOCAL cDate := DToS( Date() ), cTime := Time() - hb_mutexLock( Self:hmtxLog ) - Eval( Self:hConfig[ "LogAccess" ], ; + hb_mutexLock( ::hmtxLog ) + Eval( ::hConfig[ "LogAccess" ], ; server[ "REMOTE_ADDR" ] + " - - [" + Right( cDate, 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" ] + '" ' + ; hb_ntos( t_nStatusCode ) + " " + hb_ntos( Len( t_cResult ) ) + ; ' "' + server[ "HTTP_REFERER" ] + '" "' + server[ "HTTP_USER_AGENT" ] + ; '"' ) - hb_mutexUnlock( Self:hmtxLog ) + hb_mutexUnlock( ::hmtxLog ) RETURN NIL @@ -261,7 +259,7 @@ STATIC FUNCTION ParseFirewallFilter( cFilter, aFilter ) ENDIF ELSE 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. ENDIF ENDIF @@ -491,7 +489,7 @@ STATIC FUNCTION ProcessConnection( oServer ) ENDDO IF nErr != 0 - Eval( oServer:hConfig[ "Trace" ], "Close connection1", hSocket ) + Eval( oServer:hConfig[ "Trace" ], "Close connection", hSocket ) hb_socketShutdown( hSocket ) hb_socketClose( hSocket ) LOOP @@ -614,9 +612,9 @@ STATIC FUNCTION ProcessConnection( oServer ) IF !( Left( server[ "SERVER_PROTOCOL" ], 5 ) == "HTTP/" ) USetStatusCode( 400 ) /* Bad request */ 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 */ - ELSEIF !( server[ "REQUEST_METHOD" ] $ "GET POST" ) + ELSEIF ! server[ "REQUEST_METHOD" ] $ "GET POST" USetStatusCode( 501 ) /* Not implemented */ ELSE IF server[ "SERVER_PROTOCOL" ] == "HTTP/1.1" @@ -801,7 +799,7 @@ STATIC FUNCTION ParseRequestHeader( cRequest ) ENDSWITCH ENDIF NEXT - IF !( server[ "QUERY_STRING" ] == "" ) + IF ! server[ "QUERY_STRING" ] == "" FOR EACH cI IN hb_ATokens( server[ "QUERY_STRING" ], "&" ) IF ( nI := At( "=", cI ) ) > 0 get[ UUrlDecode( Left( cI, nI - 1 ) ) ] := UUrlDecode( SubStr( cI, nI + 1 ) ) @@ -813,7 +811,7 @@ STATIC FUNCTION ParseRequestHeader( cRequest ) RETURN nContentLength -STATIC FUNCTION ParseRequestBody( cRequest ) +STATIC PROCEDURE ParseRequestBody( cRequest ) LOCAL nI, cPart, cEncoding @@ -822,7 +820,7 @@ STATIC FUNCTION ParseRequestBody( cRequest ) IF ( nI := At( "CHARSET=", Upper( server[ "CONTENT_TYPE" ] ) ) ) > 0 cEncoding := Upper( SubStr( server[ "CONTENT_TYPE" ], nI + 8 ) ) ENDIF - IF !( cRequest == "" ) + IF ! cRequest == "" IF cEncoding == "UTF-8" FOR EACH cPart IN hb_ATokens( cRequest, "&" ) IF ( nI := At( "=", cPart ) ) > 0 @@ -843,7 +841,7 @@ STATIC FUNCTION ParseRequestBody( cRequest ) ENDIF ENDIF - RETURN NIL + RETURN 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 " ) SWITCH t_nStatusCode - CASE 100 ; cStatus := "100 Continue" ; EXIT - CASE 101 ; cStatus := "101 Switching Protocols" ; EXIT - CASE 200 ; cStatus := "200 OK" ; EXIT - CASE 201 ; cStatus := "201 Created" ; EXIT - CASE 202 ; cStatus := "202 Accepted" ; EXIT - CASE 203 ; cStatus := "203 Non-Authoritative Information" ; EXIT - CASE 204 ; cStatus := "204 No Content" ; EXIT - CASE 205 ; cStatus := "205 Reset Content" ; EXIT - CASE 206 ; cStatus := "206 Partial Content" ; EXIT - CASE 300 ; cStatus := "300 Multiple Choices" ; EXIT - CASE 301 ; cStatus := "301 Moved Permanently" ; EXIT - CASE 302 ; cStatus := "302 Found" ; EXIT - CASE 303 ; cStatus := "303 See Other" ; EXIT - CASE 304 ; cStatus := "304 Not Modified" ; EXIT - CASE 305 ; cStatus := "305 Use Proxy" ; EXIT - CASE 307 ; cStatus := "307 Temporary Redirect" ; EXIT - CASE 400 ; cStatus := "400 Bad Request" ; EXIT - CASE 401 ; cStatus := "401 Unauthorized" ; EXIT - CASE 402 ; cStatus := "402 Payment Required" ; EXIT - CASE 403 ; cStatus := "403 Forbidden" ; EXIT - CASE 404 ; cStatus := "404 Not Found" ; EXIT - CASE 405 ; cStatus := "405 Method Not Allowed" ; EXIT - CASE 406 ; cStatus := "406 Not Acceptable" ; EXIT - CASE 407 ; cStatus := "407 Proxy Authentication Required" ; EXIT - CASE 408 ; cStatus := "408 Request Timeout" ; EXIT - CASE 409 ; cStatus := "409 Conflict" ; EXIT - CASE 410 ; cStatus := "410 Gone" ; EXIT - CASE 411 ; cStatus := "411 Length Required" ; EXIT - CASE 412 ; cStatus := "412 Precondition Failed" ; EXIT - CASE 413 ; cStatus := "413 Request Entity Too Large" ; EXIT - CASE 414 ; cStatus := "414 Request-URI Too Long" ; EXIT - CASE 415 ; cStatus := "415 Unsupprted Media Type" ; EXIT - CASE 416 ; cStatus := "416 Requested Range Not Satisfiable" ; EXIT - CASE 417 ; cStatus := "417 Expectation Failed" ; EXIT - CASE 500 ; cStatus := "500 Internal Server Error" ; EXIT - CASE 501 ; cStatus := "501 Not Implemented" ; EXIT - CASE 502 ; cStatus := "502 Bad Gateway" ; EXIT - CASE 503 ; cStatus := "503 Service Unavailable" ; EXIT - CASE 504 ; cStatus := "504 Gateway Timeout" ; EXIT - CASE 505 ; cStatus := "505 HTTP Version Not Supported" ; EXIT - OTHERWISE; cStatus := "500 Internal Server Error" + CASE 100 ; cStatus := "100 Continue" ; EXIT + CASE 101 ; cStatus := "101 Switching Protocols" ; EXIT + CASE 200 ; cStatus := "200 OK" ; EXIT + CASE 201 ; cStatus := "201 Created" ; EXIT + CASE 202 ; cStatus := "202 Accepted" ; EXIT + CASE 203 ; cStatus := "203 Non-Authoritative Information" ; EXIT + CASE 204 ; cStatus := "204 No Content" ; EXIT + CASE 205 ; cStatus := "205 Reset Content" ; EXIT + CASE 206 ; cStatus := "206 Partial Content" ; EXIT + CASE 300 ; cStatus := "300 Multiple Choices" ; EXIT + CASE 301 ; cStatus := "301 Moved Permanently" ; EXIT + CASE 302 ; cStatus := "302 Found" ; EXIT + CASE 303 ; cStatus := "303 See Other" ; EXIT + CASE 304 ; cStatus := "304 Not Modified" ; EXIT + CASE 305 ; cStatus := "305 Use Proxy" ; EXIT + CASE 307 ; cStatus := "307 Temporary Redirect" ; EXIT + CASE 400 ; cStatus := "400 Bad Request" ; EXIT + CASE 401 ; cStatus := "401 Unauthorized" ; EXIT + CASE 402 ; cStatus := "402 Payment Required" ; EXIT + CASE 403 ; cStatus := "403 Forbidden" ; EXIT + CASE 404 ; cStatus := "404 Not Found" ; EXIT + CASE 405 ; cStatus := "405 Method Not Allowed" ; EXIT + CASE 406 ; cStatus := "406 Not Acceptable" ; EXIT + CASE 407 ; cStatus := "407 Proxy Authentication Required" ; EXIT + CASE 408 ; cStatus := "408 Request Timeout" ; EXIT + CASE 409 ; cStatus := "409 Conflict" ; EXIT + CASE 410 ; cStatus := "410 Gone" ; EXIT + CASE 411 ; cStatus := "411 Length Required" ; EXIT + CASE 412 ; cStatus := "412 Precondition Failed" ; EXIT + CASE 413 ; cStatus := "413 Request Entity Too Large" ; EXIT + CASE 414 ; cStatus := "414 Request-URI Too Long" ; EXIT + CASE 415 ; cStatus := "415 Unsupprted Media Type" ; EXIT + CASE 416 ; cStatus := "416 Requested Range Not Satisfiable" ; EXIT + CASE 417 ; cStatus := "417 Expectation Failed" ; EXIT + CASE 500 ; cStatus := "500 Internal Server Error" ; EXIT + CASE 501 ; cStatus := "501 Not Implemented" ; EXIT + CASE 502 ; cStatus := "502 Bad Gateway" ; EXIT + CASE 503 ; cStatus := "503 Service Unavailable" ; EXIT + CASE 504 ; cStatus := "504 Gateway Timeout" ; EXIT + CASE 505 ; cStatus := "505 HTTP Version Not Supported" ; EXIT + OTHERWISE; cStatus := "500 Internal Server Error" ENDSWITCH cRet += cStatus + CR_LF @@ -943,13 +941,16 @@ STATIC FUNCTION HttpDateUnformat( cDate, tDate ) STATIC FUNCTION UErrorHandler( oErr, oServer ) Eval( oServer:hConfig[ "Trace" ], "UErrorHandler" ) - IF oErr:genCode == EG_ZERODIV; RETURN 0 - ELSEIF oErr:genCode == EG_LOCK; RETURN .T. - ELSEIF ( oErr:genCode == EG_OPEN .AND. oErr:osCode == 32 .OR. ; + DO CASE + CASE oErr:genCode == EG_ZERODIV + 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 NetErr( .T. ) RETURN .F. - ENDIF + ENDCASE oServer:LogError( GetErrorDesc( oErr ) ) IF oErr != NIL // Dummy check to avoid unreachable code warning for RETURN NIL Break( oErr ) @@ -1124,9 +1125,7 @@ STATIC FUNCTION cvt2str( xI, lLong ) RETURN NIL -/******************************************************************** - Public functions -********************************************************************/ +/* Public functions */ PROCEDURE USetStatusCode( nStatusCode ) @@ -1139,7 +1138,7 @@ FUNCTION UGetHeader( cType ) LOCAL nI IF ( nI := AScan( t_aHeader, {| x | Upper( x[ 1 ] ) == Upper( cType ) } ) ) > 0 - RETURN t_aHeader[ nI, 2 ] + RETURN t_aHeader[ nI ][ 2 ] ENDIF RETURN NIL @@ -1149,7 +1148,7 @@ PROCEDURE UAddHeader( cType, cValue ) LOCAL nI IF ( nI := AScan( t_aHeader, {| x | Upper( x[ 1 ] ) == Upper( cType ) } ) ) > 0 - t_aHeader[ nI, 2 ] := cValue + t_aHeader[ nI ][ 2 ] := cValue ELSE AAdd( t_aHeader, { cType, cValue } ) ENDIF @@ -1211,7 +1210,7 @@ PROCEDURE USessionStart() t_aSessionData := httpd:hSession[ cSID ] IF hb_mutexLock( t_aSessionData[ 1 ], 0 ) - // No concurent sessions + // No concurrent sessions IF t_aSessionData[ 3 ] > hb_MilliSeconds() t_aSessionData[ 3 ] := hb_MilliSeconds() + SESSION_TIMEOUT * 1000 session := t_aSessionData[ 2 ] @@ -1221,7 +1220,7 @@ PROCEDURE USessionStart() ENDIF ELSE - // Concurent process exists + // Concurrent process exists hb_mutexUnlock( httpd:hmtxSession ) // Wait for session @@ -1239,7 +1238,7 @@ PROCEDURE USessionStart() USessionCreateInternal() ENDIF ELSE - // Session was destroyed by concurent process + // Session was destroyed by concurrent process USessionCreateInternal() ENDIF ENDIF @@ -1267,7 +1266,7 @@ PROCEDURE USessionDestroy() FUNCTION UOsFileName( cFileName ) - IF !( hb_ps() == "/" ) + IF ! hb_ps() == "/" RETURN StrTran( cFileName, "/", hb_ps() ) ENDIF @@ -1462,9 +1461,9 @@ PROCEDURE UProcFiles( cFileName, lIndex ) iif( Y[ 5 ] == "D", .F., X[ 1 ] < Y[ 1 ] ) ) } ) ENDIF - UWrite( '

Index of ' + server[ "SCRIPT_NAME" ] + '

      ' )
-      UWrite( 'Name                                                  ' )
-      UWrite( 'Modified             ' )
+      UWrite( '

Index of ' + server[ "SCRIPT_NAME" ] + '

' )
+      UWrite( 'Name' )
+      UWrite( 'Modified' )
       UWrite( 'Size' + CR_LF + '
' ) FOR EACH aF IN aDir IF Left( aF[ 1 ], 1 ) == "." @@ -1721,7 +1720,7 @@ STATIC FUNCTION compile_buffer( cTpl, nStart, aCode ) RETURN Len( cTpl ) + 1 -STATIC FUNCTION SUBSTRCOUNT( cSub, cString, nStart, nEnd ) +STATIC FUNCTION SubStrCount( cSub, cString, nStart, nEnd ) LOCAL nCount := 0 diff --git a/contrib/hbhttpd/tests/eshop.prg b/contrib/hbhttpd/tests/eshop.prg index 8c76e49917..b034d0baec 100644 --- a/contrib/hbhttpd/tests/eshop.prg +++ b/contrib/hbhttpd/tests/eshop.prg @@ -303,7 +303,7 @@ STATIC FUNCTION proc_account_edit() cName := users->NAME IF hb_HHasKey( session, "formdata_account/edit" ) - cName := session[ "formdata_account/edit", "name" ] + cName := session[ "formdata_account/edit" ][ "name" ] ENDIF IF server[ "REQUEST_METHOD" ] == "POST" cName := hb_HGetDef( post, "name", "" ) @@ -349,8 +349,8 @@ STATIC FUNCTION proc_register() cUser := "" cName := "" IF hb_HHasKey( session, "formdata_register" ) - cUser := session[ "formdata_register", "user" ] - cName := session[ "formdata_register", "name" ] + cUser := session[ "formdata_register" ][ "user" ] + cName := session[ "formdata_register" ][ "name" ] ENDIF IF server[ "REQUEST_METHOD" ] == "POST" 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 ) session[ "formdata_register" ] := { "user" => cUser, "name" => cName } URedirect( "?err=1" ) - ELSEIF !( cPassword1 == cPassword2 ) + ELSEIF ! cPassword1 == cPassword2 session[ "formdata_register" ] := { "user" => cUser, "name" => cName } URedirect( "?err=2" ) ELSEIF dbSeek( cUser, .F. ) diff --git a/contrib/hbhttpd/widgets.prg b/contrib/hbhttpd/widgets.prg index 934b50fb40..d37988cda6 100644 --- a/contrib/hbhttpd/widgets.prg +++ b/contrib/hbhttpd/widgets.prg @@ -21,7 +21,7 @@ FUNCTION UWMainNew() LOCAL oW := UWMain() - session[ "_uthis", "main" ] := oW + session[ "_uthis" ][ "main" ] := oW RETURN oW @@ -92,7 +92,7 @@ METHOD Add( oWidget, nRow, nCol ) CLASS UWLayoutGrid AEval( ::aChilds, {| x | AAdd( x, {} ) } ) NEXT ENDIF - AAdd( ::aChilds[ nRow, nCol ], oWidget ) + AAdd( ::aChilds[ nRow ][ nCol ], oWidget ) RETURN Self @@ -311,11 +311,11 @@ METHOD Paint() CLASS UWMenu LOCAL nI UWrite( '
' ) - FOR nI := 1 TO Len( Self:aItems ) + FOR nI := 1 TO Len( ::aItems ) IF nI != 1 UWrite( ' | ' ) ENDIF - UWrite( '' + UHtmlEncode( Self:aItems[ nI, 1 ] ) + '' ) + UWrite( '' + UHtmlEncode( ::aItems[ nI ][ 1 ] ) + '' ) NEXT UWrite( '
' ) @@ -351,8 +351,8 @@ METHOD Output() CLASS UWBrowse // Header cRet += '' - FOR nI := 1 TO Len( Self:aColumns ) - cRet += '' + UHtmlEncode( Self:aColumns[ nI, 2 ] ) + '' + FOR nI := 1 TO Len( ::aColumns ) + cRet += '' + UHtmlEncode( ::aColumns[ nI ][ 2 ] ) + '' NEXT cRet += '' @@ -364,20 +364,21 @@ METHOD Output() CLASS UWBrowse ENDIF DO WHILE ! Eof() cRet += '' - FOR nI := 1 TO Len( Self:aColumns ) - xField := Self:aColumns[ nI, 3 ] - IF HB_ISSTRING( xField ) + FOR nI := 1 TO Len( ::aColumns ) + xField := ::aColumns[ nI ][ 3 ] + DO CASE + CASE HB_ISSTRING( xField ) xI := FieldGet( FieldPos( xField ) ) - ELSEIF HB_ISEVALITEM( xField ) + CASE HB_ISEVALITEM( xField ) xI := Eval( xField ) - ENDIF + ENDCASE SWITCH ValType( xI ) CASE "C" ; xI := RTrim( xI ); EXIT CASE "N" ; xI := Str( xI ); EXIT CASE "D" ; xI := DToC( xI ); EXIT OTHERWISE ; xI := "ValType()==" + ValType( xI ) ENDSWITCH - IF ! Self:aColumns[ nI, 4 ] + IF ! ::aColumns[ nI ][ 4 ] xI := UHtmlEncode( xI ) ENDIF cRet += '' + xI + '' @@ -462,7 +463,7 @@ PROCEDURE UProcWidgets( cURL, aMap ) nI := 1 nL := Min( Len( aURL ), Len( aStack ) ) DO WHILE nI <= nL - IF aStack[ nI, 1 ] == aURL[ nI ] + IF aStack[ nI ][ 1 ] == aURL[ nI ] nI++ ELSE EXIT @@ -523,7 +524,7 @@ PROCEDURE UWDefaultHandler( cMethod ) IF cMethod == "GET" IF ( cID := hb_HGetDef( get, "ajax" ) ) == NIL - session[ "_uthis", "main" ]:Paint() + session[ "_uthis" ][ "main" ]:Paint() ELSE IF ( oW := UGetWidgetById( cID ) ) != NIL UAddHeader( "Content-type", "text/html; charset=UTF-8" ) @@ -538,13 +539,13 @@ STATIC PROCEDURE SetWId( oW, cID ) IF cID != NIL oW:cID := cID - session[ "_uthis", "idhash", cID ] := oW + session[ "_uthis" ][ "idhash" ][ cID ] := oW ENDIF RETURN FUNCTION UGetWidgetById( cID ) - RETURN hb_HGetDef( session[ "_uthis", "idhash" ], cID ) + RETURN hb_HGetDef( session[ "_uthis" ][ "idhash" ], cID ) STATIC FUNCTION uhttpd_split( cSeparator, cString ) diff --git a/contrib/hbtip/thtml.prg b/contrib/hbtip/thtml.prg index 56b9cceeeb..1e657836d7 100644 --- a/contrib/hbtip/thtml.prg +++ b/contrib/hbtip/thtml.prg @@ -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 } ) ENDIF - IF aAttr[ nPos, 2 ] == HTML_ATTR_TYPE_BOOL + IF aAttr[ nPos ][ 2 ] == HTML_ATTR_TYPE_BOOL RETURN " " + cName ENDIF @@ -1326,7 +1326,7 @@ METHOD setAttribute( cName, cValue ) CLASS THtmlNode RETURN ::error( "Invalid HTML attribute for: <" + ::htmlTagName + ">", ::className(), cName, EG_ARG, { cName, cValue } ) ENDIF - IF aAttr[ nPos, 2 ] == HTML_ATTR_TYPE_BOOL + IF aAttr[ nPos ][ 2 ] == HTML_ATTR_TYPE_BOOL hHash[ cName ] := "" ELSE hHash[ cName ] := cValue diff --git a/src/debug/dbgtobj.prg b/src/debug/dbgtobj.prg index 6940e72a72..8c6d7b5a76 100644 --- a/src/debug/dbgtobj.prg +++ b/src/debug/dbgtobj.prg @@ -143,14 +143,14 @@ METHOD addWindows( nRow ) CLASS HBDbObject nMaxLen := 0 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:DefColor := { 1, 2 } oBrwSets:Freeze := 1 - oBrwSets:AddColumn( oCol := HBDbColumnNew( "", {|| iif( ! ::pItems[ ::ArrayIndex, OMSG_EDIT ], ; - ::pItems[ ::ArrayIndex, OMSG_VALUE ], ; - __dbgValToExp( __dbgObjGetValue( ::TheObj, ::pItems[ ::arrayindex, OMSG_NAME ] ) ) ) } ) ) + oBrwSets:AddColumn( oCol := HBDbColumnNew( "", {|| iif( ! ::pItems[ ::ArrayIndex ][ OMSG_EDIT ], ; + ::pItems[ ::ArrayIndex ][ OMSG_VALUE ], ; + __dbgValToExp( __dbgObjGetValue( ::TheObj, ::pItems[ ::arrayindex ][ OMSG_NAME ] ) ) ) } ) ) oCol:DefColor := { 1, 3 } oCol:width := oWndSets:nRight - oWndSets:nLeft - nMaxLen - 2 diff --git a/src/rdd/hbsix/sxini.prg b/src/rdd/hbsix/sxini.prg index e1bfd141c2..df29bb4b33 100644 --- a/src/rdd/hbsix/sxini.prg +++ b/src/rdd/hbsix/sxini.prg @@ -141,10 +141,9 @@ FUNCTION sx_IniHeader( cHeaderName, nArea ) nArea := Select() ENDIF - IF nArea $ SxIniInfo - IF cHeaderName $ SxIniInfo[ nArea ] - RETURN SxIniInfo[ nArea, cHeaderName ] - ENDIF + IF nArea $ SxIniInfo .AND. ; + cHeaderName $ SxIniInfo[ nArea ] + RETURN SxIniInfo[ nArea ][ cHeaderName ] ENDIF RETURN {} diff --git a/src/rtl/hbi18n2.prg b/src/rtl/hbi18n2.prg index a9429252b8..e63a3ec12c 100644 --- a/src/rtl/hbi18n2.prg +++ b/src/rtl/hbi18n2.prg @@ -322,7 +322,7 @@ STATIC FUNCTION __i18n_ItemToStr( item ) cSource := "~" + Left( cSource, tmp - 1 ) + Str( Val( SubStr( cSource, tmp + 1 ) ), 10, 0 ) ENDIF - RETURN cSource + item[ _I18N_MSGID, 1 ] + RETURN cSource + item[ _I18N_MSGID ][ 1 ] FUNCTION __i18n_potArrayClean( aTrans, lKeepSource, lKeepVoidTranslations, bTransformTranslation ) @@ -337,7 +337,7 @@ FUNCTION __i18n_potArrayClean( aTrans, lKeepSource, lKeepVoidTranslations, bTran FOR EACH item IN aTrans IF HB_ISEVALITEM( bTransformTranslation ) 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 ) cString := tmp ENDIF @@ -352,7 +352,7 @@ FUNCTION __i18n_potArrayClean( aTrans, lKeepSource, lKeepVoidTranslations, bTran FOR EACH item IN aTrans DESCEND lVoid := .T. 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. EXIT ENDIF @@ -371,31 +371,31 @@ FUNCTION __i18n_potArraySave( cFile, aTrans, /* @ */ cErrorMsg, lVersionNo, lSou LOCAL aItem LOCAL hFile LOCAL lRet, lPlural - LOCAL cEol, cPOT, cFlg + LOCAL cEOL, cPOT, cFlg LOCAL msg hb_default( @lVersionNo, .T. ) hb_default( @lSourceRef, .T. ) lRet := .F. - cEol := hb_eol() - 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 */ - "#" + cEol + ; - "# This file is generated by " + iif( lVersionNo, hb_Version(), "Harbour" ) + cEol + ; - "#" + cEol + cEOL := hb_eol() + 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 */ + "#" + cEOL + ; + "# This file is generated by " + iif( lVersionNo, hb_Version(), "Harbour" ) + cEOL + ; + "#" + cEOL FOR EACH aItem IN aTrans - cPOT += cEol + cPOT += cEOL IF lSourceRef .AND. ! Empty( aItem[ _I18N_SOURCE ] ) cPOT += "#: " cPOT += aItem[ _I18N_SOURCE ] - cPOT += cEol + cPOT += cEOL ENDIF cPOT += cFlg IF ! aItem[ _I18N_CONTEXT ] == "" cPOT += "msgctxt " cPOT += __i18n_strEncode( aItem[ _I18N_CONTEXT ] ) - cPOT += cEol + cPOT += cEOL ENDIF FOR EACH msg IN aItem[ _I18N_MSGID ] SWITCH msg:__enumIndex() @@ -409,7 +409,7 @@ FUNCTION __i18n_potArraySave( cFile, aTrans, /* @ */ cErrorMsg, lVersionNo, lSou cPOT += "msgid_plural" + hb_ntos( msg:__enumIndex() - 1 ) + " " ENDSWITCH cPOT += __i18n_strEncode( msg ) - cPOT += cEol + cPOT += cEOL NEXT lPlural := aItem[ _I18N_PLURAL ] .OR. Len( aItem[ _I18N_MSGSTR ] ) > 1 FOR EACH msg IN aItem[ _I18N_MSGSTR ] @@ -419,7 +419,7 @@ FUNCTION __i18n_potArraySave( cFile, aTrans, /* @ */ cErrorMsg, lVersionNo, lSou cPOT += "msgstr " ENDIF cPOT += __i18n_strEncode( msg ) - cPOT += cEol + cPOT += cEOL NEXT NEXT @@ -449,21 +449,21 @@ FUNCTION __i18n_potArrayToHash( aTrans, lEmpty, hI18N ) hTrans := hI18N[ "CONTEXT" ] 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 ] IF cContext $ hTrans hContext := hTrans[ cContext ] ELSE hTrans[ cContext ] := hContext := { => } ENDIF - IF Empty( aItem[ _I18N_MSGSTR, 1 ] ) - IF ! aItem[ _I18N_MSGID, 1 ] $ hContext - hContext[ aItem[ _I18N_MSGID, 1 ] ] := iif( aItem[ _I18N_PLURAL ], ; - AClone( aItem[ _I18N_MSGID ] ), aItem[ _I18N_MSGID, 1 ] ) + IF Empty( aItem[ _I18N_MSGSTR ][ 1 ] ) + IF ! aItem[ _I18N_MSGID ][ 1 ] $ hContext + hContext[ aItem[ _I18N_MSGID ][ 1 ] ] := iif( aItem[ _I18N_PLURAL ], ; + AClone( aItem[ _I18N_MSGID ] ), aItem[ _I18N_MSGID ][ 1 ] ) ENDIF ELSE - hContext[ aItem[ _I18N_MSGID, 1 ] ] := iif( aItem[ _I18N_PLURAL ], ; - AClone( aItem[ _I18N_MSGSTR ] ), aItem[ _I18N_MSGSTR, 1 ] ) + hContext[ aItem[ _I18N_MSGID ][ 1 ] ] := iif( aItem[ _I18N_PLURAL ], ; + AClone( aItem[ _I18N_MSGSTR ] ), aItem[ _I18N_MSGSTR ][ 1 ] ) ENDIF ENDIF NEXT @@ -484,9 +484,9 @@ FUNCTION __i18n_potArrayTrans( aTrans, hI18N ) cContext := aItem[ _I18N_CONTEXT ] IF cContext $ hTrans hContext := hTrans[ cContext ] - IF Empty( aItem[ _I18N_MSGSTR, 1 ] ) - IF aItem[ _I18N_MSGID, 1 ] $ hContext - xTrans := hContext[ aItem[ _I18N_MSGID, 1 ] ] + IF Empty( aItem[ _I18N_MSGSTR ][ 1 ] ) + IF aItem[ _I18N_MSGID ][ 1 ] $ hContext + xTrans := hContext[ aItem[ _I18N_MSGID ][ 1 ] ] IF aItem[ _I18N_PLURAL ] aItem[ _I18N_MSGSTR ] := iif( HB_ISARRAY( xTrans ), ; AClone( xTrans ), { xTrans } ) @@ -533,13 +533,13 @@ FUNCTION __i18n_potArrayJoin( aTrans, aTrans2, hIndex ) IF ! HB_ISHASH( hIndex ) hIndex := { => } 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() NEXT ENDIF 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 aDest := aTrans[ hIndex[ ctx ] ] IF aItem[ _I18N_PLURAL ] @@ -561,7 +561,7 @@ FUNCTION __i18n_potArrayJoin( aTrans, aTrans2, hIndex ) IF ! Empty( aItem[ _I18N_MSGSTR ] ) .AND. ; ( Empty( aDest[ _I18N_MSGSTR ] ) .OR. ; ( Len( aDest[ _I18N_MSGSTR ] ) == 1 .AND. ; - Empty( aDest[ _I18N_MSGSTR, 1 ] ) ) ) + Empty( aDest[ _I18N_MSGSTR ][ 1 ] ) ) ) aDest[ _I18N_MSGSTR ] := AClone( aItem[ _I18N_MSGSTR ] ) ENDIF ELSE @@ -595,7 +595,7 @@ FUNCTION hb_i18n_SavePOT( cFile, pI18N, /* @ */ cErrorMsg ) LOCAL hI18N LOCAL hFile LOCAL lRet := .T. - LOCAL cEol, cPOT, cFlg + LOCAL cEOL, cPOT, cFlg LOCAL context, trans, msgctxt, msgstr IF HB_ISPOINTER( pI18N ) @@ -605,35 +605,35 @@ FUNCTION hb_i18n_SavePOT( cFile, pI18N, /* @ */ cErrorMsg ) cErrorMsg := "wrong translation set item" lRet := .F. ELSE - cEol := hb_eol() - cFlg := "#, c-format" + cEol + cEOL := hb_eol() + cFlg := "#, c-format" + cEOL cPOT := ; - "#" + cEol + ; - "# This file is generated by " + hb_Version() + cEol + ; - "#" + cEol + "#" + cEOL + ; + "# This file is generated by " + hb_Version() + cEOL + ; + "#" + cEOL FOR EACH context IN hI18N[ "CONTEXT" ] msgctxt := iif( context:__enumKey() == "", NIL, ; - "msgctxt " + __i18n_strEncode( context:__enumKey() ) + cEol ) + "msgctxt " + __i18n_strEncode( context:__enumKey() ) + cEOL ) FOR EACH trans IN context - cPOT += cEol + cFlg + cPOT += cEOL + cFlg IF msgctxt != NIL cPOT += msgctxt ENDIF cPOT += "msgid " cPOT += __i18n_strEncode( trans:__enumKey() ) - cPOT += cEol + cPOT += cEOL IF HB_ISARRAY( trans ) FOR EACH msgstr IN trans cPOT += "msgstr[" cPOT += hb_ntos( msgstr:__enumIndex() - 1 ) cPOT += "] " cPOT += __i18n_strEncode( msgstr ) - cPOT += cEol + cPOT += cEOL NEXT ELSE cPOT += "msgstr " cPOT += __i18n_strEncode( trans ) - cPOT += cEol + cPOT += cEOL ENDIF NEXT NEXT diff --git a/src/rtl/tbrowse.prg b/src/rtl/tbrowse.prg index 8c17364fb1..ff84889c0d 100644 --- a/src/rtl/tbrowse.prg +++ b/src/rtl/tbrowse.prg @@ -547,8 +547,8 @@ METHOD colorRect( aRect, aColors ) CLASS TBrowse FOR nRow := aRect[ 1 ] TO aRect[ 3 ] ::readRecord( nRow ) FOR nCol := aRect[ 2 ] TO aRect[ 4 ] - ::aCellColors[ nRow, nCol ][ 1 ] := aColors[ 1 ] - ::aCellColors[ nRow, nCol ][ 2 ] := aColors[ 2 ] + ::aCellColors[ nRow ][ nCol ][ 1 ] := aColors[ 1 ] + ::aCellColors[ nRow ][ nCol ][ 2 ] := aColors[ 2 ] NEXT ::dispRow( nRow ) NEXT @@ -612,7 +612,7 @@ METHOD readRecord( nRow ) CLASS TBrowse IF nRow <= ::nLastRow nToMove := nRow - ::nBufferPos 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 * value and current code below replicates what Clipper * seems to do but it means that in network environment @@ -802,7 +802,7 @@ METHOD stabilize() CLASS TBrowse ::nRowPos := ::nLastRow ENDIF 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 * value and current code below replicates what Clipper * 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. ; ::aCellStatus[ nRow ] - RETURN ::aCellValues[ nRow, nCol ] + RETURN ::aCellValues[ nRow ][ nCol ] ENDIF RETURN NIL @@ -893,7 +893,7 @@ METHOD cellColor( nRow, nCol ) CLASS TBrowse nCol >= 1 .AND. nCol <= ::colCount .AND. ; ::aCellStatus[ nRow ] - RETURN ::aCellColors[ nRow, nCol ] + RETURN ::aCellColors[ nRow ][ nCol ] ENDIF RETURN NIL diff --git a/utils/hbtest/rt_array.prg b/utils/hbtest/rt_array.prg index 345e964f35..36ca90d2a6 100644 --- a/utils/hbtest/rt_array.prg +++ b/utils/hbtest/rt_array.prg @@ -387,11 +387,11 @@ PROCEDURE Main_ARRAY() HBTEST AScan( saAllTypes, sbBlock ) IS 0 HBTEST AScan( saAllTypes, sbBlockC ) IS 0 HBTEST AScan( saAllTypes, saArray ) IS 0 - SET EXACT ON + Set( _SET_EXACT, .T. ) HBTEST AScan( saAllTypes, scString ) IS 1 HBTEST AScan( saAllTypes, scStringE ) IS 2 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 TASOSM1() IS "NN 5NN 4NN 3NN 2NN 1NN 0NN 0NN 0NN 0NN 0NN 0NN 0 0{ }" , "NN 5NN 4 3{ 2, 1, 3 }"