+ xpos += gi->width + ED_GADGET_DISTANCE; /* xpos of text count button */
+
+ if (j == 0)
+ {
+ id = counterbutton_info[i].gadget_id_text;
+ event_mask = GD_EVENT_TEXT_RETURN | GD_EVENT_TEXT_LEAVING;
+
+ gd_x = DOOR_GFX_PAGEX4 + ED_WIN_COUNT_XPOS;
+ gd_y = DOOR_GFX_PAGEY1 + ED_WIN_COUNT_YPOS;
+
+ gi = CreateGadget(GDI_CUSTOM_ID, id,
+ GDI_X, xpos,
+ GDI_Y, ypos,
+ GDI_TYPE, GD_TYPE_TEXTINPUT_NUMERIC,
+ GDI_NUMBER_VALUE, 0,
+ GDI_NUMBER_MIN, counterbutton_info[i].min_value,
+ GDI_NUMBER_MAX, counterbutton_info[i].max_value,
+ GDI_TEXT_SIZE, 3,
+ GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gd_pixmap, gd_x, gd_y,
+ GDI_DESIGN_BORDER, ED_BORDER_SIZE,
+ GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_ACTION, HandleCounterButtons,
+ GDI_END);
+
+ if (gi == NULL)
+ Error(ERR_EXIT, "cannot create gadget");
+
+ level_editor_gadget[id] = gi;
+ xpos += gi->width + ED_GADGET_DISTANCE; /* xpos of up count button */
+ }