xBrowse Disable() Problem

xBrowse Disable() Problem

Postby avista » Sun Oct 13, 2013 8:49 am

Hi all
I have problem with oBrw:Disable() becouse xBrowse is not disabled
example
Code: Select all  Expand view  RUN

#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: Select all  Expand view  RUN

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,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: xBrowse Disable() Problem

Postby nageswaragunupudi » Mon Oct 14, 2013 1: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: Select all  Expand view  RUN
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
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse Disable() Problem

Postby avista » Mon Oct 14, 2013 8: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: Select all  Expand view  RUN
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,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], MaxP, Natter and 77 guests