Page 1 of 1

Refresh DCSTATIC object

Posted: Tue Apr 05, 2016 7:46 am
by Victorio
Hi,
I have headache from small problem (now big for me :roll: )

How can I refresh DSTATIC ?

I have browser, with buttons, and up is caption with dcstatic. By using fucntion I change one variable and I want to update it in caption. HIDE works, but caption is still same.
Here is part of source :

LOCAL aktuimport:="000000"
aktuimport:=STATIMPORT() // in aktuimport is some number of report as text variable

* DCBROWSE
@pozyrk,10 DCBROWSE oBrowse ;
SIZE rozxrk,rozyrk PIXEL ;
NOSOFTTRACK ;
SCOPE ;
OPTIMIZE ;
CURSORMODE XBPBRW_CURSOR_ROW ;
ITEMSELECTED {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)} ;
TAGENABLE ;
TAGELEMENT 35 ;
TAGCOLOR GRA_CLR_RED, GRA_CLR_YELLOW ;
TAGMODE DCGUI_TAGMODE_CLEAR ;
HEADLINES 2 ;

DCBROWSECOL FIELD 1->OKRES ;
HEADER hrku[1] PARENT oBrowse ;
WIDTH znakpixc[1]*8

DCBROWSECOL FIELD 1->CISKU ;
HEADER hrku[2] PARENT oBrowse ;
WIDTH znakpixc[1]*13
... etc other fields

* TOOLBAR
@ pozyrk-8,rozxrk+20 DCTOOLBAR oToolbar1 SIZE 13*znakpixc[1],aSize[2]*0.75 ;
ALIGN DCGUI_ALIGN_LEFT ;
BUTTONSIZE 11*znakpixc[1],3.4*fontnv ;
SPACE 5 ;
RESIZE DCGUI_RESIZE_REPOSONLY_X ;
FIT

* posun na zač, vzad, vpred, na koniec ok
DCADDBUTTONXP CAPTION BITMAP_TOP_S PARENT oToolbar1 ;
TOOLTIP "Na začiatok" ;
CONFIG oConfig1 ;

* HERE !!! if I click button, program go to function statimport(), and this function return number of report

DCADDBUTTONXP CAPTION 'Štatistika;importu' PARENT oToolbar1 ;
TOOLTIP "Vygenerovanie štatistiky pre zadaný import" ;
FONT fontnt ;
CONFIG oConfig1 ;
ACTION {||tone(1000,1),aktuimport:=statimport(),oBrowse:RefreshAll(),;
DC_GetRefresh(GetList)}

* HERE I want always after process function statimport() redraw Caption of report.
* BUT this stay still same, not change any refresh not help.
************************************************************
@pozyrk-8-(fontnv*2.2),5 DCSTATIC TYPE XBPSTATIC_TYPE_RAISEDBOX ;
SIZE 25*znakpixc[1],fontnv*2.2 PIXEL ;
COLOR COLOR_BLACK,COLOR_TITBROWSERY

* HERE I want refresh text for CAPTION

@pozyrk-8-(fontnv*2.0),10 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT SIZE 25*znakpixc[1],fontnv*1.8 PIXEL ;
CAPTION "IMPORT č. [ "+aktuimport+" ]"

DCGETOPTIONS PIXEL ;
WINDOWCOL aposx+5 ;
WINDOWROW aposy+5 ;
WINDOWWIDTH aSize[1]*0.98 ;
WINDOWHEIGHT aSize[2]*0.95 ;
TABSTOP AUTORESIZE ;
SAYWIDTH 0 ;
FONT fontnt ;
SAYFONT fontnt ;
HILITEGETS GRA_CLR_BLUE

* OPTIONS GeoOptions asi nastavi predvolené parametre ako sú v DCGETOPTIONS
DCREAD GUI to lOk PARENT oBrowse ;
OPTIONS GetOptions ;
TITLE "Štatistika naimportovaných údajov" ;
MODAL ;
EVAL {|o|SetAppFocus(oBrowse:GoTop()),oBrowse:RefreshAll(),DC_Getrefresh()} ;
SETAPPWINDOW

* I put here also DC_GetRefresh, but not effect.

Thanks.

Re: Refresh DCSTATIC object

Posted: Tue Apr 05, 2016 8:09 am
by rdonnay

Code: Select all

You need to put the caption in a code block:

@pozyrk-8-(fontnv*2.0),10 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT SIZE 25*znakpixc[1],fontnv*1.8 PIXEL ;
CAPTION {||"IMPORT č. [ "+aktuimport+" ]" } OBJECT oStatic


DC_GetRefresh(oStatic)  // refresh the static


You can also use the :setCaption() method:

oStatic:setCaption("IMPORT č. [ "+aktuimport+" ]")

Re: Refresh DCSTATIC object

Posted: Tue Apr 05, 2016 12:04 pm
by Victorio
Thank you, it is interesting for me, tomorrow I will try.

Re: Refresh DCSTATIC object

Posted: Wed Apr 06, 2016 10:59 am
by Victorio
Hi,

with code block work fine, thanks for help.

Victorio