Bugs: TGet bchange /Outlook/ suggestion to .ch

Post Reply
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Bugs: TGet bchange /Outlook/ suggestion to .ch

Post by Maurilio Viana »

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:
#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:
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
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Maurilio,

We have not modified AnsiUpper() at all. It just makes a call to Win32 AnsiUpper() function. Its a one line source code function.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Maurilio,

We have just tested samples\TestOutL.prg and it works ok. Could you please test it ? Are you using some classes with modifications of your own ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Maurilio,

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

Fixed. Thanks! :)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Maurilio,

> We suggest change Self to This into .ch files

Its a good suggestion, but we can't implement it or we will break many users source code.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Maurilio,

>
A little suggestion to .ch too: Include clause PICT like Clipper:

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

Implemented, thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Maurilio,

> Another suggest to .ch: DEFAULT command:

Excellent suggestion. Implemented. Many thanks! :)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Post by Maurilio Viana »

Antonio Linares wrote: We have just tested samples\TestOutL.prg and it works ok. Could you please test it ? Are you using some classes with modifications of your own ?
No, I´m using original class. The problem occur when we click any button by first time. In 1st time, the action isn´t launched. Any times it work other times no :-(
We comment these lines and it worked. I´ll try with a self contained sample...

About AnsiUpper( ) I can´t figura what occur. I call ansiupper( ) and my program exit without error messages. I search in my source code if i redefined it in any place but it is ok...
Any news I post here...

Many thanks to accept my suggestions :-)

Best regards,
Maurilio
Post Reply