FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse Disable() Problem
Posts: 301
Joined: Fri Jun 01, 2007 09:07 AM
xBrowse Disable() Problem
Posted: Sun Oct 13, 2013 08:49 AM
Hi all
I have problem with oBrw:Disable() becouse xBrowse is not disabled
example
Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

local oDlg, oBrw
local oCol

   use customer new exclusive
   go top

   DEFINE DIALOG oDlg FROM   0,  0 TO 260,550 PIXEL ;
          TITLE "Test"

   @   5,  5 XBROWSE oBrw OF oDlg ;
             SIZE 265,105 PIXEL ;
             AUTOCOLS FOOTERS CELL LINES

   ADD oCol TO oBrw DATA CUSTOMER->FIRST ;
       HEADER "First"

   ADD oCol TO oBrw DATA CUSTOMER->LAST ;
       HEADER "Last"

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED ;
            VALID ( oBrw:Disable() ,;
                    TestXBrowseDisable() ,;
                    MsgInfo("Dialog will be closed") ,;
                    .t. ;
                  )

return nil

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

function TestXBrowseDisable()
local nSalary := 0

DbGoTop()

do while !eof()
nSalary += Salary
DbSkip()
enddo

MsgInfo("Salary SUM: " + str(nSalary) )

return nil


I dont want xBrowse pointer to change position if xBrowse is disabled
The only solution i have found is to add MsgWait() function ...

Code (fw): Select all Collapse
ACTIVATE DIALOG oDlg CENTERED ;
            VALID ( oBrw:Disable(),  MsgWait(,,0) ,;
                    TestXBrowseDisable() ,;
                    MsgInfo("Dialog will be closed") ,;
                    .t. ;
                  )


But i am not sure is it functionally in any cases


Best regards,
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse Disable() Problem
Posted: Mon Oct 14, 2013 01:17 AM
You do not need to disable xbrowse to do what you wanted to do. Just save and restore the record position in your function.
Code (fw): Select all Collapse
function TestXBrowseKeepEnable()
local nSalary := 0
local nRec := RecNo()

DbGoTop()

do while !eof()
nSalary += Salary
DbSkip()
enddo

DbGoTo( nRec )

MsgInfo("Salary SUM: " + str(nSalary) )

return nil

and please remove all code to disable xbrowse
Regards



G. N. Rao.

Hyderabad, India
Posts: 301
Joined: Fri Jun 01, 2007 09:07 AM
Re: xBrowse Disable() Problem
Posted: Mon Oct 14, 2013 08:22 PM
Hi Rao
Thanks for reply
and please remove all code to disable xbrowse

Please what do you mean with this ?

BTW
I have cases when i need to have chance to disable xbrowse report for example with 10 rows ... customer choose 5 ...
on ESC key i want to delete other 5 and on other dialog i want to ask did he want to move choosen 5 records to another table but i want still visible all 10 records on the xbrowse

Code (fw): Select all Collapse
ACTIVATE DIALOG oDlg CENTERED ;
            VALID ( oBrw:Disable(),  MsgWait(,,0) )


work good in this case ... my question was ...why oBrw:Disable() not disable xbrowse

Best regards,

Continue the discussion