Page 1 of 1

Fwh 8.08 - Corrections in classes

PostPosted: Tue Oct 21, 2008 12:30 pm
by ORibeiro
Corrections in class:

Fwh 8.08:

Class: SAY.PRG = Removes line 266 because it makes the text to disrespect the limit of the field defined in the resource
// ::nWidth := GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) )

Class: WINDOW.PRG = Removes the line 2434 of the KeyChar method () because it makes with that keyboard key ESC in the systems using windows MDI take off the focus of the MsgYesNo ()
// ::oWnd:KeyChar( nKey, nFlags )

Thank´s

Oscar Ribeiro

PostPosted: Mon Oct 27, 2008 11:42 am
by Antonio Linares
Oscar,

>
Class: SAY.PRG = Removes line 266 because it makes the text to disrespect the limit of the field defined in the resource
// ::nWidth := GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) )
>

This has been improved in FWH 8.09 and 8.10

>
Class: WINDOW.PRG = Removes the line 2434 of the KeyChar method () because it makes with that keyboard key ESC in the systems using windows MDI take off the focus of the MsgYesNo ()
// ::oWnd:KeyChar( nKey, nFlags )
>

Could you provide a small example to test it ? Do you mean to press ESC on a MsgYesNo() shown on top of a MDI frame or a MDI child ? thanks,

PostPosted: Fri Oct 31, 2008 1:37 pm
by ORibeiro
Hi Antonio,

It is a pleasure to contact you.

The problem happens with MDI Child. In my application, when I pressure ESC to close the Child Window the MsgYesNo(“Desires to leave?”) he is disoriented and not insurance the focus in it.

I tried to reproduce in a small example but I did not obtain.

All new version is necessary to disactivate this line that I mentioned in the Window.prg to correct this problem.


I wait to have helped.

Thanks a lot.

Oscar Ribeiro

PostPosted: Fri Oct 31, 2008 5:51 pm
by Antonio Linares
Oscar,

Do you call MsgYesNo() from the VALID of the MDI child window ?

PostPosted: Mon Nov 03, 2008 1:07 pm
by ORibeiro
Antonio,

This is my VALID.

Code: Select all  Expand view

   ACTIVATE DIALOG oDlgP NOWAIT VALID oWndC:End()
   ACTIVATE WINDOW oWndC ;
            ON PAINT FnSelect(cDbf[01]);
            VALID (SysWait(0.1),tBtPrinc[09]:SetFocus(),iif(Atualizou(oDlgP),(Grava(.T.)),.T.),oScb:SetFocus(),Destroi_Campos(),;
                   Fecha_Arquivo(cDbf[1]),Fecha_Formulario(oWndC,oDlgP,,cFrm,cPrg) )


********************************************************************************************
FUNCTION Atualizou(oDlg,lGravou)
********************************************************************************************
* Verifica se houve alteracoes na get sem serem salvas *
Local f:=1
local g:=1
local h:=1
local Contador:=0
local a,b
   lGravou := iif(lGravou=nil,.F.,lGravou) // Verifica se houve a gravacao
   While f<=Len(oDlg:aControls) //acontrols é uma propriedade de todas as dialogs e é criada automaticamente
      if     oDlg:aControls[f]:ClassName()="TGET" .or. oDlg:aControls[f]:ClassName()="TMULTIGET"
         a := oDlg:aControls[f]:cCaption  // Gets Antes
         b := oDlg:aControls[f]:cText     // Gets Depois
         if a<>b
            oDlg:aControls[f]:cCaption:=b // Atualiza cCaption
            if !lGravou // Se nao gravou
               Contador++
            endif
         endif
      elseif oDlg:aControls[f]:ClassName()="TFOLDER"
         g := 1
         While g<=Len(oDlg:aControls[f]:aDialogs) // Checa todos os Dialogs da Folder
            h := 1
            While h<=Len(oDlg:aControls[f]:aDialogs[g]:aControls)
               if oDlg:aControls[f]:aDialogs[g]:aControls[h]:ClassName()="TGET" .or. oDlg:aControls[f]:aDialogs[g]:aControls[h]:ClassName()="TMULTIGET"
                  a := oDlg:aControls[f]:aDialogs[g]:aControls[h]:cCaption  // Gets Antes
                  b := oDlg:aControls[f]:aDialogs[g]:aControls[h]:cText     // Gets Depois
                  if a<>b
                     oDlg:aControls[f]:aDialogs[g]:aControls[h]:cCaption:=b // Atualiza cCaption
                     if !lGravou // Se nao gravou
                        Contador++
                     endif
                  endif
               endif
               h++
            enddo
            g++
         end
      endif
      f++
   End
   if !lGravou .and. !Empty(Contador)
      Return(.T.)
   Endif
Return(.F.)

********************************************************************************************
Static function Grava(lConf)
********************************************************************************************
   If lConf
      if !MsgYesNo("Confirma a gravação?","Confirme")
         Return(.F.)
      endif
   Endif
   // VÁLIDO //
   if !Valido()
      Return(.F.)
   endif
   Select (cDBF[01])
   // Se alterou o Nome, modifica arquivos relacionados //
   if cNovo<>"NOVO" .and. Field->Nome<>CFNome[2]
      FnAltNome( "FOR", cPrg, CFNome[2], Field->Nome )
   endif
   Select(cDbf[01])
   FnReplace(,,,cPrg,cDbf[1],cNovo,.T.)
   cNovo := "CONSULTA"
   Atualiza_Campos()
   CFAbrev[1]:Setfocus()
   CFNr_Fo[1]:SetFocus()
Return(.T.)



Thank you.

PostPosted: Wed Nov 05, 2008 5:09 pm
by ORibeiro
Dear Antonio,
Does you read my example?
Thanks

PostPosted: Sun Nov 09, 2008 7:18 pm
by miragerr
Comigo isso tambem acontece

Uma coisa que percebi é que se EU comento esta linha na Window.prg funciona normal

ORIGINAL
Code: Select all  Expand view

   METHOD EndPaint() INLINE ::nPaintCount--,;
                     EndPaint( ::hWnd, ::cPS ), ::cPS := nil, ::hDC := nil , 0 // keep this zero here!



MODIFICADO
Code: Select all  Expand view

   METHOD EndPaint() INLINE ::nPaintCount--,;
                     EndPaint( ::hWnd, ::cPS ), ::cPS := nil, ::hDC := nil // , 0  // keep this zero here! ///// ---->>> comento o ZERO



Desta forma funciona normal, quando tenho VALID nas dialogs

Fico no aguardo

It´s possible to solve

PostPosted: Fri Nov 28, 2008 7:08 pm
by ORibeiro
Antonio,
It´s possible to solve in next version?
Thanks
Oscar

PostPosted: Fri Nov 28, 2008 8:24 pm
by Antonio Linares
Oscar,

We need a small and self contained example to test here.

Please provide us an example that reproduces what you describe, thanks

PostPosted: Fri Nov 28, 2008 8:26 pm
by Antonio Linares
Jackson,

You should not remove that zero. Its important to keep it here.

Please provide a small and self contained example to reproduce the problem with a dialog, thanks