def __init__(self, lsysargv, sysargv): # application default. Can be overriden by the command line options xfl.fl_set_border_width(1) xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.pbwform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 380, 340) self.pbwgroup = xfl.fl_bgn_group() xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 380, 340, "") xfl.fl_add_frame(xfl.FL_EMBOSSED_FRAME, 220, 60, 135, 145, "") xfl.fl_add_frame(xfl.FL_ENGRAVED_FRAME, 15, 60, 185, 145, "") xfl.fl_add_slider(xfl.FL_HOR_SLIDER, 25, 70, 160, 20, "") xfl.fl_add_valslider(xfl.FL_HOR_BROWSER_SLIDER, 25, 105, \ 160, 20, "") self.pobj = xfl.fl_add_scrollbar(xfl.FL_HOR_THIN_SCROLLBAR, 25, 140, 160, 20, "") xfl.fl_set_scrollbar_size(self.pobj, 0.2) xfl.fl_add_counter(xfl.FL_NORMAL_COUNTER, 25, 175, \ 160, 20, "") self.ppmobj = xfl.fl_add_pixmapbutton(xfl.FL_NORMAL_BUTTON, \ 305, 145, 40, 35, "") xfl.fl_add_positioner(xfl.FL_NORMAL_POSITIONER, 30, 225, \ 100, 80, "") xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 230, 65, 100, 28, \ "Button") xfl.fl_add_lightbutton(xfl.FL_PUSH_BUTTON, 230, 98, 100, 28, \ "LightButton") xfl.fl_add_roundbutton(xfl.FL_PUSH_BUTTON, 230, 128, \ 80, 32, "Button") self.pobj = xfl.fl_add_round3dbutton(xfl.FL_PUSH_BUTTON, \ 230, 152, 80, 32, "Button") xfl.fl_set_object_color(self.pobj, xfl.FL_COL1, xfl.FL_BLUE) xfl.fl_add_checkbutton(xfl.FL_PUSH_BUTTON, 230, 175, \ 80, 32, "Button") xfl.fl_add_input(xfl.FL_NORMAL_INPUT, 195, 240, 160, 28, \ "Input") self.pbwselect = xfl.fl_add_select(xfl.FL_MENU_SELECT, 105, \ 20, 100, 28, "Border Width") xfl.fl_set_object_callback(self.pbwselect, self.bw_callback, 0) xfl.fl_end_group() self.pdoneobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 270, 290, \ 75, 30, "Done") xfl.fl_set_object_callback(self.pdoneobj, self.done_callback, 0) xfl.fl_end_form() # end create_form_bwform # form initialization code xfl.fl_set_pixmapbutton_file(self.ppmobj, "crab.xpm") xfl.fl_add_select_items(self.pbwselect, \ "-5 Pixel|-4 Pixel|-3 Pixel|-2 Pixel|-1 Pixel|" \ " 1 Pixel| 2 Pixel| 3 Pixel| 4 Pixel| 5 Pixel") pbw = xfl.fl_get_border_width() if (pbw < -5 or pbw == 0 or pbw > 5): pbw = -2 xfl.fl_set_border_width(pbw) txt = "%2d Pixel" % pbw ppupentr = xfl.fl_get_select_item_by_label(self.pbwselect, txt) xfl.fl_set_select_item(self.pbwselect, ppupentr) # show the form xfl.fl_show_form(self.pbwform, xfl.FL_PLACE_CENTER, \ xfl.FL_TRANSIENT, "bwform") while xfl.fl_do_forms(): pass # empty
def __init__(self, lsysargv, sysargv): self.pform = self.pexitob = self.pbtypeob = self.pmodeob = None c = xfl.FL_BLACK # char **p; # VN_struct *vn; # VN_struct *g = gmode, # *gs = g + sizeof gmode / sizeof *gmode; xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.create_form() sorceress_width, sorceress_height, sorceress_bits = xfl.fls_import_xbmdata_from_file("srs.xbm") xfl.fl_set_bitmap_data(tobj[2], sorceress_width, sorceress_height, sorceress_bits) xfl.fl_add_chart_value(tobj[3], 15, "Item 1", c) c += 1 xfl.fl_add_chart_value(tobj[3], 5, "Item 2", c) c += 1 xfl.fl_add_chart_value(tobj[3], -10, "Item 3", c) c += 1 xfl.fl_add_chart_value(tobj[3], 25, "Item 4", c) c += 1 xfl.fl_add_nmenu_items(tobj[14], "Item 1|Item 2|Item 3|Item 4|item 5") xfl.fl_add_select_items(tobj[15], "Item 1") xfl.fl_add_select_items(tobj[15], "Item 2") xfl.fl_add_select_items(tobj[15], "Item 3") xfl.fl_add_select_items(tobj[15], "Item 4") xfl.fl_add_select_items(tobj[15], "Item 5") xfl.fl_set_timer(tobj[16], 1000.0) # for ( p = browserlines; *p; p++ ) for p in browserlines: xfl.fl_add_browser_line(tobj[17], p) # for ( vn = btypes; vn->val >= 0; vn++ ) for vn in btypes: xfl.fl_add_select_items(self.pbtypeob, vn["name"]) # for ( i = 1; g < gs; g++, i++ ) for g in range(0, len(gmode)): pitem = xfl.fl_add_select_items(self.pmodeob, gmode[g]["name"]) if not xfl.fl_mode_capable(gmode[g]["val"], 0): xfl.fl_popup_entry_set_state(pitem, xfl.FL_POPUP_DISABLED) # xfl.fl_vmode not working?? xfl.fl_set_select_item( self.pmodeob, xfl.fl_get_select_item_by_value(self.pmodeob, xfl.fl_get_vclass()) ) # 5 xfl.fl_get_vclass())) #xfl.fl_vmode.value)) xfl.fl_set_select_item(self.pbtypeob, xfl.fl_get_select_item_by_value(self.pbtypeob, 1)) self.boxtype_cb(self.pbtypeob, 0) xfl.fl_show_form(self.pform, xfl.FL_PLACE_MOUSE, border, "Box types") while True: if xfl.fl_is_same_object(xfl.fl_do_forms(), self.pexitob): break xfl.fl_finish()