Intermec ck1 Guía De Referencia
Chapter 4 — SDK Components
218
CK1 SDK Programmer’s Reference Manual
otk_control_add_child (&contr1, OTK_WIDGET(&spin1));
otk_spin_refresh
(&spin1);
otk_widget_set_sensitive(OTK_WIDGET(&spin1),
enable_tog.value);
otk_range_set_change_callback (OTK_RANGE(&spin1), range_callback);
// set spin2
otk_spin_init
(&spin2);
otk_spin_set_typeflag (&spin2, 1); //VERTICAL_SPIN = 0,
HORIZONTAL_SPIN = 1
otk_spin_set_size (&spin2, 30, 50);
otk_spin_set_position (&spin2, 100, 0);
otk_spin_set_range(&spin2, 100, 0, 70);
otk_control_add_child (&contr1, OTK_WIDGET(&spin2));
otk_spin_refresh
(&spin2);
//otk_widget_set_visible(OTK_WIDGET(&spin2),
enable_tog.value);
otk_range_set_change_callback (OTK_RANGE(&spin2), range_callback);
//enable_tog
otk_toggle_button_init
(&enable_tog);
otk_button_set_label (OTK_BUTTON(&enable_tog), "Enable");
otk_widget_set_size (OTK_WIDGET(&enable_tog), 60, 15);
otk_widget_set_position(OTK_WIDGET(&enable_tog), 0, 0);
otk_widget_set_gc_background_color
(OTK_WIDGET(&enable_tog),
OTK_COL_WHITE);
otk_widget_set_gc_foreground_color
otk_widget_set_gc_foreground_color
(OTK_WIDGET(&enable_tog),
OTK_COL_BLACK);
otk_control_add_child (&contr1, OTK_WIDGET(&enable_tog));
otk_toggle_button_set_value(&enable_tog,
OTK_FALSE);
otk_button_set_click_callback(OTK_BUTTON(&enable_tog),
togglebutton_callback);
printf("RUN
togglebutton_callback);
printf("RUN
loop\n");
return otk_app_loop();
}
OTK_BOOL range_callback (OtkWidget* sb, int x, int y)
{
}
OTK_BOOL range_callback (OtkWidget* sb, int x, int y)
{
OtkRange* range = OTK_RANGE(sb);
printf("__________range value______%d_______\n", range->value);
return
OTK_TRUE;
}
OTK_BOOL togglebutton_callback (OtkWidget* enable_tog_btn, int x, int y)
{
OTK_BOOL togglebutton_callback (OtkWidget* enable_tog_btn, int x, int y)
{
OtkToggleButton* tp = OTK_TOGGLE_BUTTON(enable_tog_btn);
otk_widget_set_sensitive(OTK_WIDGET(&spin1),tp->value);
// otk_widget_set_visible(OTK_WIDGET(&spin2),tp->value);
// otk_widget_redraw
// otk_widget_set_visible(OTK_WIDGET(&spin2),tp->value);
// otk_widget_redraw
(OTK_WIDGET(&spin2));
return
OTK_TRUE;
}