Page 1 of 1

AutoFresh GetList

Posted: Thu Nov 14, 2019 10:23 am
by PedroAlex
hello,

I have a small program to receive data from a client.exe program via websocket.
This program is for a Customer DualDisplay POS system.
The program AbDisplay.exe receive de data but I need to refresh the getlist without clicking the button.
What I want is that when data is entered the abdisplay autorefresh the getlist.

This is possible!?

Many thanks..

Re: AutoFresh GetList

Posted: Thu Nov 14, 2019 4:00 pm
by rdonnay
Why is it not possible for you to use DC_GetRefresh(GetList).

Re: AutoFresh GetList

Posted: Fri Nov 15, 2019 8:33 am
by PedroAlex
Roger,

Maybe it didn't explain well..

I want a passive small program without any buttons and without user intervention.
How can i refresh the getlist without user intervention?

Edit abdisplay.prg and delete or disable the pushbutton comand and compile.
than run abdisplay.
than run cliente.exe and send a message.
The abdisplay receive the message but the getlist does not refresh the browse and the gets.

The dcbrowse have "Autorefesh" but this does not refresh the gets..

Many thanks

Re: AutoFresh GetList

Posted: Fri Nov 15, 2019 2:13 pm
by rdonnay
Do the following:

Code: Select all

Public GetList := {}

Procedure MAIN()
LOCAL GetOptions   //, GetList := {}  << GetList is now PUBLIC


METHOD EchoServer:onBinary( cBinary )

xData := Bin2Var(cBinary)

	IF Len( xData ) > 0
		cNomeArtigo := xData[1]
		nQtd        := xData[2]
		nPvp        := xData[3]
		nTotal      := nQtd*nPvp
		nGTotal     += nTotal
		aadd( aConta, {nQtd,cNomeArtigo,nTotal} )
            DC_GetRefresh(GetList)  // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	Endif

RETURN self

Re: AutoFresh GetList

Posted: Sat Nov 16, 2019 2:30 am
by PedroAlex
I had already tried this way..

[img][/[img]

Re: AutoFresh GetList

Posted: Sat Nov 16, 2019 9:39 am
by rdonnay
Here is a solution that will work.
This one has been tested.

I had not tested the last solution I gave you.
It appears that Xbase++ didn't like refreshing the main thread directly from the EchoClient thread.

I have had this problem in many other apps and always solved the problem by pushing an event into the thread that contains the main window.

This is done by adding the following code: (files are attached).

#define REFRESH_GETLIST xbeP_User + 100
...
Public oMainWindow
...
DCUSEREVENT REFRESH_GETLIST ACTION {||DC_GetRefresh(GetList)}
...
DCREAD GUI .. PARENT @oMainWindow
...
PostAppEvent(REFRESH_GETLIST,,,oMainWindow)
Sleep(10)

Re: AutoFresh GetList

Posted: Sat Nov 16, 2019 10:43 am
by PedroAlex
Roger,

Thank you very much.
It works very well.