applicat.cpp Aggiunto metodo pre_create per inizializzazioni di basso livello
golem.cpp Migliorata gestione degli hook agli handler di finestra msksheet.cpp Eliminati molti sfarfallamenti duante cambio focus relapp.cpp Corretta gestione messaggio ED sheet.cpp Corretto posizionamento iniziale su righe disabilitate xvtility.cpp Migliorata gestione dell'event hook. git-svn-id: svn://10.65.10.50/trunk@3328 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c495a28531
commit
4759abb8f4
@ -165,6 +165,7 @@ long XVT_CALLCONV1 TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
switch (ep->type)
|
||||
{
|
||||
case E_CREATE:
|
||||
_application->pre_create();
|
||||
customize_controls(TRUE);
|
||||
create_backdrop();
|
||||
#if defined(DBG) && XVT_OS == XVT_OS_SCOUNIX
|
||||
|
@ -75,6 +75,8 @@ protected:
|
||||
virtual bool use_files() const
|
||||
{ return TRUE; }
|
||||
|
||||
// @cmember Inizilizzazzioni di bassissimo livello
|
||||
virtual bool pre_create() { return TRUE; }
|
||||
// @cmember Crea la finestra principale
|
||||
virtual bool create();
|
||||
// @cmember Controlla il menu
|
||||
|
@ -322,7 +322,7 @@ HIDDEN BOOLEAN hook(HWND hwnd,
|
||||
}
|
||||
|
||||
TDDE::TDDE()
|
||||
: _server(0), _old_hook(NULL)
|
||||
: _server(0), _old_hook(-1)
|
||||
{
|
||||
CHECK(CUR_DDE == NULL, "Double DDE");
|
||||
CUR_DDE = this;
|
||||
@ -330,7 +330,8 @@ TDDE::TDDE()
|
||||
}
|
||||
|
||||
TDDE::~TDDE()
|
||||
{
|
||||
{
|
||||
do_events(); // Flush degli venti in coda prima di sganciare tutto
|
||||
terminate();
|
||||
_hwnd = 0;
|
||||
CUR_DDE = NULL;
|
||||
@ -338,7 +339,7 @@ TDDE::~TDDE()
|
||||
|
||||
bool TDDE::initiate(const char* app, const char* topic)
|
||||
{
|
||||
if (_old_hook == NULL)
|
||||
if (_old_hook == -1)
|
||||
{
|
||||
_old_hook = xvt_vobj_get_attr(NULL_WIN, ATTR_EVENT_HOOK);
|
||||
xvt_vobj_set_attr(NULL_WIN, ATTR_EVENT_HOOK, (long)hook);
|
||||
@ -396,7 +397,7 @@ bool TDDE::execute(const char* app, const char* topic, const char* cmd, const ch
|
||||
|
||||
bool TDDE::start_server()
|
||||
{
|
||||
if (_old_hook == NULL)
|
||||
if (_old_hook == -1)
|
||||
{
|
||||
_old_hook = xvt_vobj_get_attr(NULL_WIN, ATTR_EVENT_HOOK);
|
||||
xvt_vobj_set_attr(NULL_WIN, ATTR_EVENT_HOOK, (long)hook);
|
||||
@ -406,10 +407,10 @@ bool TDDE::start_server()
|
||||
|
||||
void TDDE::terminate()
|
||||
{
|
||||
if (_old_hook)
|
||||
if (_old_hook != -1)
|
||||
{
|
||||
xvt_vobj_set_attr(NULL_WIN, ATTR_EVENT_HOOK, _old_hook);
|
||||
_old_hook = NULL;
|
||||
_old_hook = -1;
|
||||
PostMessage((HWND)_server, (WPARAM)_hwnd, WM_DDE_TERMINATE, (LPARAM)0);
|
||||
_server = 0;
|
||||
}
|
||||
|
@ -499,10 +499,9 @@ void TSpreadsheet::update_rec(int rec)
|
||||
const int riga = rec2row(rec);
|
||||
if (riga >= 0)
|
||||
{
|
||||
const bool has_focus = rec == selected() &&
|
||||
mask().focus_field().dlg() == owner().dlg();
|
||||
if (has_focus)
|
||||
xi_set_focus(get_interface());
|
||||
const bool has_focus = rec == selected() && mask().focus_field().dlg() == owner().dlg();
|
||||
|
||||
// if (has_focus) xi_set_focus(get_interface());
|
||||
|
||||
XI_OBJ row;
|
||||
XI_MAKE_ROW(&row, _obj, riga);
|
||||
@ -514,6 +513,9 @@ void TSpreadsheet::update_rec(int rec)
|
||||
set_focus_cell(riga, _cur_col);
|
||||
}
|
||||
}
|
||||
|
||||
if (_needs_update == rec)
|
||||
_needs_update = -1;
|
||||
}
|
||||
|
||||
// Cerca una colonna abilitata a partire da colonna
|
||||
@ -551,7 +553,7 @@ int TSpreadsheet::find_enabled_column(int rec, int colonna, int direction) const
|
||||
// riga (da 0), colonna (0 = numero, 1 = prima cella, ...)
|
||||
void TSpreadsheet::set_focus_cell(int riga, int colonna)
|
||||
{
|
||||
xi_set_focus(get_interface());
|
||||
// xi_set_focus(get_interface());
|
||||
|
||||
const int rec = row2rec(riga);
|
||||
colonna = find_enabled_column(rec, colonna, +1);
|
||||
@ -937,22 +939,23 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
const KEY k = edit(_cur_rec);
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
update_rec(_cur_rec);
|
||||
// update_rec(_cur_rec);
|
||||
_row_dirty = TRUE;
|
||||
} else
|
||||
if (k == K_DEL)
|
||||
{
|
||||
_row_dirty = _cell_dirty = FALSE;
|
||||
|
||||
if (_cur_rec >= items())
|
||||
{
|
||||
_row_dirty = _cell_dirty = FALSE;
|
||||
_cur_rec = items()-1;
|
||||
_cur_row = 0; _cur_col = 1;
|
||||
}
|
||||
if (_cur_rec >= 0 && _cur_rec < items())
|
||||
set_focus_cell(_cur_row, _cur_col);
|
||||
}
|
||||
|
||||
if (_cur_rec >= items())
|
||||
{
|
||||
_row_dirty = _cell_dirty = FALSE;
|
||||
_cur_rec = items()-1;
|
||||
_cur_row = 0; _cur_col = 1;
|
||||
}
|
||||
if (_cur_rec >= 0 && _cur_rec < items())
|
||||
set_focus_cell(_cur_row, _cur_col);
|
||||
_check_enabled = TRUE;
|
||||
}
|
||||
break;
|
||||
@ -1107,8 +1110,9 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
{
|
||||
mask2str(_cur_rec);
|
||||
on_idle(); // Update immediately!
|
||||
}
|
||||
set_focus_cell(_cur_row, _cur_col);
|
||||
}
|
||||
else
|
||||
set_focus_cell(_cur_row, _cur_col);
|
||||
|
||||
_check_enabled = TRUE; // Re-enable checks
|
||||
}
|
||||
|
@ -129,16 +129,17 @@ bool TRelation_application::destroy()
|
||||
|
||||
void TRelation_application::set_fixed()
|
||||
{
|
||||
TString s;
|
||||
TToken_string s(256, '=');
|
||||
for (const char* f = _fixed.get(0); f && *f; f = _fixed.get())
|
||||
{
|
||||
s = f;
|
||||
const int u = s.find('=');
|
||||
const int id = atoi(s.left(u));
|
||||
const char* val = s.mid(u+1);
|
||||
if (*val)
|
||||
_mask->set(id, val);
|
||||
_mask->disable(id);
|
||||
const int id = s.get_int(0);
|
||||
s = s.get();
|
||||
if (s.not_empty())
|
||||
_mask->set(id, s);
|
||||
|
||||
if (_lnflag == 1)
|
||||
_mask->disable(id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -916,7 +917,7 @@ bool TRelation_application::filter()
|
||||
const int key = body.get_int();
|
||||
|
||||
_autoins_caller = msg->from();
|
||||
_lnflag = TRUE;
|
||||
_lnflag = 2;
|
||||
|
||||
TAssoc_array field_values;
|
||||
const char * s;
|
||||
@ -952,8 +953,18 @@ bool TRelation_application::filter()
|
||||
field_name << "[" << (from + 1);
|
||||
const TString * v = (const TString *) field_values.objptr(field_name);
|
||||
|
||||
TString val;
|
||||
if (v == NULL && to >= 0)
|
||||
{
|
||||
v = (const TString *)field_values.objptr(field->name());
|
||||
if (v)
|
||||
val = v->sub(from, to);
|
||||
}
|
||||
else
|
||||
val = *v;
|
||||
|
||||
if (v)
|
||||
_fixed.add(format("%d=%s", f.dlg(), (const char*)*v));
|
||||
_fixed.add(format("%d=%s", f.dlg(), (const char*)val));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -809,6 +809,16 @@ void TSheet::start_run()
|
||||
repos_buttons();
|
||||
|
||||
_sheet->update();
|
||||
|
||||
if (on)
|
||||
{
|
||||
long i = selected();
|
||||
if (i < 0 || i >= items())
|
||||
i = 0;
|
||||
if (row_disabled(i))
|
||||
for (i = 0; row_disabled(i); i++);
|
||||
post_select(i);
|
||||
}
|
||||
}
|
||||
|
||||
long TSheet::selected() const
|
||||
@ -1221,7 +1231,6 @@ bool TBrowse_sheet::on_key(KEY k)
|
||||
KEY TBrowse_sheet::run()
|
||||
{
|
||||
_cur_browse = this;
|
||||
|
||||
const KEY key = TCursor_sheet::run();
|
||||
_cur_browse = NULL;
|
||||
return key;
|
||||
|
@ -596,7 +596,10 @@ void customize_controls(
|
||||
if (on)
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
xvt_vobj_set_attr(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook);
|
||||
long old_hook = xvt_vobj_get_attr(NULL_WIN,ATTR_EVENT_HOOK);
|
||||
if (old_hook == 0)
|
||||
xvt_vobj_set_attr(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook);
|
||||
|
||||
xvt_vobj_set_attr(NULL_WIN,ATTR_ERRMSG_HANDLER, (long)error_hook);
|
||||
HInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user