Ridotta altezza bottoni automaitici da 3 a 2 e tolti bottoni PgDN PGUp
git-svn-id: svn://10.65.10.50/trunk@85 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
833e3df2ef
commit
81c13723b9
222
ba/ba1102.cpp
222
ba/ba1102.cpp
@ -23,93 +23,93 @@ bool TEdit_file::browse(int logicnum, const char* name)
|
|||||||
head.add("@1");
|
head.add("@1");
|
||||||
|
|
||||||
for(int i = 0; (n = curr.fieldname(i)) != NULL; i++)
|
for(int i = 0; (n = curr.fieldname(i)) != NULL; i++)
|
||||||
{
|
{
|
||||||
trac.add(n);
|
trac.add(n);
|
||||||
head.add(n);
|
head.add(n);
|
||||||
|
|
||||||
int len = curr.length(n);
|
int len = curr.length(n);
|
||||||
if (curr.type(n) == _datefld) len = 10;
|
if (curr.type(n) == _datefld) len = 10;
|
||||||
if (len > strlen(n)) head << '@' << len;
|
if (len > strlen(n)) head << '@' << len;
|
||||||
}
|
}
|
||||||
|
|
||||||
KEY ch;
|
KEY ch;
|
||||||
TCursor_sheet sheet(&cursor, trac, name, head, 6);
|
TCursor_sheet sheet(&cursor, trac, name, head, 6);
|
||||||
|
|
||||||
while ((ch = sheet.run()) != K_ESC)
|
while ((ch = sheet.run()) != K_ESC)
|
||||||
{
|
|
||||||
if (ch == K_DEL && sheet.one_checked())
|
|
||||||
{
|
{
|
||||||
TProgind* pind = NULL;
|
if (ch == K_DEL && sheet.one_checked())
|
||||||
cursor.freeze(TRUE);
|
{
|
||||||
bool go = FALSE;
|
TProgind* pind = NULL;
|
||||||
bool first = FALSE;
|
cursor.freeze(TRUE);
|
||||||
int j;
|
bool go = FALSE;
|
||||||
for (j = 0, cursor = 0; j < sheet.items(); ++cursor, j++)
|
bool first = FALSE;
|
||||||
|
int j;
|
||||||
|
for (j = 0, cursor = 0; j < sheet.items(); ++cursor, j++)
|
||||||
{
|
{
|
||||||
if (sheet.checked(j))
|
if (sheet.checked(j))
|
||||||
{
|
|
||||||
if (!go && !first)
|
|
||||||
go = yesno_box("Confermi la cancellazione dei %d "
|
|
||||||
"record indicati?", sheet.checked());
|
|
||||||
first = TRUE;
|
|
||||||
|
|
||||||
if (!pind)
|
|
||||||
{
|
|
||||||
pind = new TProgind(sheet.checked(),"Attendere...",
|
|
||||||
TRUE, TRUE, 32);
|
|
||||||
pind->addstatus(1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (pind->iscancelled()) break;
|
if (!go && !first)
|
||||||
pind->addstatus(1);
|
go = yesno_box("Confermi la cancellazione dei %d "
|
||||||
|
"record indicati?", sheet.checked());
|
||||||
|
first = TRUE;
|
||||||
|
|
||||||
|
if (!pind)
|
||||||
|
{
|
||||||
|
pind = new TProgind(sheet.checked(),"Attendere...",
|
||||||
|
TRUE, TRUE, 32);
|
||||||
|
pind->addstatus(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pind->iscancelled()) break;
|
||||||
|
pind->addstatus(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (go) cursor.file()->remove();
|
||||||
|
sheet.uncheck(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (go) cursor.file()->remove();
|
|
||||||
sheet.uncheck(j);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (pind) delete pind;
|
if (pind) delete pind;
|
||||||
cursor.freeze(FALSE);
|
cursor.freeze(FALSE);
|
||||||
|
|
||||||
if (first) {sheet.select(1); continue;}
|
if (first) {sheet.select(1); continue;}
|
||||||
}
|
}
|
||||||
if (ch == K_ENTER || ch == K_DEL)
|
if (ch == K_ENTER || ch == K_DEL)
|
||||||
cursor = sheet.selected();
|
cursor = sheet.selected();
|
||||||
|
|
||||||
switch(ch)
|
switch(ch)
|
||||||
{
|
|
||||||
case K_ENTER: // edit fields
|
|
||||||
svrec = curr;
|
|
||||||
if (edit_record(curr, FALSE) == K_ENTER)
|
|
||||||
{
|
{
|
||||||
TString s(svrec.key(1));
|
case K_ENTER: // edit fields
|
||||||
|
svrec = curr;
|
||||||
if (s != curr.key(1))
|
if (edit_record(curr, FALSE) == K_ENTER)
|
||||||
{
|
{
|
||||||
|
TString s(svrec.key(1));
|
||||||
|
|
||||||
|
if (s != curr.key(1))
|
||||||
|
{
|
||||||
|
cursor.file()->write();
|
||||||
|
if (cursor.file()->good())
|
||||||
|
{
|
||||||
|
curr = svrec;
|
||||||
|
cursor.file()->remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
cursor.file()->rewrite();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case K_DEL: // delete record
|
||||||
|
if (yesno_box("Confermare la cancellazione del record"))
|
||||||
|
cursor.file()->remove();
|
||||||
|
break;
|
||||||
|
case K_INS: // insert new record
|
||||||
|
curr.zero();
|
||||||
|
if (edit_record(curr,FALSE) == K_ENTER)
|
||||||
cursor.file()->write();
|
cursor.file()->write();
|
||||||
if (cursor.file()->good())
|
break;
|
||||||
{
|
|
||||||
curr = svrec;
|
|
||||||
cursor.file()->remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
cursor.file()->rewrite();
|
|
||||||
}
|
}
|
||||||
break;
|
sheet.force_update();
|
||||||
case K_DEL: // delete record
|
|
||||||
if (yesno_box("Confermare la cancellazione del record"))
|
|
||||||
cursor.file()->remove();
|
|
||||||
break;
|
|
||||||
case K_INS: // insert new record
|
|
||||||
curr.zero();
|
|
||||||
if (edit_record(curr,FALSE) == K_ENTER)
|
|
||||||
cursor.file()->write();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
sheet.force_update();
|
|
||||||
}
|
|
||||||
return K_ESC;
|
return K_ESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,54 +125,50 @@ KEY TEdit_file::edit_record(TRectype& rec, bool readonly)
|
|||||||
const char* cp;
|
const char* cp;
|
||||||
|
|
||||||
for(int i = 0; (cp = rec.fieldname(i)) != NULL; i++)
|
for(int i = 0; (cp = rec.fieldname(i)) != NULL; i++)
|
||||||
|
{
|
||||||
|
// add fields ONE by ONE
|
||||||
|
TString16 s(cp); s.left_just(16);
|
||||||
|
int len = rec.length(cp);
|
||||||
|
switch (rec.type(cp))
|
||||||
{
|
{
|
||||||
// add fields ONE by ONE
|
case _alfafld:
|
||||||
TString s(cp); s.left_just(16);
|
m.add_string(nid++,curpage, s, 3, currow, len, "",
|
||||||
int len = rec.length(cp);
|
len > 50 ? 50 : len);
|
||||||
switch (rec.type(cp))
|
break;
|
||||||
{
|
case _intfld:
|
||||||
case _alfafld:
|
case _longfld:
|
||||||
m.add_string(nid++,curpage, s, 3, currow, len, "",
|
case _wordfld:
|
||||||
len > 50 ? 50 : len);
|
case _realfld:
|
||||||
break;
|
m.add_number(nid++, curpage, s, 3, currow, len, "",
|
||||||
case _intfld:
|
rec.ndec(cp));
|
||||||
case _longfld:
|
break;
|
||||||
case _wordfld:
|
case _datefld:
|
||||||
case _realfld:
|
m.add_date(nid++, curpage, s, 3, currow);
|
||||||
m.add_number(nid++, curpage, s, 3, currow, len, "",
|
break;
|
||||||
rec.ndec(cp));
|
case _charfld:
|
||||||
break;
|
case _boolfld:
|
||||||
case _datefld:
|
m.add_string(nid++,curpage, s, 3, currow, 1);
|
||||||
m.add_date(nid++, curpage, s, 3, currow);
|
break;
|
||||||
break;
|
case _intzerofld:
|
||||||
case _charfld:
|
case _longzerofld:
|
||||||
case _boolfld:
|
m.add_number(nid++, curpage, s, 3, currow, len, "Z",
|
||||||
m.add_string(nid++,curpage, s, 3, currow, 1);
|
rec.ndec(cp));
|
||||||
break;
|
break;
|
||||||
case _intzerofld:
|
default:
|
||||||
case _longzerofld:
|
break;
|
||||||
m.add_number(nid++, curpage, s, 3, currow, len, "Z",
|
|
||||||
rec.ndec(cp));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
m.field(nid-1).set(rec.get(cp));
|
|
||||||
|
|
||||||
if (((i+1) % 15) == 0 || i == recs-1)
|
|
||||||
{
|
|
||||||
m.add_button(DLG_OK, curpage, "", -14, -1, 9, 3);
|
|
||||||
m.add_button(DLG_CANCEL, curpage, "", -24, -1, 9, 3);
|
|
||||||
if (curpage > 0)
|
|
||||||
m.add_button(DLG_PGUP, curpage, "", -34, -1, 9, 3);
|
|
||||||
if (pages > 1 && curpage < pages-1)
|
|
||||||
m.add_button(DLG_PGDN, curpage, "", -44, -1, 9, 3);
|
|
||||||
curpage++; currow = 1;
|
|
||||||
}
|
|
||||||
else currow++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m.field(nid-1).set(rec.get(cp));
|
||||||
|
|
||||||
|
if (((i+1) % 15) == 0 || i == recs-1)
|
||||||
|
{
|
||||||
|
m.add_button(DLG_OK, curpage, "", -12, -1, 9, 2);
|
||||||
|
m.add_button(DLG_CANCEL, curpage, "", -22, -1, 9, 2);
|
||||||
|
curpage++; currow = 1;
|
||||||
|
}
|
||||||
|
else currow++;
|
||||||
|
}
|
||||||
|
|
||||||
if (readonly)
|
if (readonly)
|
||||||
{
|
{
|
||||||
const int max = m.fields();
|
const int max = m.fields();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user