TOutlook bug/ TGet bChange bug / Suggestions to .ch files

TOutlook bug/ TGet bChange bug / Suggestions to .ch files

Postby Maurilio Viana » Tue Mar 07, 2006 10:16 pm

Antonio,
I upgrade to FWH 2.7 to use with xHB comercial due to the _hbstack bug and
I found any fixed bugs from 2.6 that came back.
I'll be glad if you can review this issues:

AnsiUpper() function:
In any cases AnsiUpper generate a GPF (I tested under XP) and our app
crash (but in any way stay running because the exe can't be erased), we
must restart computer...
---------------------------------------
TOutLook.prg:
Bug:
The first time we click in button your action isn't fired. We must
click button a second time.

Possible solution:
In method ADDITEM comment the lines:
oBmp:bMMoved := ...
oBmp:blButtonUp := ...
----------------------------
On change (TGET class) bug:

bChange don't consider last character typed in oGet object. In other words
the buffer is updated with one character of "delay"
Working sample:

Code: Select all  Expand view  RUN
#include "FiveWin.ch"
function Main()
   local oDlg
   local cVar := space(40)
   local oGet

   DEFINE DIALOG oDlg TITLE "Just a get"

   @ 2,  2 SAY "Text:" OF oDlg
   @ 2,  6 GET oGet VAR cVar OF oDlg

   oGet[2]:bChange := {|| oGet:Assign(), oDlg:SetText(oGet:cText) }

   @ 3,  7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 3, 16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL

   ACTIVATE DIALOG oDlg CENTERED

return nil


Possible solution (thanks to Rossine):

Code: Select all  Expand view  RUN
METHOD KeyChar( nKey, nFlags ) CLASS TGet
This code is placed on wrong place:

if ::bChange != nil
    lAccept = Eval( ::bChange, nKey, nFlags, Self )
    if ValType( lAccept ) == "L" .and. ! lAccept
       return 0
    endif
endif

The correct place if before otherwise clause at end of method

METHOD KeyChar( nKey, nFlags ) CLASS TGet
(...)
           if ::oGet:TypeOut
              if ! Set( _SET_CONFIRM )
                 ::oWnd:nLastKey = VK_RETURN
                 ::oWnd:GoNextCtrl( ::hWnd )
              else
                 if Set( _SET_BELL )
                    MsgBeep()
                 endif   
              endif
           endif
           // Rossine
           if ::bChange != nil
              lAccept = Eval( ::bChange, nKey, nFlags, Self )
              if ValType( lAccept ) == "L" .and. ! lAccept
                 return 0
              endif
           endif
           // Rossine
           Eval( ::bPostKey, Self, ::oGet:Buffer )
      otherwise
           return Super:KeyChar( nKey, nFlags )
   endcase

return 0


---------------------------------

Suggestion:
We have any problems to create/activate dialogs with valid/init into classes
because in .ch files the name Self is used. See this sample

METHOD MyMethod CLASS MyClass

define dialog ::oDlg ...

activate dialog ::oDlg nomodal valid ::MyValid()
(...)

The activate code will conflict with Self name, see the PPO:
::oDlg:Activate(::oDlg:bLClicked,::oDlg:bMoved,::oDlg:bPainted,.T.,,! .T. ,{|Self|::MyValid()},::oDlg:bRClicked,,)

"valid ::MyValid()" turn into "{|Self|::MyValid()}"

We suggest change Self to This into .ch files
--------------------------------------------------------------------
A little suggestion to .ch too: Include clause PICT like Clipper:

[ <pict:PICT,PICTURE> <cPicture> ]

-------------------------------------------------------------------
Another suggest to .ch: DEFAULT command:

#xcommand DEFAULT <uVar1> := <uVal1> ;
[, <uVarN> := <uValN> ] => ;
if( <uVar1> == nil, <uVar1> := <uVal1>, ) ;;
[ if( <uVarN> == nil, <uVarN> := <uValN>, ); ]

This translated declararion:
DEFAULT x := 1

if(x == nil, x == 1, )

Appears to be more efficient that:

x := if(x == nil, x == 1, x)

Because assign a value to variable only when value is nil
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Return to Bugs report & fixes / Informe de errores y arreglos

Who is online

Users browsing this forum: No registered users and 15 guests