Aggiustati messaggi d'errore e update degli sheet

git-svn-id: svn://10.65.10.50/trunk@2817 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-05-14 11:11:50 +00:00
parent a0b57e024e
commit c9e5acad42
10 changed files with 46 additions and 52 deletions

View File

@ -1612,8 +1612,8 @@ void TDropDownList::open()
xi_get_def_rect(lstdef, &l); xi_get_def_rect(lstdef, &l);
wr.right = wr.left + (l.right - l.left) -1; // r.right; wr.right = wr.left + (l.right - l.left) -1; // r.right;
wr.bottom = wr.top + l.bottom - l.top; wr.bottom = wr.top + l.bottom - l.top;
int delta_x = _xi_obj->itf->v.itf->delta_x; const int delta_x = _xi_obj->itf->v.itf->delta_x;
int delta_y = _xi_obj->itf->v.itf->delta_y; const int delta_y = _xi_obj->itf->v.itf->delta_y;
wr.left -= delta_x; wr.left -= delta_x;
wr.right -= delta_x; wr.right -= delta_x;
wr.top -= delta_y; wr.top -= delta_y;
@ -1659,7 +1659,7 @@ bool TListbox_control::event_handler(XI_OBJ* itf, XI_EVENT* xiev)
case XIE_CHAR_FIELD: case XIE_CHAR_FIELD:
{ {
const KEY k = xiev_to_key(xiev); const KEY k = xiev_to_key(xiev);
if (isalnum(k)) if (k >= ' ' && k <= 'z')
_ddl->select_by_initial(k); _ddl->select_by_initial(k);
else if (k == K_F9) else if (k == K_F9)
_ddl->open(); _ddl->open();

View File

@ -613,7 +613,7 @@ bool TMask::on_key(
for (int i = fields()-1; i >= 0; i--) for (int i = fields()-1; i >= 0; i--)
{ {
TMask_field& f = fld(i); TMask_field& f = fld(i);
if (f.class_id() == CLASS_BUTTON_FIELD && f.active()) if (f.active() && f.is_kind_of(CLASS_BUTTON_FIELD))
{ {
TButton_field& b = (TButton_field&)f; TButton_field& b = (TButton_field&)f;
if (b.virtual_key() == key) if (b.virtual_key() == key)

View File

@ -3484,7 +3484,7 @@ const char* TList_field::win2raw(const char* data) const
int pos = value.get_pos(_ctl_data._park); int pos = value.get_pos(_ctl_data._park);
if (pos < 0 && _ctl_data._park.blank()) if (pos < 0 && _ctl_data._park.blank())
{ {
_ctl_data._park = value.get(0); _ctl_data._park = codes.get(0); // Uso codes come riferimento per blank
if (_ctl_data._park.blank()) if (_ctl_data._park.blank())
pos = 0; pos = 0;
} }

View File

@ -259,13 +259,13 @@ TSpreadsheet::TSpreadsheet(
{ {
CHECKD(i < MAX_COL, "Tu meni calumns in scit: ", i); CHECKD(i < MAX_COL, "Tu meni calumns in scit: ", i);
const int cid = FIRST_FIELD+i; // Column & Field ID const int cid = FIRST_FIELD+i; // Column & Field ID
const TOperable_field* f = field(cid); // Field on mask const TOperable_field* f = field(cid); // Field on mask
CHECKD(f, "The spreadsheet mask needs ALSO field ", cid); CHECKD(f, "The spreadsheet mask needs ALSO field ", cid);
TString testa(h); TString testa(h);
const int at = testa.find('@'); const int at = testa.find('@');
int m = f->size(); // Memory width const int m = f->size(); // Memory width
int v = m; // Video width int v = m; // Video width
if (at >= 0) if (at >= 0)
{ {
@ -285,7 +285,6 @@ TSpreadsheet::TSpreadsheet(
} }
if (v > 69) if (v > 69)
v = 69; v = 69;
m = f->size();
m_width[i] = m+1; // m = number of allowed chars m_width[i] = m+1; // m = number of allowed chars
v_width[i] = v+1; // v = width of column v_width[i] = v+1; // v = width of column
@ -674,7 +673,8 @@ void TSpreadsheet::update(
if (scroll) if (scroll)
xi_scroll(_obj, XI_SCROLL_FIRST); xi_scroll(_obj, XI_SCROLL_FIRST);
else else
xi_scroll_rec(_obj, handle[first], NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0); // xi_scroll_rec(_obj, handle[first], NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0);
xi_scroll(_obj, 0);
_needs_update = -1; // Clear pending row update _needs_update = -1; // Clear pending row update
} }
@ -1099,7 +1099,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
XI_MAKE_CELL(&cell, _obj, _cur_row, _cur_col); XI_MAKE_CELL(&cell, _obj, _cur_row, _cur_col);
TList_field& lst = ((TList_field&)*_edit_field); TList_field& lst = ((TList_field&)*_edit_field);
if (k < 128 && isalnum(k)) if (k >= ' ' && k <= 'z')
{ {
lst.select_by_initial(k); lst.select_by_initial(k);
xi_set_text(&cell, (char*)lst.raw2win(lst.get())); xi_set_text(&cell, (char*)lst.raw2win(lst.get()));

View File

@ -14,7 +14,6 @@
#include <scanner.h> #include <scanner.h>
#include <utility.h> #include <utility.h>
#include <lffiles.h>
#include <codeb.h> #include <codeb.h>
extern int get_error(int); extern int get_error(int);
@ -122,7 +121,7 @@ HIDDEN int closeall(bool changestudy, TBit_array& excl, TBit_array& toclose)
d.get(i + 1, _nolock, _nordir, _sysdirop); d.get(i + 1, _nolock, _nordir, _sysdirop);
if (toclose[i + 1] || changestudy || !d.is_com()) if (toclose[i + 1] || changestudy || !d.is_com())
{ {
excl.set(i, DB_file_locked(isfd->fhnd) == _excllock); excl.set(i, DB_file_locked(isfd->fhnd) != 0);
err=DB_close(isfd->fhnd); err=DB_close(isfd->fhnd);
if (err != NOERR) err=get_error(err); if (err != NOERR) err=get_error(err);
if (err != NOERR) fatal_box("Can't close file %d. Error n. %d",isfd->ln,err); if (err != NOERR) fatal_box("Can't close file %d. Error n. %d",isfd->ln,err);
@ -168,7 +167,7 @@ HIDDEN void openall(bool changestudy, TBit_array& excl, int oldmax, TBit_array&
*isfd->r = *r.rec(); *isfd->r = *r.rec();
if (excllock(CInsPref((char*) glockname, NORDIR), FALSE) == -1 && errno == EACCES) if (excllock(CInsPref((char*) glockname, NORDIR), FALSE) == -1 && errno == EACCES)
fatal_box("Can't reopen file n. %d : file in use", i + 1); fatal_box("Can't reopen file n. %d : file in use", i + 1);
isfd->fhnd = DB_open(isfd->d->SysName,excl[i]==_excllock); isfd->fhnd = DB_open(isfd->d->SysName, excl[i]);
if (isfd->fhnd < 0 ) err=get_error(isfd->fhnd); if (isfd->fhnd < 0 ) err=get_error(isfd->fhnd);
else err = NOERR; else err = NOERR;
if (err == _islocked) if (err == _islocked)
@ -212,7 +211,7 @@ void TPrefix::set(
// @flag COM | Apre il direttorio con i dati comuni // @flag COM | Apre il direttorio con i dati comuni
// @flag DEF | Riapre la ditta indicata nel file prefix.txt // @flag DEF | Riapre la ditta indicata nel file prefix.txt
// @flag codice ditta | Apre la ditta indicata // @flag codice ditta | Apre la ditta indicata
{ {
if (name == NULL) if (name == NULL)
{ {
CCloseDir(NORDIR); CCloseDir(NORDIR);

View File

@ -111,23 +111,6 @@ void TIndwin::update_bar()
const int width = r.right - r.left; const int width = r.right - r.left;
RCT b = r; RCT b = r;
set_pen(COLOR_BLACK);
/*
set_brush(COLOR_BLUE);
b.right = b.left + int(width*prc);
xvt_dwin_draw_rect(win(), &b);
set_brush(COLOR_WHITE);
b.left = b.right; b.right = r.right;
xvt_dwin_draw_rect(win(), &b);
set_mode(M_XOR);
xvt_dwin_set_fore_color(win(), COLOR_BLUE);
char n[8]; sprintf(n, "%d%%", int(100*prc));
xvt_dwin_draw_text(win(), r.left+width/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1);
set_mode(M_COPY);
*/
WINDOW w = win(); WINDOW w = win();
b.right = b.left + int(width*prc); b.right = b.left + int(width*prc);
@ -135,7 +118,7 @@ void TIndwin::update_bar()
set_brush(COLOR_WHITE); set_brush(COLOR_WHITE);
b.left = b.right; b.right = r.right; b.left = b.right; b.right = r.right;
xvt_dwin_draw_rect(w, &b); xi_draw_3d_rect(w, &b, TRUE, 2, 0, 0, 0);
char n[8]; sprintf(n, "%d%%", int(100*prc)); char n[8]; sprintf(n, "%d%%", int(100*prc));
xvt_dwin_draw_text(w, r.left+width/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1); xvt_dwin_draw_text(w, r.left+width/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1);

View File

@ -307,9 +307,8 @@ void TSheet_control::update(long n)
if (scroll_first) if (scroll_first)
xi_scroll(_obj, XI_SCROLL_FIRST); xi_scroll(_obj, XI_SCROLL_FIRST);
else else
xi_scroll(_obj, 0); xi_scroll(_obj, 0);
// xi_scroll_rec(_obj, n, FOCUS_COLOR, XI_ATR_ENABLED, 0);
} }
} }

View File

@ -2,24 +2,24 @@ BUTTON DLG_SAVEREC 10 2
BEGIN BEGIN
PROMPT -16 -1 "~Registra" PROMPT -16 -1 "~Registra"
MESSAGE EXIT,K_SAVE MESSAGE EXIT,K_SAVE
PICTURE 103 PICTURE BMP_SAVEREC
PICTURE 153 PICTURE BMP_SAVERECDN
END END
BUTTON DLG_NEWREC 10 2 BUTTON DLG_NEWREC 10 2
BEGIN BEGIN
PROMPT -26 -1 "~Nuovo" PROMPT -26 -1 "~Nuovo"
MESSAGE EXIT,K_INS MESSAGE EXIT,K_INS
PICTURE 105 PICTURE BMP_NEWREC
PICTURE 155 PICTURE BMP_NEWRECDN
END END
BUTTON DLG_DELREC 10 2 BUTTON DLG_DELREC 10 2
BEGIN BEGIN
PROMPT -36 -1 "~Elimina" PROMPT -36 -1 "~Elimina"
MESSAGE EXIT,K_DEL MESSAGE EXIT,K_DEL
PICTURE 104 PICTURE BMP_DELREC
PICTURE 154 PICTURE BMP_DELRECDN
END END
BUTTON DLG_FINDREC 10 2 BUTTON DLG_FINDREC 10 2
@ -40,7 +40,7 @@ BUTTON DLG_QUIT 10 2
BEGIN BEGIN
PROMPT -66 -1 "~Fine" PROMPT -66 -1 "~Fine"
MESSAGE EXIT,K_QUIT MESSAGE EXIT,K_QUIT
PICTURE 114 PICTURE BMP_QUIT
PICTURE 164 PICTURE BMP_QUITDN
END END

View File

@ -1,7 +1,7 @@
#include <lffiles.h>
#include <defmask.h>
#include <keys.h> #include <keys.h>
#include <lffiles.h>
#include <tokens.h> #include <tokens.h>
#include <urldefid.h>
#define FALSE 0 #define FALSE 0
#define TRUE 1 #define TRUE 1

View File

@ -27,6 +27,7 @@ BOOLEAN error_hook(XVT_ERRMSG err, DATA_PTR)
#define STRICT #define STRICT
#include <windows.h> #include <windows.h>
#include <ctl3d.h>
extern "C" { extern "C" {
WINDOW xvtwi_hwnd_to_window(HWND); WINDOW xvtwi_hwnd_to_window(HWND);
@ -110,18 +111,22 @@ static BOOLEAN event_hook(HWND hwnd,
long* ret) long* ret)
{ {
switch(msg) switch(msg)
{ {
case WM_SYSCOLORCHANGE:
Ctl3dColorChange();
break;
case WM_MENUCHAR: case WM_MENUCHAR:
if (wparam >= 'A' && wparam <= 'z') if (wparam >= 'A' && wparam <= 'z')
{ {
WINDOW w = cur_win(); WINDOW win = cur_win();
if (w != NULL_WIN) if (win != NULL_WIN)
{ {
TWindow* w = (TWindow*)xvt_vobj_get_data(win);
const KEY key = toupper(wparam)+K_CTRL; const KEY key = toupper(wparam)+K_CTRL;
dispatch_e_char(w, key); w->on_key(key);
} }
} }
break; break;
default: default:
if (msg == WM_WAKEUP && wparam == main_app().waiting()) if (msg == WM_WAKEUP && wparam == main_app().waiting())
main_app().wake_up(); main_app().wake_up();
@ -496,12 +501,20 @@ void customize_controls(
xvt_vobj_set_attr(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook); xvt_vobj_set_attr(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook);
xvt_vobj_set_attr(NULL_WIN,ATTR_ERRMSG_HANDLER, (long)error_hook); xvt_vobj_set_attr(NULL_WIN,ATTR_ERRMSG_HANDLER, (long)error_hook);
allow_another_instance(); allow_another_instance();
HINSTANCE hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
Ctl3dRegister(hInstance);
Ctl3dAutoSubclass(hInstance);
#endif #endif
customize_colors(); customize_colors();
init_controls(); init_controls();
} }
else else
{ {
#if XVT_OS == XVT_OS_WIN
HINSTANCE _hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
Ctl3dUnregister(_hInstance);
#endif
free_controls(); free_controls();
} }
} }