Intermec ck1 Guía De Referencia

Descargar
Página de 390
Chapter 4 — SDK Components 
214 
CK1 SDK Programmer’s Reference Manual 
 
 
// set scrollbar2 
 otk_scrollbar2_init 
(&scrollbar2); 
 
otk_scrollbar2_set_typeflag (&scrollbar2, 1);  //VERTICAL_SCROLLBAR = 
0, HORIZONTAL_SCROLLBAR = 1 
 
otk_scrollbar2_set_size (&scrollbar2, 150, 30); 
 
otk_scrollbar2_set_position (&scrollbar2, 70, 0); 
 
otk_scrollbar2_set_range(&scrollbar2, 100, 0, 70); 
 otk_scrollbar2_set_step(&scrollbar2, 
10); 
 
otk_control_add_child (&contr1, OTK_WIDGET(&scrollbar2)); 
 otk_scrollbar2_refresh 
(&scrollbar2); 
 //otk_widget_set_visible(OTK_WIDGET(&scrollbar2), 
enable_tog.value); 
 
otk_range_set_change_callback (OTK_RANGE(&scrollbar2), 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(&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 
loop\n"); 
 return otk_app_loop(); 

 
 
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) 
{  
 
OtkToggleButton* tp = OTK_TOGGLE_BUTTON(enable_tog_btn); 
 
 
 otk_widget_set_sensitive(OTK_WIDGET(&scrollbar1),tp->value); 
// otk_widget_set_visible(OTK_WIDGET(&scrollbar2),tp->value); 
// otk_widget_redraw 
(OTK_WIDGET(&scrollbar2)); 
 
 return 
OTK_TRUE;