Page 1 of 1

destroy a xbrowse

Posted: Wed Jun 09, 2021 4:08 pm
by Silvio.Falconi
for the reservations program I show the list of services in an xbrowse, if I change my reservation and it doesn't have the services I must not show the xbrowse
I tried with

IF oBrw != NIL
oBrw:Destroy() //end()
Endif

but nothing happens the oBrw is allway there

any solution pls ?

Re: destroy a xbrowse

Posted: Wed Jun 09, 2021 5:54 pm
by ukoenig
Silvio,

just use

oBrw:Move( 0, 0 )

that will not harm any data

regards
Uwe :D

Re: destroy a xbrowse

Posted: Thu Jun 10, 2021 7:59 am
by Silvio.Falconi
ukoenig wrote:Silvio,

just use

oBrw:Move( 0, 0 )

that will not harm any data

regards
Uwe :D



Uwe,
I explain YOU

I have the browse on a Vtaskbar as you can see here

I need this xbrowse to view the services for each order but it is also possible that an order may not have the services

this is activated when I press on an umbrella, obviously in this figure it is not there because since it doesn't work I have removed it

Image

but I think it's clear to give you the idea

when I change umbrella I go to load the data from an archive by making a scope on the order number and I create an array aItems to show it on a xbrowse

local nInvoice:=alltrim(cNumPre)
IF Empty( nInvoice)

aItems:={}
// Close the vtaskbar I make a switch but the user could b reopen it manually with the mouse
oVMenu5:Refresh()
oVMenu5:lOpened :=.T.
oVMenu5:Switch()
// I wish delete the oBrw but it is possible that the oBrw was not built previously because there are also orders without the services included
// if Make oBrw:Move(0,0) give me error also if I made oBrw:end() or oBrw:destroy()
IF oBrw !=NIL
oBrw:Move(0,0) // Not run !!!
Endif
RETURN NIL
ELSE
oVMenu5:lOpened :=.F.
oVMenu5:Switch()
oRighe:= TRigheReserva():New()
oRighe:OrdScope( TOPSCOPE, nInvoice )
oRighe:OrdScope( BOTTOMSCOPE, nInvoice )
oRighe:gotop()
DO while !oRighe:eof()
aadd(aItems,{oRighe:ico,oRighe:Desc,oRighe:Qta,oRighe:dataini,oRighe:datafin} )
oRighe:Skip()
ENDDO
nInvoice:=""
oRighe:OrdScope( TOPSCOPE, NIL )
oRighe:OrdScope( BOTTOMSCOPE, NIL )
oRighe:close()
ENDIF

IF len(aItems)>0


@30,2 XBROWSE oBrw OF oVMenu5 ;
COLUMNS 1, 2, 3 , 4 , 5 ;
HEADERS "ico","desc","qta", "dal", "al" ;
COLSIZES 20, 40,20,60,60 ;
ARRAY aItems ;
SIZE -5,-10 PIXEL NOBORDER

.....

Endif

return nil

Image

when I change umbrella I do the same operation obviously changes the order number

but it happens that I always see the same xbrowse with the same content how do I delete the array and the xbrowse every time?


to make yourself understood follow the video
umbrella 83 does not have services because it does not even have order


Image

Re: destroy a xbrowse

Posted: Fri Jun 11, 2021 7:42 am
by Marc Venken
Silvio,

Maybe you can consider to Hide the xbrowse in stead of destroy it. If the data has no services, you could hide the colums ?

static function ReArrangeCols( oBrw, aCols )

AEval( oBrw:aCols, { |o| o:lHide := .f. } )
oBrw:ReArrangeCols( aCols )
AEval( oBrw:aCols, { |o| o:lHide := .t. }, Len( aCols ) + 1 )
oBrw:Refresh()

return nil

Showing a empty browse when there are no services is what i would do... but that is your choise !!

Re: destroy a xbrowse

Posted: Mon Jun 14, 2021 7:35 am
by Silvio.Falconi
Not Run, I erase all
I insert services on a box on msgbar

Re: destroy a xbrowse

Posted: Mon Jun 14, 2021 8:02 pm
by nageswaragunupudi
I am not sure if I understood what you want correctly.

If you want to hide and unhide xbrowse, you can use:

Hide

Code: Select all | Expand


oBrw:Disable()
oBrw:Hide()
 


Show again

Code: Select all | Expand

oBrw:Show()
oBrw:Enable()