FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse Drag Error when Kinetic scrolling is enabled
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
xBrowse Drag Error when Kinetic scrolling is enabled
Posted: Fri Oct 30, 2009 10:27 AM
I am using FWH 9.08

I have done what Mr.Antonio has suggested to make Kinetic scroll optional, available in this thread viewtopic.php?f=3&t=16905&p=87669#p87669

When I enable oBrw:=.T. an error occurs only when I try to drag a row upwards, but if I drag the row downward it is working fine

Am I doing anything wrong ?

Here is my the error log

    Application
    ===========
    Path and name: D:\Apps\WinAcs\WinAcs.Exe (32 bits)
    Size: 2,712,576 bytes
    Time from start: 0 hours 0 mins 18 secs
    Error occurred at: 30/10/2009, 15:18:36
    Error description: Error DBCMD/2001 Workarea not in use: DBSKIP
    Args:

    Stack Calls
    ===========
    Called from: => DBSKIP(0)
    Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:MOUSEMOVE(3199)
    Called from: => TWINDOW:HANDLEEVENT(0)
    Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1453)
    Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT(9921)
    Called from: .\source\classes\WINDOW.PRG => _FWH(3333)
    Called from: => DIALOGBOXINDIRECT(0)
    Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
    Called from: User.Prg => USERRIGHTS(703)
    Called from: WinAcs.Prg => (b)BUILDMENU(635)
    Called from: .\source\classes\MENU.PRG => TMENU:COMMAND(437)
    Called from: .\source\classes\WINDOW.PRG => TWINDOW:COMMAND(1003)
    Called from: .\source\classes\MDIFRAME.PRG => TMDIFRAME:COMMAND(243)
    Called from: => TMDIFRAME:HANDLEEVENT(0)
    Called from: .\source\classes\WINDOW.PRG => _FWH(3333)
    Called from: => WINRUN(0)
    Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE(952)
    Called from: WinAcs.Prg => MAIN(63)[/list:u]

    Here is the code used to Define xBrowse
    Code (fw): Select all Collapse
    aMenuOptions:={ {"Add"                     ,.T.},;
                    {"Edit"                    ,.T.},;
                    {"Delete"                  ,.F.},;
                    {"Print"                   ,.T.},;
                    {"Show Data on Grid/Browse",.T.},;
                    {"Export Data to Excel"    ,.F. } }
    
    @ 0,420 XBROWSE oBrwMenuOptions ;
        COLUMNS 1, 2 ;
        HEADERS "Functionalities", "Status" ;
        OF oDlg ;
        ARRAY aMenuOptions 
    
    oBrwMenuOptions:nMarqueeStyle:=MARQSTYLE_HIGHLROWRC
    oBrwMenuOptions:aCols[1]:nWidth:=195
    oBrwMenuOptions:aCols[2]:nWidth:=50
    oBrwMenuOptions:nRowHeight:=20   //17
    oBrwMenuOptions:bClrStd := { || oApp:aClrCol[ oBrwMenuOptions:KeyNo % 2 + 1 ] }
    
    // Alternative way to display BMP, if multiple conditions and more than 2 bitmaps are there
    oBrwMenuOptions:aCols[2]:AddResource("CheckOn")
    oBrwMenuOptions:aCols[2]:AddResource("CheckOff")
    oBrwMenuOptions:aCols[2]:bBmpData :={ || iif(oBrwMenuOptions:aArrayData[oBrwMenuOptions:nArrayAt][2],1,2)}
    oBrwMenuOptions:aCols[2]:bStrData:={ || NIL }  // Avoid showing .T. .F. in the column
    
    // Change Tick Off/On when Clicked and ensure that this happens only in Column 2
    oBrwMenuOptions:bLClicked := { | nRow, nCol | iif(oBrwMenuOptions:nColSel == 2, oBrwMenuOptions:aArrayData[oBrwMenuOptions:nArrayAt][2]:=!oBrwMenuOptions:aArrayData[oBrwMenuOptions:nArrayAt][2] ,NIL),oBrwMenuOptions:Refresh() }
    
    // Enable user to either use Enterkey or Spacebar to change the value in Checkbox
    oBrwMenuOptions:bKeyDown= {|nKey| ( oBrwMenuOptions:nColSel:=2 ,;  // else ie Menu items
        if ( nKey  == VK_RETURN .or. nKey == VK_SPACE,;
                (oBrwMenuOptions:aArrayData[oBrwMenuOptions:nArrayAt][2]:=!oBrwMenuOptions:aArrayData[oBrwMenuOptions:nArrayAt][2],oBrwMenuOptions:Refresh()), ) ;
            )  }
    
    oBrwMenuOptions:CreateFromCode()

    Regards
    Anser
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse Drag Error when Kinetic scrolling is enabled
Posted: Fri Oct 30, 2009 02:04 PM

You must be using version 9.08, when Kinetic scrolling was first introduced.
In this version of XBrowse, there is bug in line 3199

Please replace "Skip( -1 )" as "::Skip( -1 )" in line 3199 of XBrowse.Prg ( version 9.08 )

This bug is fixed in version 9.09

Regards



G. N. Rao.

Hyderabad, India
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: xBrowse Drag Error when Kinetic scrolling is enabled
Posted: Sat Oct 31, 2009 04:29 AM
Dear Mr.Rao,

Please replace "Skip( -1 )" as "::Skip( -1 )" in line 3199 of XBrowse.Prg ( version 9.08 )


Thank you. Your solution worked.

May I ask you one more doubt :-) .

At present the code oBrw:lKinetic := .T./.F. is making Kinetic scrolling enabled/disabled on all the xBrowse's in the application. What would be the changes required in xBrowse class so that I can have 2 xbrowses in a dialog, one with kinetic scrolling and another one without kinetic scrolling.

Regards
Anser
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse Drag Error when Kinetic scrolling is enabled
Posted: Sat Oct 31, 2009 11:48 AM

lKinetic is implemented as CLASSDATA. So it applies to all browses. That is the way it is implemented now.

I am sure FWH can implement what you like to do.

Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: xBrowse Drag Error when Kinetic scrolling is enabled
Posted: Sat Oct 31, 2009 01:48 PM
Anser,

What would be the changes required in xBrowse class so that I can have 2 xbrowses in a dialog, one with kinetic scrolling and another one without kinetic scrolling.


This may not be a good design. Users will be confused by the browses not working the same way.

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse Drag Error when Kinetic scrolling is enabled
Posted: Sun Nov 01, 2009 06:28 AM

Mr James

>>
This may not be a good design. Users will be confused by the browses not working the same way.
>>

Personally I agree with you and I am for providing a consistent design through out an application.

Still there is no reason, why the library should not offer the flexibility to the programmer. Let the programmer decide what he desires to do with the flexibility.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse Drag Error when Kinetic scrolling is enabled
Posted: Sun Nov 01, 2009 06:34 AM
Mr Anser

Your question:
>>
What would be the changes required in xBrowse class so that I can have 2 xbrowses in a dialog, one with kinetic scrolling and another one without kinetic scrolling.
>>

If you like to modify your XBrowse class or have a derived class, this is my suggestion.

In the XBrowse.prg create a new DATA lKineticBrw ( between CLASS TXBrowse and END CLASS)
In both methods New() and Redefine, initialize this DATA to the CLASS DATA lKinetic and use lKineticBrw instead of lKinetic in the MouseMove method.
Code (fw): Select all Collapse
METHOD New( oWnd )  and also METHOD Redefine
...
...
::lKineticBrw := ::lKinetic
RETURN Self

METHOD MouseMove(..)

// ::lPressed := ::lKinetic   // Instead of this line
   ::lPressed := ::lKineticBrw  // Substitute this line

...

Now, if you set .t. or .f. to TXBrowse():lKinetic, this has a global effect.
When you set .t. or .f. to oBrw:lKineticBrw, this overrides the global setting and has effect only on that browse.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: xBrowse Drag Error when Kinetic scrolling is enabled
Posted: Mon Nov 02, 2009 04:59 AM
Dear MR.Rao,

Thank you for the help

>>
This may not be a good design. Users will be confused by the browses not working the same way.
>>

Personally I agree with you and I am for providing a consistent design through out an application.

Still there is no reason, why the library should not offer the flexibility to the programmer. Let the programmer decide what he desires to do with the flexibility.


I too insist on consistent design through out an application. But at certain times there may be specific situations to have an exception. As you rightly said "Let the programmer decide what he needs" and would be nice if the library provide that flexibility to the programmer

Regards
Anser

Continue the discussion