Corretta gestione listbox
git-svn-id: svn://10.65.10.50/trunk@2796 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
d15ddcf5f5
commit
74f2ab4b13
@ -1663,8 +1663,11 @@ bool TListbox_control::event_handler(XI_OBJ* itf, XI_EVENT* xiev)
|
||||
void TListbox_control::set_values(const char* val)
|
||||
{
|
||||
_values = val;
|
||||
_ddl->set_values(val);
|
||||
_ddl->select(selected(), TRUE);
|
||||
_ddl->set_values(val);
|
||||
if (selected() >= _values.items())
|
||||
_ddl->select(0, TRUE);
|
||||
else
|
||||
_ddl->select(selected(), TRUE);
|
||||
}
|
||||
|
||||
TListbox_control::TListbox_control(WINDOW win, short cid,
|
||||
|
@ -3326,7 +3326,8 @@ void TReal_field::exchange(bool show_value, const real& nuo)
|
||||
// List_field
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TList_field::TList_field(TMask* m) : TEditable_field(m)
|
||||
TList_field::TList_field(TMask* m)
|
||||
: TEditable_field(m), _size(0)
|
||||
{ }
|
||||
|
||||
word TList_field::class_id() const
|
||||
@ -3337,7 +3338,11 @@ void TList_field::read_item(TScanner& scanner)
|
||||
{
|
||||
TToken_string ts(scanner.string());
|
||||
_codes.add(ts.get());
|
||||
_values.add(ts.get());
|
||||
|
||||
const char* v = ts.get();
|
||||
_values.add(v);
|
||||
|
||||
CHECKS(strlen(v) <= (word)_ctl_data._width, "List item is too long:", v);
|
||||
|
||||
ts = "";
|
||||
while (scanner.popkey() == "ME")
|
||||
@ -3348,7 +3353,7 @@ void TList_field::read_item(TScanner& scanner)
|
||||
|
||||
void TList_field::parse_head(TScanner& scanner)
|
||||
{
|
||||
_ctl_data._size = _size = scanner.integer();
|
||||
_ctl_data._size = scanner.integer();
|
||||
_ctl_data._width = scanner.integer();
|
||||
if (_ctl_data._width == 0)
|
||||
_ctl_data._width = _ctl_data._size;
|
||||
@ -3451,25 +3456,38 @@ void TList_field::add_list()
|
||||
|
||||
const char* TList_field::win2raw(const char* data) const
|
||||
{
|
||||
if (*data == '\0') return data;
|
||||
// fool the compiler to keep const
|
||||
TToken_string& codes = ((TList_field*)this)->_codes;
|
||||
TToken_string& value = ((TList_field*)this)->_values;
|
||||
|
||||
int pos = value.get_pos(data);
|
||||
_ctl_data._park = data; // data puo' venire da una TToken_string::get
|
||||
int pos = value.get_pos(_ctl_data._park);
|
||||
if (pos < 0 && _ctl_data._park.blank())
|
||||
{
|
||||
_ctl_data._park = value.get(0);
|
||||
if (_ctl_data._park.blank())
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
CHECKS(pos >= 0, "Unknown listbox value:", data);
|
||||
return codes.get(pos);
|
||||
}
|
||||
|
||||
const char* TList_field::raw2win(const char* data) const
|
||||
{
|
||||
if (*data == '\0') return data;
|
||||
// fool the compiler to keep const
|
||||
TToken_string& codes = ((TList_field*)this)->_codes;
|
||||
TToken_string& value = ((TList_field*)this)->_values;
|
||||
|
||||
int pos = codes.get_pos(data);
|
||||
CHECKS(pos >= 0, "Unknown listbox code:", data);
|
||||
|
||||
_ctl_data._park = data; // data puo' venire da una TToken_string::get
|
||||
int pos = codes.get_pos(_ctl_data._park);
|
||||
if (pos < 0 && _ctl_data._park.blank())
|
||||
{
|
||||
_ctl_data._park = codes.get(0);
|
||||
if (_ctl_data._park.blank())
|
||||
pos = 0;
|
||||
}
|
||||
CHECKS(pos >= 0, "Unknown listbox code:", (const char*)_ctl_data._park);
|
||||
return value.get(pos);
|
||||
}
|
||||
|
||||
@ -3508,6 +3526,8 @@ void TList_field::create(WINDOW parent)
|
||||
const int len = create_prompt(parent, 0, 0);
|
||||
_ctl_data._x += len;
|
||||
|
||||
_size = _ctl_data._width;
|
||||
|
||||
_ctl = new TListbox_control(parent, _ctl_data._dlg,
|
||||
_ctl_data._x, _ctl_data._y,
|
||||
_ctl_data._width,
|
||||
@ -3761,7 +3781,7 @@ bool TZoom_field::on_key( KEY key )
|
||||
get_window_data();
|
||||
break;
|
||||
case K_F9:
|
||||
if (has_query())
|
||||
if (browse() != NULL)
|
||||
break;
|
||||
case K_F8:
|
||||
{
|
||||
|
@ -217,7 +217,7 @@ public:
|
||||
virtual bool has_check() const
|
||||
{ return FALSE;}
|
||||
// @cmember Controlla se il campo ha una richiesta
|
||||
virtual bool has_query() const
|
||||
virtual bool has_query_button() const
|
||||
{ return FALSE;}
|
||||
// @cmember Ritorna il campo corrispondente su record
|
||||
virtual const TFieldref* field() const
|
||||
@ -929,7 +929,7 @@ public:
|
||||
// @cmember Controlla se il campo ha un check
|
||||
virtual bool has_check() const;
|
||||
// @cmember Controlla se il campo ha una ricerca
|
||||
virtual bool has_query() const
|
||||
virtual bool has_query_button() const
|
||||
{ return _browse != NULL;}
|
||||
|
||||
// @cmember Ritorna TRUE se il campo e' di tipo edit
|
||||
@ -1156,6 +1156,10 @@ public:
|
||||
|
||||
// @cmember Ritorna la dimensione del buffer associato al campo
|
||||
virtual word size() const { return _size; }
|
||||
|
||||
// @cmember Esegue la ricerca. Torna il tasto che ha terminato la ricerca
|
||||
virtual bool has_query_button() const
|
||||
{ return TRUE; }
|
||||
|
||||
// @cmember Conversione da formato visuale a valore
|
||||
virtual const char* win2raw(const char* data) const;
|
||||
|
@ -277,11 +277,11 @@ TSpreadsheet::TSpreadsheet(
|
||||
f_width += v+1;
|
||||
}
|
||||
testa.cut(at);
|
||||
v = max(at, v+(f->has_query() ? 1 : 0));
|
||||
v = max(at, v+(f->has_query_button() ? 1 : 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
v = max(testa.len(), m+(f->has_query() ? 1 : 0));
|
||||
v = max(testa.len(), m+(f->has_query_button() ? 1 : 0));
|
||||
}
|
||||
if (v > 69)
|
||||
v = 69;
|
||||
@ -788,7 +788,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
if (cell_disabled(rec, col))
|
||||
xiev->v.cell_request.back_color = DISABLED_BACK_COLOR;
|
||||
else
|
||||
if (e->has_query() || e->is_kind_of(CLASS_LIST_FIELD))
|
||||
if (e->has_query_button())
|
||||
{
|
||||
xiev->v.cell_request.button = TRUE;
|
||||
xiev->v.cell_request.button_on_focus = TRUE;
|
||||
|
4386
include/printer.cpp
4386
include/printer.cpp
File diff suppressed because it is too large
Load Diff
1654
include/printer.h
1654
include/printer.h
File diff suppressed because it is too large
Load Diff
@ -1,276 +1,276 @@
|
||||
#include <defmask.h>
|
||||
#include <progind.h>
|
||||
#include <controls.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
const char* const TITLE_TEXT = "Attesa";
|
||||
|
||||
word TIndwin::measure_text(TToken_string& s, word& maxlen) const
|
||||
{
|
||||
word lines = 0;
|
||||
for(const char* t = s.get(0); t; t = s.get())
|
||||
{
|
||||
const word l = strlen(t);
|
||||
if (l > maxlen) maxlen = l;
|
||||
lines++;
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
// Certified 70%
|
||||
TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
: _text(NULL), _cancel(NULL), _bar(0),
|
||||
_status(0L), _max(max), _flags(0x0)
|
||||
{
|
||||
if (_max <= 0) _max = 1;
|
||||
|
||||
TToken_string testo(txt, '\n');
|
||||
word maxlen = div;
|
||||
const word lines = measure_text(testo, maxlen);
|
||||
|
||||
int ver = lines+2;
|
||||
|
||||
int hor = maxlen+2; if (hor > 78) hor = 78;
|
||||
|
||||
if (bar)
|
||||
{
|
||||
_bar = ver * CHARY;
|
||||
ver += 2;
|
||||
}
|
||||
ver += cancel ? 2 : 0;
|
||||
|
||||
set_win(create_interface(TASK_WIN, -1, -1, hor, ver, TITLE_TEXT, this, FALSE));
|
||||
|
||||
_text = new TMultiline_control(win(), DLG_NULL, 1, 1, hor-2, lines, 512, "CD", "");
|
||||
|
||||
testo.replace('\n', '\r');
|
||||
_text->set_caption(testo);
|
||||
|
||||
if (cancel)
|
||||
{
|
||||
_cancel = new TPushbutton_control(win(), DLG_CANCEL, -11, -1, 10, 2, "", "Annulla", BMP_CANCEL);
|
||||
}
|
||||
open_modal();
|
||||
do_events();
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Setta il testo della finestra
|
||||
void TIndwin::set_text(
|
||||
const char* t) // @parm Testo della finestra
|
||||
|
||||
// @comm Si puo' chiamare questa funzione per cambiare il testo, ma
|
||||
// le dimensioni della finestra sono calcolate sul primo testo
|
||||
// passato, quindi occorre dimensionare correttamente il primo passato
|
||||
// (es. inserire degli spazi) se se ne prevede uno piu' lungo.
|
||||
{
|
||||
_text->set_caption(t);
|
||||
}
|
||||
|
||||
TIndwin::~TIndwin()
|
||||
{
|
||||
close_modal();
|
||||
|
||||
if (_text) delete _text;
|
||||
if (_cancel) delete _cancel;
|
||||
}
|
||||
|
||||
bool TIndwin::can_be_closed() const
|
||||
{
|
||||
const bool ok = (_flags & IND_FINISHED) || (_flags & IND_CANCELLED);
|
||||
if (!ok) error_box("Attendere la fine dell'operazione prima di chiudere l'applicazione");
|
||||
return ok;
|
||||
}
|
||||
|
||||
KEY TIndwin::check_stop()
|
||||
{
|
||||
KEY k = 0;
|
||||
if ((_flags & IND_FINISHED) || (_flags & IND_CANCELLED))
|
||||
{
|
||||
k = (_flags & IND_FINISHED) ? K_ENTER : K_ESC;
|
||||
stop_run(k);
|
||||
}
|
||||
return k;
|
||||
}
|
||||
|
||||
void TIndwin::update_bar()
|
||||
{
|
||||
if (_status >= _max)
|
||||
{
|
||||
_status = _max;
|
||||
_flags |= IND_FINISHED;
|
||||
}
|
||||
|
||||
const double prc = (double)_status/_max;
|
||||
|
||||
RCT r; xvt_vobj_get_client_rect(win(), &r);
|
||||
r.left = CHARX; r.right -= CHARX;
|
||||
r.top = (int)_bar;
|
||||
r.bottom = r.top + 2*CHARY;
|
||||
|
||||
const int width = r.right - r.left;
|
||||
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();
|
||||
b.right = b.left + int(width*prc);
|
||||
xi_draw_3d_rect(w, &b, FALSE, 2, 0, 0, 0);
|
||||
|
||||
set_brush(COLOR_WHITE);
|
||||
b.left = b.right; b.right = r.right;
|
||||
xvt_dwin_draw_rect(w, &b);
|
||||
|
||||
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);
|
||||
|
||||
check_stop();
|
||||
}
|
||||
|
||||
void TIndwin::update()
|
||||
{
|
||||
if (_bar) update_bar();
|
||||
}
|
||||
|
||||
bool TIndwin::on_key(KEY k)
|
||||
{
|
||||
if (k == K_ESC && _cancel)
|
||||
{
|
||||
_flags |= IND_CANCELLED;
|
||||
check_stop();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TIndwin::on_button(short id)
|
||||
{
|
||||
if (id == DLG_CANCEL)
|
||||
on_key(K_ESC);
|
||||
}
|
||||
|
||||
|
||||
// TProgind --------------------------------------------------------------
|
||||
|
||||
TProgind::TProgind(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
: TIndwin(max, txt, cancel, bar, div)
|
||||
{}
|
||||
|
||||
// TTimerind ------------------------------------------------------------
|
||||
|
||||
long TTimerind::_timer_id = 0L;
|
||||
|
||||
void TTimerind::handler(WINDOW w, EVENT* e)
|
||||
{
|
||||
switch(e->type)
|
||||
{
|
||||
case E_CREATE:
|
||||
case E_UPDATE:
|
||||
if (_status == 0L)
|
||||
_timer_id = xvt_timer_create(w, _interval);
|
||||
break;
|
||||
case E_TIMER:
|
||||
if (e->v.timer.id == _timer_id)
|
||||
{
|
||||
_status += _interval;
|
||||
force_update();
|
||||
xvt_timer_create(w, _interval);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
TIndwin::handler(w,e);
|
||||
}
|
||||
|
||||
TTimerind::TTimerind(long msec, const char* txt,
|
||||
bool cancel, bool bar, int div, int i) :
|
||||
TIndwin(msec, txt, cancel, bar, div)
|
||||
{
|
||||
_interval = i;
|
||||
_timer_id = 0L;
|
||||
}
|
||||
|
||||
TTimerind::~TTimerind()
|
||||
{ xvt_timer_destroy(_timer_id); }
|
||||
|
||||
// C-style binding
|
||||
// uses static pointer for single instance of TIndwin
|
||||
|
||||
static TIndwin* __indwin__p = NULL;
|
||||
|
||||
void progind_create(long m, char* t, bool b, bool c, int n)
|
||||
{
|
||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||
__indwin__p = new TProgind(m,t,b,c,n);
|
||||
}
|
||||
|
||||
void progind_set_status(long l)
|
||||
{
|
||||
((TProgind*)__indwin__p)->setstatus(l);
|
||||
}
|
||||
|
||||
void progind_cancel()
|
||||
{
|
||||
__indwin__p->cancel();
|
||||
}
|
||||
|
||||
bool progind_iscancelled()
|
||||
{
|
||||
return __indwin__p->iscancelled();
|
||||
}
|
||||
|
||||
bool progind_isfinished()
|
||||
{
|
||||
return __indwin__p->isfinished();
|
||||
}
|
||||
|
||||
void progind_destroy()
|
||||
{
|
||||
delete __indwin__p;
|
||||
__indwin__p = NULL;
|
||||
}
|
||||
|
||||
void timerind_create(long l, char* title, bool bar, bool cancel,
|
||||
int divisions, int interval)
|
||||
{
|
||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||
__indwin__p = new TTimerind(l,title,bar,cancel,divisions,interval);
|
||||
}
|
||||
|
||||
void timerind_cancel()
|
||||
{
|
||||
__indwin__p->cancel();
|
||||
}
|
||||
|
||||
bool timerind_iscancelled()
|
||||
{
|
||||
return __indwin__p->iscancelled();
|
||||
}
|
||||
|
||||
bool timerind_isfinished()
|
||||
{
|
||||
return __indwin__p->isfinished();
|
||||
}
|
||||
|
||||
void timerind_destroy()
|
||||
{
|
||||
delete __indwin__p;
|
||||
__indwin__p = NULL;
|
||||
}
|
||||
|
||||
#include <defmask.h>
|
||||
#include <progind.h>
|
||||
#include <controls.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
const char* const TITLE_TEXT = "Attesa";
|
||||
|
||||
word TIndwin::measure_text(TToken_string& s, word& maxlen) const
|
||||
{
|
||||
word lines = 0;
|
||||
for(const char* t = s.get(0); t; t = s.get())
|
||||
{
|
||||
const word l = strlen(t);
|
||||
if (l > maxlen) maxlen = l;
|
||||
lines++;
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
// Certified 70%
|
||||
TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
: _text(NULL), _cancel(NULL), _bar(0),
|
||||
_status(0L), _max(max), _flags(0x0)
|
||||
{
|
||||
if (_max <= 0) _max = 1;
|
||||
|
||||
TToken_string testo(txt, '\n');
|
||||
word maxlen = div;
|
||||
const word lines = measure_text(testo, maxlen);
|
||||
|
||||
int ver = lines+2;
|
||||
|
||||
int hor = maxlen+2; if (hor > 78) hor = 78;
|
||||
|
||||
if (bar)
|
||||
{
|
||||
_bar = ver * CHARY;
|
||||
ver += 2;
|
||||
}
|
||||
ver += cancel ? 2 : 0;
|
||||
|
||||
set_win(create_interface(TASK_WIN, -1, -1, hor, ver, TITLE_TEXT, this, FALSE));
|
||||
|
||||
_text = new TMultiline_control(win(), DLG_NULL, 1, 1, hor-2, lines, 512, "CD", "");
|
||||
|
||||
testo.replace('\n', '\r');
|
||||
_text->set_caption(testo);
|
||||
|
||||
if (cancel)
|
||||
{
|
||||
_cancel = new TPushbutton_control(win(), DLG_CANCEL, -11, -1, 10, 2, "", "Annulla", BMP_CANCEL);
|
||||
}
|
||||
open_modal();
|
||||
do_events();
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Setta il testo della finestra
|
||||
void TIndwin::set_text(
|
||||
const char* t) // @parm Testo della finestra
|
||||
|
||||
// @comm Si puo' chiamare questa funzione per cambiare il testo, ma
|
||||
// le dimensioni della finestra sono calcolate sul primo testo
|
||||
// passato, quindi occorre dimensionare correttamente il primo passato
|
||||
// (es. inserire degli spazi) se se ne prevede uno piu' lungo.
|
||||
{
|
||||
_text->set_caption(t);
|
||||
}
|
||||
|
||||
TIndwin::~TIndwin()
|
||||
{
|
||||
close_modal();
|
||||
|
||||
if (_text) delete _text;
|
||||
if (_cancel) delete _cancel;
|
||||
}
|
||||
|
||||
bool TIndwin::can_be_closed() const
|
||||
{
|
||||
const bool ok = (_flags & IND_FINISHED) || (_flags & IND_CANCELLED);
|
||||
if (!ok) error_box("Attendere la fine dell'operazione prima di chiudere l'applicazione");
|
||||
return ok;
|
||||
}
|
||||
|
||||
KEY TIndwin::check_stop()
|
||||
{
|
||||
KEY k = 0;
|
||||
if ((_flags & IND_FINISHED) || (_flags & IND_CANCELLED))
|
||||
{
|
||||
k = (_flags & IND_FINISHED) ? K_ENTER : K_ESC;
|
||||
stop_run(k);
|
||||
}
|
||||
return k;
|
||||
}
|
||||
|
||||
void TIndwin::update_bar()
|
||||
{
|
||||
if (_status >= _max)
|
||||
{
|
||||
_status = _max;
|
||||
_flags |= IND_FINISHED;
|
||||
}
|
||||
|
||||
const double prc = (double)_status/_max;
|
||||
|
||||
RCT r; xvt_vobj_get_client_rect(win(), &r);
|
||||
r.left = CHARX; r.right -= CHARX;
|
||||
r.top = (int)_bar;
|
||||
r.bottom = r.top + 2*CHARY;
|
||||
|
||||
const int width = r.right - r.left;
|
||||
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();
|
||||
b.right = b.left + int(width*prc);
|
||||
xi_draw_3d_rect(w, &b, FALSE, 2, 0, 0, 0);
|
||||
|
||||
set_brush(COLOR_WHITE);
|
||||
b.left = b.right; b.right = r.right;
|
||||
xvt_dwin_draw_rect(w, &b);
|
||||
|
||||
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);
|
||||
|
||||
check_stop();
|
||||
}
|
||||
|
||||
void TIndwin::update()
|
||||
{
|
||||
if (_bar) update_bar();
|
||||
}
|
||||
|
||||
bool TIndwin::on_key(KEY k)
|
||||
{
|
||||
if (k == K_ESC && _cancel)
|
||||
{
|
||||
_flags |= IND_CANCELLED;
|
||||
check_stop();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TIndwin::on_button(short id)
|
||||
{
|
||||
if (id == DLG_CANCEL)
|
||||
on_key(K_ESC);
|
||||
}
|
||||
|
||||
|
||||
// TProgind --------------------------------------------------------------
|
||||
|
||||
TProgind::TProgind(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
: TIndwin(max, txt, cancel, bar, div)
|
||||
{}
|
||||
|
||||
// TTimerind ------------------------------------------------------------
|
||||
|
||||
long TTimerind::_timer_id = 0L;
|
||||
|
||||
void TTimerind::handler(WINDOW w, EVENT* e)
|
||||
{
|
||||
switch(e->type)
|
||||
{
|
||||
case E_CREATE:
|
||||
case E_UPDATE:
|
||||
if (_status == 0L)
|
||||
_timer_id = xvt_timer_create(w, _interval);
|
||||
break;
|
||||
case E_TIMER:
|
||||
if (e->v.timer.id == _timer_id)
|
||||
{
|
||||
_status += _interval;
|
||||
force_update();
|
||||
xvt_timer_create(w, _interval);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
TIndwin::handler(w,e);
|
||||
}
|
||||
|
||||
TTimerind::TTimerind(long msec, const char* txt,
|
||||
bool cancel, bool bar, int div, int i) :
|
||||
TIndwin(msec, txt, cancel, bar, div)
|
||||
{
|
||||
_interval = i;
|
||||
_timer_id = 0L;
|
||||
}
|
||||
|
||||
TTimerind::~TTimerind()
|
||||
{ xvt_timer_destroy(_timer_id); }
|
||||
|
||||
// C-style binding
|
||||
// uses static pointer for single instance of TIndwin
|
||||
|
||||
static TIndwin* __indwin__p = NULL;
|
||||
|
||||
void progind_create(long m, char* t, bool b, bool c, int n)
|
||||
{
|
||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||
__indwin__p = new TProgind(m,t,b,c,n);
|
||||
}
|
||||
|
||||
void progind_set_status(long l)
|
||||
{
|
||||
((TProgind*)__indwin__p)->setstatus(l);
|
||||
}
|
||||
|
||||
void progind_cancel()
|
||||
{
|
||||
__indwin__p->cancel();
|
||||
}
|
||||
|
||||
bool progind_iscancelled()
|
||||
{
|
||||
return __indwin__p->iscancelled();
|
||||
}
|
||||
|
||||
bool progind_isfinished()
|
||||
{
|
||||
return __indwin__p->isfinished();
|
||||
}
|
||||
|
||||
void progind_destroy()
|
||||
{
|
||||
delete __indwin__p;
|
||||
__indwin__p = NULL;
|
||||
}
|
||||
|
||||
void timerind_create(long l, char* title, bool bar, bool cancel,
|
||||
int divisions, int interval)
|
||||
{
|
||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||
__indwin__p = new TTimerind(l,title,bar,cancel,divisions,interval);
|
||||
}
|
||||
|
||||
void timerind_cancel()
|
||||
{
|
||||
__indwin__p->cancel();
|
||||
}
|
||||
|
||||
bool timerind_iscancelled()
|
||||
{
|
||||
return __indwin__p->iscancelled();
|
||||
}
|
||||
|
||||
bool timerind_isfinished()
|
||||
{
|
||||
return __indwin__p->isfinished();
|
||||
}
|
||||
|
||||
void timerind_destroy()
|
||||
{
|
||||
delete __indwin__p;
|
||||
__indwin__p = NULL;
|
||||
}
|
||||
|
||||
|
@ -153,8 +153,12 @@ void TRelation_application::enable_query()
|
||||
{
|
||||
if (c.in_key(1))
|
||||
c.enable(keyon);
|
||||
if (c.has_query())
|
||||
((TEdit_field&)c).enable_check(query);
|
||||
if (c.is_edit())
|
||||
{
|
||||
TEdit_field& e = (TEdit_field&)c;
|
||||
if (e.browse() != NULL)
|
||||
e.enable_check(query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user