*Report: Fixed refresh issue

git-svn-id: svn://ultimatepp.org/upp/trunk@4973 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-05-20 10:36:06 +00:00
parent c8fd518d7e
commit 167e0dd45d
3 changed files with 723 additions and 719 deletions

File diff suppressed because it is too large Load diff

View file

@ -109,6 +109,7 @@ public:
ReportView& Numbers(bool nums) { numbers = nums; Refresh(); return *this; }
void Set(Report& report);
Report *Get() { return report; }
int GetFirst() const { return sb / pagesize.cy * pvn; }
void ScrollInto(int toppage, int top, int bottompage, int bottom);
@ -123,6 +124,7 @@ class ReportWindow : public WithReportWindowLayout<TopWindow> {
void Numbers() { pg.Numbers(numbers); }
void GoPage() { sw <<= ReportView::PG1; Pages(); }
void Pdf();
void ShowPage();
Array<Button> button;
Report *report;

View file

@ -205,7 +205,7 @@ ReportWindow::ReportWindow()
pg.WhenGoPage = THISBACK(GoPage);
lbl.SetFont(Arial(20).Italic());
lbl.SetAlign(ALIGN_CENTER);
pg.WhenAction = Breaker(-1);
pg.WhenAction = THISBACK(ShowPage);
Sizeable();
MaximizeBox();
Icon(CtrlImg::smallreporticon());
@ -247,6 +247,12 @@ void ReportWindow::SetButton(int i, const char *label, int id)
AddChildBefore(&button[i], &cancel);
}
void ReportWindow::ShowPage()
{
if(pg.Get())
lbl = Format("%d / %d", pg.GetFirst() + 1, pg.Get()->GetCount());
}
int ReportWindow::Perform(Report& report, int zoom, const char *caption)
{
this->report = &report;
@ -261,11 +267,8 @@ int ReportWindow::Perform(Report& report, int zoom, const char *caption)
ActiveFocus(pg);
Title(caption);
Open();
int n = -1;
for(;;) {
int nn = pg.GetFirst() + 1;
if(n != nn)
lbl = Format("%d / %d", n = nn, report.GetCount());
ShowPage();
int c = Run();
switch(c) {
case IDCANCEL: