FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour To Antonio: video corruption
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
To Antonio: video corruption
Posted: Thu May 21, 2015 05:15 PM

Antonio:

This happens in a console app.
When I open a couple (3) of windows via the WOPEN() function, then from the last one I execute a RUN command (calling a FW GUI App), when I close all the WOPEN() created windows the physical screen ( WSELECT(0) ) shows the window contents of the window that called the RUN command ON TOP of the physical ( WSELECT(0) ) screen. Strange enough. :shock:
Thank you for your help !

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: To Antonio: video corruption
Posted: Thu May 21, 2015 07:24 PM

Gustavo,

Could you post a screenshot ? thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Re: To Antonio: video corruption
Posted: Fri May 22, 2015 06:29 AM
Antonio:

Screen shots.
1. Menu running on console (physical screen) ( WSELECT(0) ).
Code (fw): Select all Collapse
 File  Locate  View  Run  Point  Monitor  Options  Window  Help
              ┌─────────────────┐
              │  Windows        │
              │  Sets           │
              │  WorkAreas   F6 │
              │  App Screen  F4 │
              │-----------------│
              │  CallStack      │
              └─────────────────┘

2. First window opened via WOPEN()
Code (fw): Select all Collapse
 File  Locate  View  Run  Point  Monitor  Options  Window  Help






               ╔═ Window 1 ════════════════╗
               ║                           ║
               ║                           ║
               ║                           ║
               ║                           ║
               ╚═══════════════════════════╝

3. Second window opened via WOPEN()
Code (fw): Select all Collapse
 File  Locate  View  Run  Point  Monitor  Options  Window  Help

╔═ Window 2 ═══════════════════════════════════════════════════════════════════╗
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

4. Third window opened via WOPEN()
Code (fw): Select all Collapse
╔═ Window 3 ═════════════════════════════════════════════════════════════════╗
║                                                                            ║
║                                                                            ║═╗
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
╚════════════════════════════════════════════════════════════════════════════╝═╝

Right after opening this window I do a RUN ( cCommand ) where cCommand := "NOTEPAD.EXE VIDFAULT.PRG"
5. After closing NOTEPAD, I close Window #3, Window #2 and finally Window #1 (in that precise order)
6. Here's how the menu on console appears.
Code (fw): Select all Collapse
╔═ Window 3 ══ View ═════════════════════════════════════════════════════════╗
║             ┌─────────────────┐                                            ║
║             │  Windows        │                                            ║═╗
║             │  Sets           │                                            ║ ║
║             │  WorkAreas   F6 │                                            ║ ║
║             │  App Screen  F4 │                                            ║ ║
║             │-----------------│                                            ║ ║
║             │  CallStack      │                                            ║ ║
║             └─────────────────┘                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
║                                                                            ║ ║
╚════════════════════════════════════════════════════════════════════════════╝═╝



Source code included.

Code (fw): Select all Collapse
#pragma -b-

#xcommand MENU [<oMenu>] => [ <oMenu> := ] HBDbMenu():New()
#xcommand MENUITEM [ <oMenuItem> PROMPT ] <cPrompt> ;
          [ IDENT <nIdent> ] [ ACTION <uAction,...> ] ;
          [ CHECKED <bChecked> ] => ;
   [ <oMenuItem> := ] HBDbMenu():AddItem( HBDbMenuItem():New( <cPrompt>,;
   [{||<uAction>}], [<bChecked>], [<nIdent>] ) )
#xcommand SEPARATOR => HBDbMenu():AddItem( HBDbMenuItem():New( "-" ) )
#xcommand ENDMENU => ATail( HBDbMenu():aMenus ):Build()



STATIC lExit := .F.



PROCEDURE Main

   LOCAL oMenu, nOldPopUp, nMenuItem

   SETMODE( 25,80 )
   SET CURSOR OFF
   SETBLINK( .F. )
   SET COLOR TO "B+/W*"
   CLEAR SCREEN

alert("Activate Debugger")
   ALTD(1)
alert("Call Debugger")
   ALTD()
alert("Build Menu")
   oMenu = BuildMenu()

   oMenu:Display()
   oMenu:ShowPopup( 1 )

   while ! lExit
      nOldPopup = oMenu:nOpenPopup
      nMenuItem = oMenu:aItems[ nOldPopup ]:bAction:nOpenPopup
      oMenu:ProcessKey( Inkey( 0 ) )
      if oMenu:nOpenPopup == 0
         oMenu:ShowPopup( nOldPopup, nMenuItem )
      endif
   end

   SET CURSOR ON
RETURN
// EOP: Main


FUNCTION BuildMenu() // Builds the debugger pulldown menu

   LOCAL oMenu

   MENU oMenu
      MENUITEM " ~File "
      MENU
         MENUITEM " ~Open..."          ACTION ALERT( "open" )
         MENUITEM " ~Resume"           ACTION ALERT( "open" )
         MENUITEM " O~S Shell"         ACTION ALERT( "OS Shell" )
         SEPARATOR
         MENUITEM " e~Xit Alt-X "      ACTION lExit := .T.
      ENDMENU

      MENUITEM " ~Locate "
      MENU
         MENUITEM " ~Find"             ACTION ALERT( "open" )
         MENUITEM " ~Next"             ACTION ALERT( "open" )
         MENUITEM " ~Previous"         ACTION ALERT( "open" )
         MENUITEM " ~Goto line..."     ACTION ALERT( "open" )
         SEPARATOR
         MENUITEM " ~Case sensitive "  IDENT "CASE" ;
                                       ACTION ALERT( "open" )
      ENDMENU

      MENUITEM " ~View "
      MENU
         MENUITEM " W~indows"          ACTION CorruptVid()
         MENUITEM " ~Sets"             ACTION ALERT( "open" )
         MENUITEM " ~WorkAreas   F6"   ACTION ALERT( "open" )
         MENUITEM " ~App Screen  F4 "  ACTION ALERT( "open" )
         SEPARATOR
         MENUITEM " ~CallStack" IDENT "CALLSTACK" ACTION ALERT( "open" )
      ENDMENU

   MENUITEM " ~Run "
   MENU
      MENUITEM " ~Animate" IDENT "ANIMATE" ACTION ALERT( "open" )
      MENUITEM " ~Step              F8" ACTION ALERT( "open" )
      MENUITEM " ~Trace            F10" ACTION ALERT( "open" )
      MENUITEM " ~Go                F5" ACTION ALERT( "open" )
      MENUITEM " to ~Cursor         F7" ACTION ALERT( "open" )
      MENUITEM " ~Next routine Ctrl-F5" ACTION ALERT( "open" )
      SEPARATOR
      MENUITEM " s~Peed..."             ACTION ALERT( "open" )
   ENDMENU

   MENUITEM " ~Point "
   MENU
      MENUITEM " ~Watchpoint..."        ACTION ALERT( "open" )
      MENUITEM " ~Tracepoint..."        ACTION ALERT( "open" )
      MENUITEM " ~Breakpoint F9 "       ACTION ALERT( "open" )
      MENUITEM " ~Delete..."            ACTION ALERT( "open" )
   ENDMENU

   MENUITEM " ~Monitor "
   MENU
      MENUITEM " ~Public"   IDENT "PUBLIC"  ACTION ALERT( "open" )

      MENUITEM " pri~Vate " IDENT "PRIVATE" ACTION ALERT( "open" )

      MENUITEM " ~Static"   IDENT "STATIC"  ACTION ALERT( "open" )

      MENUITEM " ~Local"    IDENT "LOCAL"   ACTION ALERT( "open" )

      MENUITEM " ~Global"   IDENT "GLOBAL"  ACTION ALERT( "open" )

         SEPARATOR

      MENUITEM " ~All"      IDENT "ALL"     ACTION ALERT( "open" )

      MENUITEM " S~how all Globals" IDENT "SHOWALLGLOBALS" ACTION ALERT( "open" )

      MENUITEM " s~Ort" ACTION Alert( "open" )
   ENDMENU

   MENUITEM " ~Options "
   MENU
      MENUITEM " ~Preprocessed Code" IDENT "PPO" ACTION ALERT( "open" )
      MENUITEM " ~Line Numbers" IDENT "LINE"     ACTION ALERT( "open" )
      MENUITEM " ~Exchange Screens"              ACTION ALERT( "open" )
      MENUITEM " swap on ~Input"                 ACTION ALERT( "open" )
      MENUITEM " code~Block Trace" IDENT "CODEBLOCK" ACTION ALERT( "open" )
      MENUITEM " ~Menu Bar"                      ACTION ALERT( "open" )
      MENUITEM " mono ~Display" IDENT "MONO"     ACTION ALERT( "open" )
      MENUITEM " ~Colors..."                     ACTION ALERT( "open" )
      MENUITEM " ~Tab Width..."                  ACTION ALERT( "open" )
      MENUITEM " path for ~Files..."             ACTION ALERT( "open" )
      MENUITEM " R~un at startup" IDENT "ALTD"   ACTION ALERT( "open" )

      SEPARATOR

      MENUITEM " ~Save Settings..."              ACTION ALERT( "open" )
      MENUITEM " ~Restore Settings... "          ACTION ALERT( "open" )
   ENDMENU

   MENUITEM " ~Window "
   MENU
      MENUITEM " ~Next Tab "            ACTION ALERT( "open" )
      MENUITEM " ~Prev Sh-Tab"          ACTION ALERT( "open" )
      MENUITEM " ~Move"                 ACTION ALERT( "open" )
      MENUITEM " ~Size"                 ACTION ALERT( "open" )
      MENUITEM " ~Zoom F2"              ACTION ALERT( "open" )
      MENUITEM " ~Iconize"              ACTION ALERT( "open" )
      SEPARATOR
      MENUITEM " ~Tile"                 ACTION ALERT( "open" )
   ENDMENU

   MENUITEM " ~Help "
   MENU
      MENUITEM " ~About Help "          ACTION ALERT( "open" )
      SEPARATOR
      MENUITEM " ~Keys"                 ACTION ALERT( "open" )
      MENUITEM " ~Windows"              ACTION ALERT( "open" )
      MENUITEM " ~Menus"                ACTION ALERT( "open" )
      MENUITEM " ~Commands"             ACTION ALERT( "open" )
   ENDMENU

   ENDMENU

RETURN oMenu

#define HB_CLS_NOTOBJECT                /* do not inherit from HBObject calss */
#include "hbclass.ch"

#include "hbmemvar.ch"

#include "box.ch"
#include "inkey.ch"
#include "setcurs.ch"

CREATE CLASS HBDbMenu
   METHOD aMenus SETGET

   VAR nTop
   VAR nLeft
   VAR nBottom
   VAR nRight
   VAR aItems
   VAR cClrHilite
   VAR cClrHotKey
   VAR cClrHotFocus
   VAR cClrPopup
   VAR nOpenPopup                       // zero if no popup is shown
   VAR lPopup
   VAR cBackImage

   METHOD New()
   METHOD AddItem( oMenuItem )
   METHOD Build()
   METHOD ClosePopup( nPopup )
   METHOD CLOSE() INLINE ::ClosePopup( ::nOpenPopup ), ::nOpenPopup := 0
   METHOD DeHilite()
   METHOD DISPLAY()
   METHOD EvalAction()
   METHOD GetHotKeyPos( cKey )
   METHOD GetItemByIdent( uIdent )
   METHOD GetItemOrdByCoors( nRow, nCol )
   METHOD GoBottom()
   METHOD GoDown() INLINE ::aItems[ ::nOpenPopup ]:bAction:GoRight()
   METHOD GoLeft()
   METHOD GoRight()
   METHOD GoTop()
   METHOD GoUp() INLINE ::aItems[ ::nOpenPopup ]:bAction:GoLeft()
   METHOD IsOpen() INLINE ::nOpenPopup != 0
   METHOD LoadColors()                  // Load current debugger colors settings
   METHOD ProcessKey( nKey )
   METHOD Refresh()                     // Repaints the top bar
   METHOD ShowPopup( nPopup )

ENDCLASS

METHOD aMenus( xNewVal ) CLASS HBDbMenu

   STATIC t_aMenus

   IF PCount() > 0
      t_aMenus := xNewVal
   ENDIF

RETURN t_aMenus

METHOD New() CLASS HBDbMenu
   IF ::aMenus == NIL
      ::aMenus := {}
      ::lPopup := .F.
   ELSE
      ::lPopup := .T.
   ENDIF

   ::nTop       := 0
   ::nLeft      := 0
   ::nBottom    := 0
   ::nRight     := 0
   ::aItems     := {}
   ::LoadColors()
   ::nOpenPopup := 0

   AAdd( ::aMenus, Self )

RETURN Self

METHOD AddItem( oMenuItem ) CLASS HBDbMenu

   LOCAL oLastMenu := ATail( ::aMenus )
   LOCAL oLastMenuItem

   IF oLastMenu:lPopup
      oMenuItem:nRow := Len( oLastMenu:aItems )
      oMenuItem:nCol := oLastMenu:nLeft + 1
   ELSE
      oMenuItem:nRow := 0
      IF Len( oLastMenu:aItems ) > 0
         oLastMenuItem := ATail( oLastMenu:aItems )
         oMenuItem:nCol := oLastMenuItem:nCol + ;
            Len( StrTran( oLastMenuItem:cPrompt, "~" ) )
      ELSE
         oMenuItem:nCol := 0
      ENDIF
   ENDIF

   AAdd( ATail( ::aMenus ):aItems, oMenuItem )

RETURN oMenuItem

METHOD Build() CLASS HBDbMenu

   LOCAL nPos := 0
   LOCAL oMenuItem, n

   IF Len( ::aMenus ) == 1              // pulldown menu
      FOR EACH oMenuItem IN ::aItems
         oMenuItem:nRow := 0
         oMenuItem:nCol := nPos
         nPos += Len( StrTran( oMenuItem:cPrompt, "~" ) )
      NEXT
   ELSE
      oMenuItem := ATail( ::aMenus[ Len( ::aMenus ) - 1 ]:aItems )
      ::nTop    := oMenuItem:nRow + 1
      ::nLeft   := oMenuItem:nCol
      nPos      := ::nLeft
      FOR N = 1 to Len( ::aItems )
         ::aItems[ n ]:nRow := ::nTop + n
         ::aItems[ n ]:nCol := ::nLeft + 1
         nPos := Max( nPos, ::nLeft + Len( StrTran( ::aItems[ n ]:cPrompt, "~" ) ) + 1 )
      NEXT
      ::nRight  := nPos + 1
      ::nBottom := ::nTop + Len( ::aItems ) + 1
      FOR EACH oMenuItem IN ::aItems
         IF ! hb_LeftEq( oMenuItem:cPrompt, "-" )
            oMenuItem:cPrompt := " " + PadR( oMenuItem:cPrompt, ::nRight - ::nLeft - 1 )
         ENDIF
      NEXT
      ATail( ::aMenus[ Len( ::aMenus ) - 1 ]:aItems ):bAction := ATail( ::aMenus )
      ::aMenus := ASize( ::aMenus, Len( ::aMenus ) - 1 )
   ENDIF
RETURN nil

METHOD ClosePopup( nPopup ) CLASS HBDbMenu

   LOCAL oPopup

   IF nPopup != 0
      oPopup := ::aItems[ nPopup ]:bAction
      IF HB_ISOBJECT( oPopup )
         RestScreen( oPopup:nTop, oPopup:nLeft, ;
                     oPopup:nBottom + 1, oPopup:nRight + 2, ;
                     oPopup:cBackImage )
         oPopup:cBackImage := NIL
      ENDIF
      ::aItems[ nPopup ]:Display( ::cClrPopup, ::cClrHotKey )
   ENDIF

RETURN nil

METHOD DeHilite() CLASS HBDbMenu

   LOCAL oMenuItem := ::aItems[ ::nOpenPopup ]

   oMenuItem:Display( ::cClrPopup, ::cClrHotKey )
RETURN nil

METHOD Display() CLASS HBDbMenu

   LOCAL oMenuItem

   IF ::lPopup
      ::cBackImage := SaveScreen( ::nTop, ::nLeft, ::nBottom + 1, ::nRight + 2 )
      DispBox( ::nTop, ::nLeft, ::nBottom, ::nRight, HB_B_SINGLE_UNI, ::cClrPopup )
      hb_Shadow( ::nTop, ::nLeft, ::nBottom, ::nRight )
   ELSE
      hb_Scroll( 0, 0, 0, MaxCol(),,, ::cClrPopup )
   ENDIF

   FOR EACH oMenuItem IN ::aItems
      IF oMenuItem:cPrompt == "-" // Separator
         @ oMenuItem:nRow, ::nLeft + 1 SAY ;
           Replicate( "-", ::nRight - ::nLeft - 1 ) COLOR ::cClrPopup
      ELSE
         oMenuItem:Display( ::cClrPopup, ::cClrHotKey )
      ENDIF
   NEXT
RETURN nil

METHOD EvalAction() CLASS HBDbMenu

   LOCAL oPopup := ::aItems[ ::nOpenPopup ]:bAction
   LOCAL oMenuItem := oPopup:aItems[ oPopup:nOpenPopup ]

   IF oMenuItem:bAction != NIL
      ::Close()
      Eval( oMenuItem:bAction, oMenuItem )
   ENDIF

RETURN nil

METHOD GetHotKeyPos( cKey ) CLASS HBDbMenu

   LOCAL oMenuItem

   FOR EACH oMenuItem IN ::aItems
      IF Upper( SubStr( oMenuItem:cPrompt, ;
         At( "~", oMenuItem:cPrompt ) + 1, 1 ) ) == cKey
         RETURN oMenuItem:__enumIndex()
      ENDIF
   NEXT
RETURN 0

METHOD GetItemOrdByCoors( nRow, nCol ) CLASS HBDbMenu
   LOCAL oMenuItem

   FOR EACH oMenuItem IN ::aItems
      IF oMenuItem:nRow == nRow .AND. nCol >= oMenuItem:nCol .AND. ;
         nCol <= oMenuItem:nCol + Len( oMenuItem:cPrompt ) - 2
         RETURN oMenuItem:__enumIndex()
      ENDIF
   NEXT

RETURN 0

METHOD GetItemByIdent( uIdent ) CLASS HBDbMenu
   LOCAL oMenuItem
   LOCAL oItem

   FOR EACH oMenuItem IN ::aItems
      IF HB_ISOBJECT( oMenuItem:bAction )
         IF ( oItem := oMenuItem:bAction:GetItemByIdent( uIdent ) ) != NIL
            RETURN oItem
         ENDIF
      ELSEIF ValType( oMenuItem:Ident ) == ValType( uIdent ) .AND. ;
         oMenuItem:Ident == uIdent
         RETURN oMenuItem
      ENDIF
   NEXT

RETURN NIL

METHOD GoBottom() CLASS HBDbMenu

   LOCAL oPopup

   IF ::IsOpen()
      oPopup := ::aItems[ ::nOpenPopup ]:bAction
      oPopup:DeHilite()
      oPopup:ShowPopup( Len( oPopup:aItems ) )
   ENDIF

RETURN nil

METHOD GoLeft() CLASS HBDbMenu

   LOCAL oMenuItem := ::aItems[ ::nOpenPopup ]

   IF ::nOpenPopup != 0
      IF ::lPopup
         oMenuItem:Display( ::cClrPopup, ::CClrHotKey )
      ELSE
         ::ClosePopup( ::nOpenPopup )
      ENDIF
      IF ::nOpenPopup > 1
         --::nOpenPopup
         DO WHILE ::nOpenPopup > 1 .AND. ;
            hb_LeftEq( ::aItems[ ::nOpenPopup ]:cPrompt, "-" )
            --::nOpenPopup
         ENDDO
         ::ShowPopup( ::nOpenPopup )
      ELSE
         ::ShowPopup( ::nOpenPopup := Len( ::aItems ) )
      ENDIF
   ENDIF
RETURN nil

METHOD GoRight() CLASS HBDbMenu

   LOCAL oMenuItem := ::aItems[ ::nOpenPopup ]

   IF ::nOpenPopup != 0
      IF ::lPopup
         oMenuItem:Display( ::cClrPopup, ::cClrHotKey )
      ELSE
         ::ClosePopup( ::nOpenPopup )
      ENDIF
      IF ::nOpenPopup < Len( ::aItems )
         ++::nOpenPopup
         DO WHILE ::nOpenPopup < Len( ::aItems ) .AND. ;
         hb_LeftEq( ::aItems[ ::nOpenPopup ]:cPrompt, "-" )
         ++::nOpenPopup
         ENDDO
         ::ShowPopup( ::nOpenPopup )
      ELSE
         ::ShowPopup( ::nOpenPopup := 1 )
      ENDIF
   ENDIF
RETURN nil

METHOD GoTop() CLASS HBDbMenu

   LOCAL oPopup

   IF ::IsOpen()
      oPopup := ::aItems[ ::nOpenPopup ]:bAction
      oPopup:DeHilite()
      oPopup:ShowPopup( 1 )
   ENDIF

RETURN nil

METHOD LoadColors() CLASS HBDbMenu

   LOCAL aColors := { "W+/B", "BG+/R", "GR+/B", "GR+/R", "N+/BG", "GR+/B", ;
                      "BR+/B", "W+/B", "GR+/B", "BG+/N", "BG+/N" }
   LOCAL oMenuItem

   ::cClrPopup := aColors[ 8 ]
   ::cClrHotKey := aColors[ 9 ]
   ::cClrHilite := aColors[ 10 ]
   ::cClrHotFocus := aColors[ 11 ]

   FOR EACH oMenuItem IN ::aItems
      IF HB_ISOBJECT( oMenuItem:bAction )
       oMenuItem:bAction:LoadColors()
      ENDIF
   NEXT

RETURN nil

METHOD Refresh() CLASS HBDbMenu

   LOCAL oMenuItem

   DispBegin()

   IF ! ::lPopup
      hb_Scroll( 0, 0, 0, MaxCol(),,, ::cClrPopup )
   ENDIF

   FOR EACH oMenuItem IN ::aItems
      oMenuItem:Display( ::cClrPopup, ::cClrHotKey )
   NEXT

   DispEnd()

RETURN nil

METHOD ShowPopup( nPopup, nMenuItem ) CLASS HBDbMenu
   ::aItems[ nPopup ]:Display( ::cClrHilite, ::cClrHotFocus )
   ::nOpenPopup := nPopup

   IF HB_ISOBJECT( ::aItems[ nPopup ]:bAction )
      ::aItems[ nPopup ]:bAction:Display()
      ::aItems[ nPopup ]:bAction:ShowPopup( If( nMenuItem == nil, 1, nMenuItem ) )
   ENDIF
RETURN nil

METHOD ProcessKey( nKey ) CLASS HBDbMenu

   LOCAL nPopup
   LOCAL oPopup

   DO CASE
      CASE nKey == K_LBUTTONDOWN
         IF MRow() == 0
            IF ( nPopup := ::GetItemOrdByCoors( 0, MCol() ) ) != 0
               IF nPopup != ::nOpenPopup
                  ::ClosePopup( ::nOpenPopup )
                  ::ShowPopup( nPopup )
               ENDIF
            ENDIF
         ELSE
            oPopup := ::aItems[ ::nOpenPopup ]:bAction
            IF ( nPopup := oPopup:GetItemOrdByCoors( MRow(), MCol() ) ) == 0
               ::Close()
            ELSE
               oPopup:DeHilite()
               oPopup:nOpenPopup := nPopup
               oPopup:aItems[ nPopup ]:Display( ::cClrHilite, ::cClrHotFocus )
               ::EvalAction()
            ENDIF
         ENDIF

      CASE nKey == K_ESC
         ::Close()

      CASE nKey == K_LEFT
         ::GoLeft()

      CASE nKey == K_RIGHT
         ::GoRight()

      CASE nKey == K_DOWN
         ::GoDown()

      CASE nKey == K_UP
         ::GoUp()

      CASE nKey == K_ENTER
         ::EvalAction()

      CASE nKey == K_HOME
         ::GoTop()

      CASE nKey == K_END
         ::GoBottom()

      OTHERWISE

         IF ::nOpenPopup > 0
            IF IsAlpha( hb_keyChar( nKey ) )
               oPopup := ::aItems[ ::nOpenPopup ]:bAction
               IF ( nPopup := oPopup:GetHotKeyPos( Upper( Chr( nKey ) ) ) ) > 0
                  IF oPopup:nOpenPopup != nPopup
                     oPopup:DeHilite()
                     oPopup:ShowPopup( nPopup )
                  ENDIF
                  ::EvalAction()
               ENDIF
            ENDIF
         ELSEIF ( nPopup := ::GetHotKeyPos( __dbgAltToKey( nKey ) ) ) != ::nOpenPopup
            ::Close()
            ::ShowPopup( nPopup )
         ENDIF

   ENDCASE

RETURN nil

FUNCTION __dbgAltToKey( nKey )

   LOCAL nIndex := AScan( { ;
                  K_ALT_A, K_ALT_B, K_ALT_C, K_ALT_D, K_ALT_E, K_ALT_F, ;
                  K_ALT_G, K_ALT_H, K_ALT_I, K_ALT_J, K_ALT_K, K_ALT_L, ;
                  K_ALT_M, K_ALT_N, K_ALT_O, K_ALT_P, K_ALT_Q, K_ALT_R, ;
                  K_ALT_S, K_ALT_T, K_ALT_U, K_ALT_V, K_ALT_W, K_ALT_X, ;
                  K_ALT_Y, K_ALT_Z, K_ALT_1, K_ALT_2, K_ALT_3, K_ALT_4, ;
                  K_ALT_5, K_ALT_6, K_ALT_7, K_ALT_8, K_ALT_9, K_ALT_0 }, nKey )

RETURN iif( nIndex > 0, SubStr( "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", nIndex, 1 ), "" )

function HB_LEFTEQ( c1, c2 ) ; return Left( c1, Len( c2 ) ) == c2
// function HB_DISPOUTATBOX() ; return nil
function HB_UTF8TOSTRBOX() ; return nil
// function HB_KEYCHAR() ; return nil


STATIC FUNCTION CorruptVid()
   LOCAL nWindow1, nWindow2, nWindow3, cCommand := "NOTEPAD.EXE VIDFAULT.PRG"

   nWindow1 := WOPEN(07,15,12,43)
   SETCOLOR("GR+/BR,BG+/N,,BG+/N,N/W")
   WBOX()
   @ -1,1 SAY " Window 1 "
   INKEY(0)

   nWindow2 := WOPEN(02,00,24,79)
   SETCOLOR( "W+/B*,BG+/N,,BG+/N,N/W" )
   WBOX()
   @ -1,1 SAY " Window 2 "
   INKEY(0)

   nWindow3 := WOPEN( 01,00,MAXCOL(),MAXCOL() )
   SETCOLOR( "W+/G,BG+/N,,BG+/N,N/W,W+/B,W+/G+,W+/R" )
   WBOX()
   @ -1,1 SAY " Window 3 "
   INKEY(0)

   RUN ( cCommand )

   WCLOSE( nWindow3 )
   INKEY(0)

   WCLOSE( nWindow2 )
   INKEY(0)

   WCLOSE( nWindow1 )
   INKEY(0)

   WSELECT( 0 )
RETURN (.T.)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: To Antonio: video corruption
Posted: Fri May 22, 2015 07:40 AM

Gustavo,

It seems as a Harbour bug, and it should be reported to the Harbour developers list.

As a workaround you could use SaveScreen() and RestScreen() to save the initial screen and then restore it.

What information are you going to show on those windows ? If it is not complex, then you could easily implement
a new Class window yourself.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Re: To Antonio: video corruption
Posted: Fri May 22, 2015 04:11 PM

Antonio:

Thank you for your help & support. Please point me in the direction to report the bug. I tried with SAVESCREEN() & RESTSCREEN() with VERY LIMITED success. The issue is that the previous window contents do not disappear until all windows are closed. Regarding on making a new class, if you can show me how, it will be appreciated. Bear in mind that the source code is full of WOPEN(), WCLOSE() AND WSELECT(). Thank you very much my friend.

Continue the discussion