# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1044088220 0 # Node ID f7911991c5df2f6c3841b2eb65b793c5d028e31d # Parent b9283fd56d6909d6735d7514f2d86f035a4c25f2 Show info about the scrollbar in a status text control. diff -r b9283fd56d69 -r f7911991c5df dwtest.c --- a/dwtest.c Sat Feb 01 08:12:56 2003 +0000 +++ b/dwtest.c Sat Feb 01 08:30:20 2003 +0000 @@ -20,6 +20,7 @@ notebookbox2, notebook, scrollbar, + status, stext, pagebox, textbox1, textbox2, @@ -148,6 +149,18 @@ return TRUE; } +/* Callback to handle user selection of the scrollbar position */ +void DWSIGNAL scrollbar_valuechanged(HWND hwnd, int value, void *data) +{ + if(data) + { + HWND stext = (HWND)data; + char tmpbuf[100]; + + sprintf(tmpbuf, "%d", value); + dw_window_set_text(stext, tmpbuf); + } +} void text_add(void) { int i,y,depth = dw_color_depth(); @@ -170,6 +183,9 @@ dw_scrollbar_set_range(scrollbar, 100, 50); dw_scrollbar_set_pos(scrollbar, 10); + status = dw_status_text_new("", 0); + dw_box_pack_start( pagebox, status, 100, 20, TRUE, FALSE, 1); + text1pm = dw_pixmap_new( textbox1, font_width*width1, font_height*rows, depth ); text2pm = dw_pixmap_new( textbox2, font_width*width2, font_height*rows, depth ); @@ -192,6 +208,7 @@ } dw_signal_connect(textbox1, "expose_event", DW_SIGNAL_FUNC(text_expose), text1pm); dw_signal_connect(textbox2, "expose_event", DW_SIGNAL_FUNC(text_expose), text2pm); + dw_signal_connect(scrollbar, "value_changed", DW_SIGNAL_FUNC(scrollbar_valuechanged), (void *)status); } /* Beep every second */