problemas con el foco en mdichild

problemas con el foco en mdichild

Postby mastintin » Thu Sep 05, 2013 3:18 pm

He resuelto un problema que me traia loco desde hace unas cuantas versiones de fivewin , el tema era que en una ventana MDIChild que contenia un Xbrowse , se usaba un dialogo para introducir datos en el xbrowse , cunado cerrabamos ese dialogo al volver el foco a la ventana mdichild ( foco en el xbrowse ) , se producía un parpadeo por "varios cambios de foco" ( xbrowse-ventana-xbrowse ) ¿ ? , el caso es que en ese momento se perdian plusaciones de teclas al no tener el foco el xbrowse . Des pues de mucho investigar con versiones anteriores que no tenian ese probelma he aislado el código cambiado :

Code: Select all  Expand view


METHOD GetDlgCode( nLastKey ) CLASS TGet
 .....    
return  nil       //  DLGC_WANTALLKEYS  -> con este cambio funciona perfectamente .

 


Aqui queda por si alguien tiene el mismo problema .

Código que reproduce el problema . para ello ir al menu mdi -> en el xbrowse ->intro -> en el dlg que sale intro . Observar el parpadeo de la ventana mdiChild.
Code: Select all  Expand view

// Working with MDI enviroments

#include "FiveWin.ch"
#include "xbrowse.ch"


REQUEST DBFCDX

static oWnd

//----------------------------------------------------------------------------//

function Main()

   local oWndEdit, oBar, oIcon, oImage
   local cName := "FiveWin power"

   USE Clientes NEW SHARED VIA "DBFCDX"
 
   DEFINE ICON oIcon RESOURCE "test"

   DEFINE WINDOW oWnd FROM 1, 1 TO 20, 70 TITLE "I am the MDI Frame" ;
      MDI ;
     ICON oIcon


   SET MESSAGE OF oWnd TO "Main Window"

   DEFINE BUTTONBAR oBar 2007 OF ownd

    DEFINE BUTTON OF oBar GROUP ;
    PROMPT  "mdi" TOOLTIP "lanzar mdichild"  ;
    ACTION CreaMdiChild()
   
   DEFINE BUTTON OF oBar GROUP ;
    PROMPT  "info" TOOLTIP "lanzar msginfo"  ;
    ACTION Msginfo("hola")
   

   ACTIVATE WINDOW oWnd MAXIMIZED ;
      VALID MsgYesNo( "Want to End ?" )

return nil

//----------------------------------------------------------------------------//

Function CreaMdiChild()
   local oChild, oBrw

   DEFINE WINDOW oChild TITLE "Basic Cell selector browse" MDICHILD OF oWnd

    DEFINE BUTTONBAR oBar 2007 OF oChild

   @ 0,0 XBROWSE oBrw OF oChild ALIAS Alias() AUTOCOLS

  obrw:bKeyDown  :=  { | nKey |dlgmas() }
   oBrw:CreateFromCode()
   oBrw:cToolTip = "This is a test"
   oChild:oClient := oBrw
   oBrw:SetFocus()

RETURN NIL

function dlgmas()

   local oDlg, oBtn1, oBtn2, oGet1, cGet1 := 0
   local oFontDlg
   local oBrush

   DEFINE BRUSH oBrush COLOR RGB( 240, 240, 240 )

    DEFINE FONT oFontDlg  NAME 'Ms Sans Serif'  SIZE 0,-12

   DEFINE DIALOG oDlg TITLE "Dialog designer" ;
      FROM 354, 382 TO 540, 709  PIXEL FONT oFontDlg  ;
      BRUSH oBrush

   @ 60, 32 BUTTON oBtn1 PROMPT "&Ok" ;
      SIZE 40, 12 PIXEL OF oDlg ;
      ACTION MsgInfo( "Not defined yet!" )

   @ 60, 88 BUTTON oBtn2 PROMPT "&Cancel" ;
      SIZE 40, 12 PIXEL OF oDlg ;
      ACTION MsgInfo( "Not defined yet!" )

   @ 24, 28 GET oGet1 VAR cGet1 SIZE 68, 12 PIXEL OF oDlg PICTURE "99" ;
     VALID ( if (cGet1 == 0 , oDlg:End(),) )
     
   ACTIVATE DIALOG oDlg ON INIT oget1:setfocus()


Return nil

 
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 8 guests