Page 1 of 2

Grid with more indexes

Posted: Mon May 10, 2010 1:16 pm
by radohabjan
Hello,

I have problem with grid refresh for dbf file with more indexes.
Example:When first time I enter in test menue is ok . Then I sort grid with dbf to descending number (index 4) , grid is ok restorted to descending, then I go out with ESC to main menue and back to test. I get wrong grid ( see gridpic.jpg ).

Complete sources and pic in attached zip file.


#include "hmg.ch"

Function Main
REQUEST DBFNTX
RDDSETDEFAULT( "DBFNTX" )
SET DELETED ON
SET DATE GERMAN
SET CENTURY ON
SET EXCLUSIVE OFF
SET BROWSESYNC ON
SET LANGUAGE TO SLOVENIAN
SET NAVIGATION EXTENDED
REQUEST HB_CODEPAGE_SLWIN
HB_SETCODEPAGE( "SLWIN" )
Private bColor := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , { 245,245,245 } , { 255,255,255 } ) }
Private fColor := { || { 0,0,255 }}
DEFINE WINDOW meni ;
AT 20,20 ;
WIDTH getdesktopWidth()-50 ;
HEIGHT getDeskTopHeight()-120 ;
TITLE 'Test' ;
MAIN
DEFINE MAIN MENU
POPUP 'Menue'
ITEM '&1. Test' ACTION (test())
END POPUP
END MENU
END WINDOW
CENTER WINDOW meni
ACTIVATE WINDOW meni
close databases
return


procedure test
select 2
use naslovi alias naslovi
set index to naslovi,naziv
select 5
use gl_pred alias gl_pred
set index to gl_pred1,gl_pred2,gl_pred3,gl_pred4,gl_pred5
set relation to sifra into naslovi
go top
katerig:=reccount()
DEFINE WINDOW predrac ;
AT 20,20 ;
WIDTH getdesktopWidth()-50 ;
HEIGHT getDeskTopHeight()-120 ;
TITLE 'Test' ;
MODAL

@ 65,5 GRID Grid_pred ;
WIDTH getdesktopWidth()-70 ;
HEIGHT getDeskTopHeight()-270 ;
HEADERS { 'Num.','Šifra','Ime kupca','Datum','Znesek','Rabat','DDV','Zaslužek','Za plačilo',;
'Dod.stroški','Datum plačila','Valuta','Knjižen','Status','Plačano po','predračunu',;
'Vrsta','Zav.za davek'} ;
WIDTHS { 70,70,240,100,90,90,90,90,100,90,100,50,60,50,90,80,40,40 } ;
ROWSOURCE "GL_PRED" ;
VALUE { 1, 1} ;
COLUMNFIELDS { 'gl_pred->STEV','gl_pred->SIFRA','NASLOVI->NAZIV','gl_pred->DATUM','transform(round(gl_pred->vse,2),"@E 99,999,999.99")',;
'transform(round(gl_pred->rabat,2),"@E 9,999,999.99")','transform(round(gl_pred->davek,2),"@E 9,999,999.99")',;
'transform(round(gl_pred->prep,2),"@E 9,999,999.99")','transform(round(gl_pred->skupaj,2),"@E 9,999,999.99")',;
'transform(round(gl_pred->ptt,2),"@E 9,999,999.99")','gl_pred->DATUM_PLA','gl_pred->VALUTA','gl_pred->KNJ','gl_pred->STATUS',;
'transform(gl_pred->PLACANO,"@E 9,999,999.99")','gl_pred->PRED','substr(gl_pred->KON,2,1)', 'substr(naslovi->KOM2,46,1)' } ;
JUSTIFY { BROWSE_JTFY_LEFT,BROWSE_JTFY_LEFT,BROWSE_JTFY_LEFT,BROWSE_JTFY_LEFT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,;
BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,;
BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT,BROWSE_JTFY_RIGHT };
TOOLTIP 'Seznam predračunov' ;
ON DBLCLICK test1() ;
FONT 'ARIAL' SIZE 10 ;
ON HEADCLICK { { || Sort_stevpred() },,, { || Sort_datpred() } } ;
HEADERIMAGES { '02.bmp','00.bmp','00.bmp','00.bmp' } ;
DYNAMICFORECOLOR { fColor,fColor,fColor,fColor,fColor,fColor,fcolor,fcolor;
,fColor,fColor,fColor,fColor,fcolor,fColor,fColor,fColor,fColor,fColor} ;
DYNAMICBACKCOLOR { bcolor,bcolor,bcolor,bcolor,bcolor,bcolor,bcolor,{|| if ( gl_pred->prep < 0 , {255,150,150} , {150,255,150} ) };
,bcolor,bcolor,bcolor,bcolor,bcolor,bcolor,bcolor,bcolor,bcolor,bcolor };
LOCKCOLUMNS 5

ON KEY ESCAPE ACTION predrac.release
END WINDOW
CENTER WINDOW predrac
ACTIVATE WINDOW predrac
close databases
return

procedure sort_stevpred()
if indexord()=1
set order to 4
predrac.Grid_pred.HeaderImages( 1 ) := '01.bmp'
predrac.Grid_pred.HeaderImages( 4 ) := '00.bmp'
else
set order to 1
predrac.Grid_pred.HeaderImages( 1 ) := '02.bmp'
predrac.Grid_pred.HeaderImages( 4 ) := '00.bmp'
endif
predrac.Grid_pred.Refresh
return

procedure sort_datpred()
if indexord()=2
set order to 5
predrac.Grid_pred.HeaderImages( 4 ) := '01.bmp'
predrac.Grid_pred.HeaderImages( 1 ) := '00.bmp'
else
set order to 2
predrac.Grid_pred.HeaderImages( 4 ) := '02.bmp'
predrac.Grid_pred.HeaderImages( 1 ) := '00.bmp'
endif
predrac.Grid_pred.Refresh
return

procedure test1()
select naslovi
msginfo("test")
set deleted off
predrac.Grid_pred.recno:=10
set deleted on
return


best regards Rado

Re: Grid with more indexes

Posted: Mon May 10, 2010 1:19 pm
by Roberto Lopez
Thanks for the report.

I'll check it ASAP.

Re: Grid with more indexes

Posted: Mon May 10, 2010 10:48 pm
by Roberto Lopez
Roberto Lopez wrote:Thanks for the report.

I'll check it ASAP.
I've fixed.

Please, replace libhmg.a with the attached one and test again.

Thanks again for the report.

Re: Grid with more indexes

Posted: Tue May 11, 2010 8:37 am
by radohabjan
Thanks Roberto,

it works.

best regards Rado

Re: Grid with more indexes

Posted: Thu May 13, 2010 5:04 pm
by radohabjan
Hello Roberto,

I have the same problem with refresh also when in one grid is another grid and you go out of second grid

Program in attached file : Menue : Test
Select with DBLclick number 26 to go to another grid and then with ESC to first grid.

Best regards Rado

Re: Grid with more indexes

Posted: Thu May 13, 2010 5:52 pm
by Roberto Lopez
radohabjan wrote:Hello Roberto,

I have the same problem with refresh also when in one grid is another grid and you go out of second grid

Program in attached file : Menue : Test
Select with DBLclick number 26 to go to another grid and then with ESC to first grid.

Best regards Rado
Thanks. I'll check it.

Re: Grid with more indexes

Posted: Thu May 13, 2010 10:56 pm
by Roberto Lopez
radohabjan wrote:Hello Roberto,

I have the same problem with refresh also when in one grid is another grid and you go out of second grid

Program in attached file : Menue : Test
Select with DBLclick number 26 to go to another grid and then with ESC to first grid.

Best regards Rado
Fixed.

Please, test with the attached lib.

Re: Grid with more indexes

Posted: Fri May 14, 2010 7:24 am
by radohabjan
Hello Roberto,

refresh is now OK, the problem is still in in grid column Num.
Explenation : if you select with Dblclick Num. 26 and than with ESC back , you get in column Num. number 22.
Same is also with all numbers higher as 26. And when you scroll the main grid it's all mixed.
Perhaps is there some problem with record numbers ( set deleted on )

Bert regard Rado

Re: Grid with more indexes

Posted: Fri May 14, 2010 12:06 pm
by Roberto Lopez
radohabjan wrote:Hello Roberto,

refresh is now OK, the problem is still in in grid column Num.
Explenation : if you select with Dblclick Num. 26 and than with ESC back , you get in column Num. number 22.
Same is also with all numbers higher as 26. And when you scroll the main grid it's all mixed.
Perhaps is there some problem with record numbers ( set deleted on )

Bert regard Rado
I'll check again.

Re: Grid with more indexes

Posted: Fri May 14, 2010 12:42 pm
by Roberto Lopez
radohabjan wrote:Hello Roberto,

refresh is now OK, the problem is still in in grid column Num.
Explenation : if you select with Dblclick Num. 26 and than with ESC back , you get in column Num. number 22.
Same is also with all numbers higher as 26. And when you scroll the main grid it's all mixed.
Perhaps is there some problem with record numbers ( set deleted on )

Bert regard Rado
I've tested...

1. I open the first grid.
2. I go to record 26.
3. I double click it (the second grid window opens).
4. I close the second window (clicking [X]).
5. The record 26 looks exactly the same as prior to open the second grid.

The problem arises only when you press [Esc].

I must to find why this happens...