changeset 206:f7911991c5df

Show info about the scrollbar in a status text control.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 01 Feb 2003 08:30:20 +0000
parents b9283fd56d69
children 767fca804cea
files dwtest.c
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 */