+ else if (gi->type & GD_TYPE_SELECTBOX)
+ {
+ int old_index = gi->selectbox.current_index;
+
+ /* if mouse moving inside activated selectbox, select value */
+ if (my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height)
+ gi->selectbox.current_index =
+ (my - gi->selectbox.y - gi->border.size) /
+ getFontWidth(gi->selectbox.font_type);
+
+ if (gi->selectbox.current_index < 0)
+ gi->selectbox.current_index = 0;
+ else if (gi->selectbox.current_index > gi->selectbox.num_values - 1)
+ gi->selectbox.current_index = gi->selectbox.num_values - 1;
+
+ if (gi->selectbox.current_index != old_index)
+ DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ }