def create_form_form0(self): fdui = FD_form0() fdui.form0 = xfl.fl_bgn_form(xfl.FL_NO_BOX, 321, 276) pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 321, 276, "") fdui.pobj[0] = xfl.fl_add_valslider(xfl.FL_HOR_SLIDER, 12, 55, \ 138, 22, "") xfl.fl_set_object_lalign(fdui.pobj[0], \ xfl.fl_to_inside_lalign(xfl.FL_ALIGN_BOTTOM)) xfl.fl_set_object_callback(fdui.pobj[0], self.return_cb, 0) xfl.fl_set_object_return(fdui.pobj[0], xfl.FL_RETURN_CHANGED) fdui.pobj[1] = xfl.fl_add_counter(xfl.FL_NORMAL_COUNTER, 12, 85, \ 138, 22, "") xfl.fl_set_object_lalign(fdui.pobj[1], \ xfl.fl_to_inside_lalign(xfl.FL_ALIGN_BOTTOM)) xfl.fl_set_object_callback(fdui.pobj[1], self.return_cb, 1) fdui.pobj[2] = xfl.fl_add_input(xfl.FL_NORMAL_INPUT, 12, 150, \ 138, 25, "") xfl.fl_set_object_callback(fdui.pobj[2], self.return_cb, 2) fdui.br = xfl.fl_add_browser(xfl.FL_NORMAL_BROWSER, 170, 55, \ 140, 160, "") fdui.pobj[3] = xfl.fl_add_input(xfl.FL_INT_INPUT, 12, 187, \ 138, 25, "") xfl.fl_set_object_lalign(fdui.pobj[3], \ xfl.fl_to_inside_lalign(xfl.FL_ALIGN_LEFT)) xfl.fl_set_object_callback(fdui.pobj[3], self.return_cb, 3) fdui.when = xfl.fl_add_select(xfl.FL_NORMAL_SELECT, 40, 12, \ 240, 27, "") xfl.fl_set_object_callback(fdui.when, self.when_cb, 0) pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 170, 239, \ 80, 25, "Done") pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 70, 239, \ 80, 25, "ResetLog") xfl.fl_set_object_callback(pobj, self.resetlog_cb, 0) xfl.fl_end_form() return fdui
def __init__(self, lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 130, 100) self.pbr = xfl.fl_add_browser(xfl.FL_NORMAL_BROWSER, 5, 5, 95, 90, \ "") pbut = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 105, 5, 20, 8, \ "Exit") pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 105, 75, 20, 8, \ "Load") xfl.fl_set_object_callback(pobj, self.load_file, 0) pobj = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 105, 60, 20, 8, \ "Small") xfl.fl_set_object_callback(pobj, self.set_size, xfl.FL_SMALL_SIZE) xfl.fl_call_object_callback(pobj) xfl.fl_set_button(pobj, 1) pobj = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 105, 50, 20, 8, \ "Normal") xfl.fl_set_object_callback(pobj, self.set_size, xfl.FL_NORMAL_SIZE) pobj = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 105, 40, 20, 8, \ "Large") xfl.fl_set_object_callback(pobj, self.set_size, xfl.FL_LARGE_SIZE) xfl.fl_end_form() xfl.fl_scale_form(pform, 4.0, 4.0) xfl.fl_adjust_form_size(pform) xfl.fl_clear_browser(self.pbr) xfl.fl_add_browser_line(self.pbr, "LOAD A FILE.") xfl.fl_show_form(pform, xfl.FL_PLACE_FREE, xfl.FL_FULLBORDER, \ "Browser") while True: pobj = xfl.fl_do_forms() if xfl.fl_is_same_object(pobj, pbut): break xfl.fl_hide_form(pform) xfl.fl_finish()
def create_form_timerform(self): fdui = FD_timerform() fdui.timerform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 290, 210) xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 290, 210, "") xfl.fl_add_frame(xfl.FL_UP_FRAME, 0, 0, 290, 94, "") xfl.fl_add_frame(xfl.FL_UP_FRAME, 0, 100, 330, 190, "") xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 100, 170, 80, 30, "Done") fdui.timer = xfl.fl_add_timer(xfl.FL_VALUE_TIMER, 20, 30, 180, 40, "Timer") xfl.fl_set_object_boxtype(fdui.timer, xfl.FL_UP_BOX) xfl.fl_set_object_lsize(fdui.timer, xfl.FL_MEDIUM_SIZE) xfl.fl_set_object_lalign(fdui.timer, xfl.FL_ALIGN_TOP) xfl.fl_set_object_lstyle(fdui.timer, xfl.FL_TIMES_STYLE) xfl.fl_set_object_callback(fdui.timer, self.expired, 0) pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 20, 120, 80, 30, "Suspend") xfl.fl_set_object_callback(pobj, self.suspend_resume, 0) pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 100, 120, 80, 30, "Resume") xfl.fl_set_object_callback(pobj, self.suspend_resume, 1) pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 180, 120, 80, 30, "Reset") xfl.fl_set_object_callback(pobj, self.reset, 0) fdui.down = xfl.fl_add_checkbutton(xfl.FL_RADIO_BUTTON, 210, 20, 70, 30, "Down") xfl.fl_set_object_shortcut(fdui.down, "D#D", 1) xfl.fl_set_object_callback(fdui.down, self.timer_direction, 0) fdui.down = xfl.fl_add_checkbutton(xfl.FL_RADIO_BUTTON, 210, 50, 70, 30, "Up") xfl.fl_set_object_shortcut(fdui.down, "U#U", 1) xfl.fl_set_object_callback(fdui.down, self.timer_direction, 1) xfl.fl_end_form() return fdui
def create_form_x(self): fdui = FD_x() fdui.x = xfl.fl_bgn_form(xfl.FL_FLAT_BOX, 170, 176) pobj = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 20, 10, 150, 50, \ "Click on the digits...\n(left or right button)") xfl.fl_set_object_lsize(pobj, xfl.FL_NORMAL_SIZE) fdui.c = xfl.fl_add_button(xfl.FL_TOUCH_BUTTON, 40, 65, 90, 40, "012345") xfl.fl_set_object_boxtype(fdui.c, xfl.FL_EMBOSSED_BOX ); xfl.fl_set_object_color(fdui.c, xfl.FL_YELLOW, xfl.FL_YELLOW ); xfl.fl_set_object_lstyle(fdui.c, \ xfl.FL_FIXED_STYLE | xfl.FL_EMBOSSED_STYLE) xfl.fl_set_object_lsize(fdui.c, xfl.FL_LARGE_SIZE ); xfl.fl_set_object_callback(fdui.c, self.ccb, 0) xfl.fl_set_button_mouse_buttons(fdui.c, 1 | 4 | 8 | 16) xfl.fl_set_object_helper(fdui.c, \ "May not look like a button but it's one...\n" \ "(Also try the scroll wheel if you have.)" ) pobj = xfl.fl_add_button(xfl.FL_RETURN_BUTTON, 50, 130, 70, 30, "Exit" ); xfl.fl_set_button_mouse_buttons(pobj, 1) xfl.fl_end_form() xfl.fl_adjust_form_size(fdui.x) return fdui
def __init__(self, lsysargv, sysargv): xfl.fl_set_border_width(-2) xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 350, 250) pobj = xfl.fl_add_pixmap(xfl.FL_NORMAL_PIXMAP, 60, 70, 100, 100, "") xfl.fl_set_object_boxtype(pobj, xfl.FL_DOWN_BOX) xfl.fl_set_pixmap_file(pobj, "porsche.xpm") ppos = xfl.fl_add_positioner(xfl.FL_OVERLAY_POSITIONER, 60, 70, \ 100, 100, "") xfl.fl_set_positioner_xbounds(ppos, 0, 1) xfl.fl_set_positioner_ybounds(ppos, 0, 1) xfl.fl_set_object_callback(ppos, self.positioner_cb, 0) self.pxval = xfl.fl_add_box(xfl.FL_DOWN_BOX, 230, 40, 100, 30, "") xfl.fl_set_object_color(self.pxval, xfl.FL_COL1, xfl.FL_COL1) self.pyval = xfl.fl_add_box(xfl.FL_DOWN_BOX, 230, 90, 100, 30, "") xfl.fl_set_object_color(self.pyval, xfl.FL_COL1, xfl.FL_COL1) xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 230, 200, 100, 30, \ "Exit") xfl.fl_end_form() xfl.fl_show_form(pform, xfl.FL_PLACE_CENTER, xfl.FL_TRANSIENT, \ "XOR Positioner") self.positioner_cb(ppos, 0) xfl.fl_do_forms() xfl.fl_hide_form(pform) xfl.fl_finish() sys.exit(0)
def create_form_buttonform(self): fdui = FD_buttonform() fdui.buttonform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 430, 210) pobj = xfl.fl_add_box(xfl.FL_FLAT_BOX, 0, 0, 430, 210, "") pobj1 = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 30, 151, 80, 30, "Button") xfl.fl_set_object_lalign(pobj1, xfl.FL_ALIGN_CENTER) pobj2 = xfl.fl_add_roundbutton(xfl.FL_PUSH_BUTTON, 40, 91, 100, 30, "RoundButton") pobj3 = xfl.fl_add_round3dbutton(xfl.FL_PUSH_BUTTON, 135, 151, 110, 30, "Round3DButton") xfl.fl_set_object_color(pobj3, xfl.FL_COL1, xfl.FL_BLUE) pobj4 = xfl.fl_add_checkbutton(xfl.FL_PUSH_BUTTON, 170, 111, 110, 30, "CheckButton") pobj4 = xfl.fl_add_lightbutton(xfl.FL_PUSH_BUTTON, 30, 31, 100, 30, "LightButton") pobj5 = xfl.fl_add_pixmapbutton(xfl.FL_NORMAL_BUTTON, 320, 36, 80, 80, "PixmapButton") xfl.fl_set_object_color(pobj5, xfl.FL_COL1, xfl.FL_YELLOW) xfl.fl_set_pixmapbutton_file(pobj5, "porsche.xpm") pobj6 = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 185, 26, 100, 30, "Button") xfl.fl_set_object_boxtype(pobj6, xfl.FL_ROUNDED3D_UPBOX) xfl.fl_set_object_lalign(pobj6, xfl.FL_ALIGN_CENTER) pobj7 = xfl.fl_add_lightbutton(xfl.FL_PUSH_BUTTON, 290, 146, 100, 30, "Button") xfl.fl_set_object_boxtype(pobj7, xfl.FL_EMBOSSED_BOX) pobj8 = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 175, 71, 60, 25, "Button") xfl.fl_set_object_boxtype(pobj8, xfl.FL_SHADOW_BOX) xfl.fl_set_object_color(pobj8, xfl.FL_COL1, xfl.FL_SLATEBLUE) xfl.fl_set_object_lalign(pobj8, xfl.FL_ALIGN_CENTER) xfl.fl_end_form() return fdui
def create_controlform(self): self.pcontrolform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 260, 230) xfl.fl_bgn_group() self.psquareobj = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 20, 150, \ 60, 60, "@square") xfl.fl_set_object_lcol(self.psquareobj, xfl.FL_YELLOW) xfl.fl_set_object_callback(self.psquareobj, self.select_object, 1) pobj = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 20, 90, 60, 60, \ "@circle") xfl.fl_set_object_lcol(pobj, xfl.FL_YELLOW) xfl.fl_set_object_callback(pobj, self.select_object, 2) pobj = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 20, 30, 60, 60, \ "@8>") xfl.fl_set_object_lcol(pobj, xfl.FL_YELLOW) xfl.fl_set_object_callback(pobj, self.select_object, 3) xfl.fl_end_group() self.pexitobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 160, 30, \ 80, 30, "Exit") pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 160, 180, 80, 30, \ "Clear") xfl.fl_set_object_callback(pobj, self.clearit, 0) self.psizeobj = xfl.fl_add_slider(xfl.FL_VERT_SLIDER, 100, 30, \ 40, 180, "size") xfl.fl_set_slider_bounds(self.psizeobj, 0.025, 1.0) xfl.fl_end_form()
def create_form_form0(self): fdui = FD_form0() fdui.form0 = xfl.fl_bgn_form(xfl.FL_NO_BOX, 320, 250) xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 320, 250, "") xfl.fl_add_frame(xfl.FL_ENGRAVED_FRAME, 200, 70, 95, 100, "") fdui.butt = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 20, 70, \ 170, 100, "A Button") fdui.enter = xfl.fl_add_checkbutton(xfl.FL_PUSH_BUTTON, 210, 70, \ 45, 30, "Enter") fdui.leave = xfl.fl_add_checkbutton(xfl.FL_PUSH_BUTTON, 210, 95, \ 40, 30, "Leave") fdui.push = xfl.fl_add_checkbutton(xfl.FL_PUSH_BUTTON, 210, 120, \ 50, 30, "Push") fdui.release = xfl.fl_add_checkbutton(xfl.FL_PUSH_BUTTON, 210, 140, \ 60, 30, "Release") pobj = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 55, 15, 220, 30, \ "Pre-emptive Handler") xfl.fl_set_object_lsize(pobj, xfl.FL_MEDIUM_SIZE) xfl.fl_set_object_lalign(pobj, xfl.FL_ALIGN_CENTER) xfl.fl_set_object_lstyle(pobj, xfl.FL_BOLD_STYLE) fdui.peek = xfl.fl_add_checkbutton(xfl.FL_RADIO_BUTTON, 150, 40, \ 35, 30, "Peek") xfl.fl_set_object_color(fdui.peek, xfl.FL_COL1, xfl.FL_BLUE) fdui.override = xfl.fl_add_checkbutton(xfl.FL_RADIO_BUTTON, \ 210, 40, 35, 30, "Override") xfl.fl_set_object_color(fdui.override, xfl.FL_COL1, xfl.FL_BLUE) fdui.event = xfl.fl_add_box(xfl.FL_FLAT_BOX, 40, 180, 245, 25, "") fdui.done = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 170, 210, \ 100, 30, "Done") xfl.fl_end_form() return fdui
def makeforms(self): self.pform1 = xfl.fl_bgn_form(xfl.FL_UP_BOX, 400, 400) pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 140, 160, \ 120, 80, "Push Me") xfl.fl_set_object_callback(pobj, self.done_cb, 0) self.ptim = xfl.fl_add_timer(xfl.FL_VALUE_TIMER, 200, 40, \ 90, 50, "Time Left") xfl.fl_set_object_callback(self.ptim, self.timer1_expired, 0) xfl.fl_set_object_lcol(self.ptim, xfl.FL_BLACK) xfl.fl_end_form() self.pform2 = xfl.fl_bgn_form(xfl.FL_UP_BOX, 320, 120) xfl.fl_add_box(xfl.FL_NO_BOX, 160, 40, 0, 0, "You were too late") pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 100, 70, 120, 30, \ "Try Again") xfl.fl_set_object_callback(pobj, self.continue_cb, 0) self.ptim2 = xfl.fl_add_timer(xfl.FL_HIDDEN_TIMER, 0, 0, 1, 2, "") xfl.fl_set_object_callback(self.ptim2, self.continue_cb, 0) xfl.fl_end_form()
def create_form_canvasform(self): fdui = FD_canvasform() fdui.canvasform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 450, 280) xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 450, 280, "") fdui.canvas = xfl.fl_add_canvas(xfl.FL_NORMAL_CANVAS, 20, 40, \ 155, 187, "") xfl.fl_set_object_color(fdui.canvas, xfl.FL_BLACK, xfl.FL_COL1) fdui.br = xfl.fl_add_browser(xfl.FL_NORMAL_BROWSER, 188, 40, \ 152, 187, "") pobj = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 103, 10, 150, 20, \ "Canvas Events") xfl.fl_set_object_lsize(pobj, xfl.FL_MEDIUM_SIZE) xfl.fl_set_object_lalign(pobj, xfl.FL_ALIGN_CENTER) xfl.fl_set_object_lstyle(pobj, xfl.FL_BOLD_STYLE) fdui.keyboard = xfl.fl_add_checkbutton(xfl.FL_PUSH_BUTTON, 345, 40, \ 76, 26, "Keyboard") xfl.fl_set_object_color(fdui.keyboard, xfl.FL_COL1, xfl.FL_BLUE) xfl.fl_set_object_callback(fdui.keyboard, self.sensitive_setting, \ xfl.KeyPress) fdui.mouse = xfl.fl_add_checkbutton(xfl.FL_PUSH_BUTTON, 345, 70, 76, 26, \ "Buttons") xfl.fl_set_object_color(fdui.mouse, xfl.FL_COL1, xfl.FL_BLUE) xfl.fl_set_object_callback(fdui.mouse, self.sensitive_setting, \ xfl.ButtonPress) fdui.move = xfl.fl_add_checkbutton(xfl.FL_PUSH_BUTTON, 345, 100, 74, 26, \ "Movements") xfl.fl_set_object_color(fdui.move, xfl.FL_COL1, xfl.FL_BLUE) xfl.fl_set_object_callback(fdui.move, self.sensitive_setting, \ xfl.MotionNotify) fdui.misc = xfl.fl_add_checkbutton(xfl.FL_PUSH_BUTTON, 345, 130, \ 74, 26, "Enter\nLeave") xfl.fl_set_object_color(fdui.misc, xfl.FL_COL1, xfl.FL_BLUE) xfl.fl_set_object_callback(fdui.misc, self.sensitive_setting, \ xfl.EnterNotify) pobj = xfl.fl_add_button(xfl.FL_PUSH_BUTTON, 30, 240, 90, 27, "Deactivate") xfl.fl_set_object_callback(pobj, self.disable_it, 0) pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 130, 240, 90, 27, \ "Hide canvas") xfl.fl_set_object_callback(pobj, self.hide_it, 0) pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 230, 240, 90, 27, "Clear") xfl.fl_set_object_callback(pobj, self.clear_list, 0) xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 330, 240, 90, 27, "Done") xfl.fl_end_form() return fdui
def main(lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) psimpleform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 230, 160) xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 40, 50, 150, 60, "Push Me") xfl.fl_end_form() xfl.fl_show_form(psimpleform, xfl.FL_PLACE_MOUSE, \ xfl.FL_NOBORDER, "PushMe") xfl.fl_do_forms() xfl.fl_hide_form(psimpleform) return 0
def create_form_form0(self): fdui = FD_form0() fdui.form0 = xfl.fl_bgn_form(xfl.FL_NO_BOX, 351, 180) pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 351, 180, "") if not TEST_PIXMAP_ALIGN: fdui.box = xfl.fl_add_box(xfl.FL_UP_BOX, 190, 40, 90, 55, "This is\na label") else: fdui.box = xfl.fl_add_pixmap(xfl.FL_NORMAL_PIXMAP, 190, 35, \ 90, 60, "") xfl.fl_set_pixmap_file(fdui.box, "crab.xpm") xfl.fl_set_object_boxtype(fdui.box, xfl.FL_UP_BOX) fdui.inside = xfl.fl_add_lightbutton(xfl.FL_PUSH_BUTTON, 20, 125, \ 90, 30, "Inside") xfl.fl_set_button(fdui.inside, 1) xfl.fl_set_object_callback(fdui.inside, self.inside_cb, 0) xfl.fl_bgn_group() pobj = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 20, 20, 30, 30, "@#7->") xfl.fl_set_object_lcol(pobj, xfl.FL_BLUE) xfl.fl_set_object_callback(pobj, self.align_cb, xfl.FL_ALIGN_LEFT_TOP) pobj = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 50, 20, 30, 30, "@#8->") xfl.fl_set_object_lcol(pobj, xfl.FL_BLUE) xfl.fl_set_object_callback(pobj, self.align_cb, xfl.FL_ALIGN_TOP) pobj = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 80, 20, 30, 30, "@#9->") xfl.fl_set_object_lcol(pobj, xfl.FL_BLUE) xfl.fl_set_object_callback(pobj, self.align_cb, \ xfl.FL_ALIGN_RIGHT_TOP) pobj = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 80, 50, 30, 30, "@#->") xfl.fl_set_object_lcol(pobj, xfl.FL_BLUE) xfl.fl_set_object_callback(pobj, self.align_cb, xfl.FL_ALIGN_RIGHT) fdui.center_ = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 50, 50, 30, 30, "@circle") xfl.fl_set_object_lcol(fdui.center_, xfl.FL_RED) xfl.fl_set_object_callback(fdui.center_, self.align_cb, \ xfl.FL_ALIGN_CENTER) pobj = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 20, 50, 30, 30, "@#<-") xfl.fl_set_object_lcol(pobj, xfl.FL_BLUE) xfl.fl_set_object_callback(pobj, self.align_cb, xfl.FL_ALIGN_LEFT) pobj = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 20, 80, 30, 30, "@#1->") xfl.fl_set_object_lcol(pobj, xfl.FL_BLUE) xfl.fl_set_object_callback(pobj, self.align_cb, \ xfl.FL_ALIGN_LEFT_BOTTOM) pobj = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 50, 80, 30, 30, "@#2->") xfl.fl_set_object_lcol(pobj, xfl.FL_BLUE) xfl.fl_set_object_callback(pobj, self.align_cb, xfl.FL_ALIGN_BOTTOM) pobj = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 80, 80, 30, 30, "@#3->") xfl.fl_set_object_lcol(pobj, xfl.FL_BLUE) xfl.fl_set_object_callback(pobj, self.align_cb, \ xfl.FL_ALIGN_RIGHT_BOTTOM) xfl.fl_end_group() pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 200, 135, 70, 30, \ "Done") xfl.fl_end_form() return fdui
def create_form_form(self): fdui = FD_form() fdui.form = xfl.fl_bgn_form(xfl.FL_NO_BOX, 320, 130) pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 320, 130, "") pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 210, 80, 90, 35, "Done") xfl.fl_set_object_callback(pobj, self.exit_cb, 0) fdui.restart = xfl.fl_add_button(xfl.FL_TOUCH_BUTTON, 110, 80, \ 90, 35, "Restart") xfl.fl_set_object_callback(fdui.restart, self.start_timer, 0) fdui.report = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 10, 20, 290, 50,"") xfl.fl_end_form() return fdui
def create_form_form(): fdui = FD_form() fdui.pform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 470, 370) pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 470, 370, "") pobj = xfl.fl_add_box(xfl.FL_SHADOW_BOX, 30, 30, 410, 70, "Scaling Forms") xfl.fl_set_object_color(pobj, xfl.FL_INDIANRED, xfl.FL_CORNSILK) xfl.fl_set_object_lsize(pobj, 16) fdui.psmallerobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 30, 220, 130, 40, "Smaller") fdui.plargerobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 310, 220, 130, 40, "Larger") fdui.pscaleobj = xfl.fl_add_input(xfl.FL_FLOAT_INPUT, 170, 140, 270, 40, "Scale:") fdui.pexitobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 310, 300, 130, 40, "Exit") xfl.fl_end_form() return fdui
def main(lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", 0, 0 ) pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 200, 200) pobj = xfl.fl_add_bitmap(xfl.FL_NORMAL_BITMAP, 50, 50, 100, 100, \ "A bitmap") xfl.fl_set_object_lcol(pobj, xfl.FL_BLUE) xfl.fl_add_button(xfl.FL_HIDDEN_BUTTON, 50, 50, 100, 100, "") xfl.fl_end_form() xfl.fl_set_bitmap_data(pobj, xbmwidth, xbmheight, bitmapcontents) xfl.fl_show_form(pform, xfl.FL_PLACE_MOUSE, xfl.FL_NOBORDER, "X Bitmap") xfl.fl_do_forms() xfl.fl_hide_form(pform) xfl.fl_finish() return 0
def __init__(self, lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) pform = xfl.fl_bgn_form(xfl.FL_DOWN_BOX, 400, 200) self.pbut = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 10, 60, \ 70, 35, "Exit") # 140 160 xfl.fl_set_object_resize(self.pbut, xfl.FL_RESIZE_NONE) pobj = xfl.fl_add_button(xfl.FL_TOUCH_BUTTON, 330, 150, 50, 30, "Move") xfl.fl_set_object_resize(pobj, xfl.FL_RESIZE_NONE) xfl.fl_set_object_gravity(pobj, xfl.FL_SouthEast, xfl.FL_SouthEast ) xfl.fl_set_object_callback(pobj, self.move_cb, 0) # but xfl.fl_end_form() xfl.fl_show_form(pform, xfl.FL_PLACE_MOUSE | xfl.FL_FREE_SIZE, \ xfl.FL_FULLBORDER, "ObjPos") xfl.fl_do_forms()
def makeform(self): self.pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 400, 400) for i in range(0, 8): pobj = xfl.fl_add_button(xfl.FL_PUSH_BUTTON, 40, 310 - 40 * i, \ 80, 30, "") xfl.fl_set_object_color(pobj, xfl.FL_BLACK + i + 1, \ xfl.FL_BLACK + i + 1) xfl.fl_set_object_callback(pobj, self.push_cb, i) self.pabox[i] = xfl.fl_add_box(xfl.FL_DOWN_BOX, 150 + 30 * i, \ 40, 25, 320, "") xfl.fl_set_object_color(self.pabox[i], xfl.FL_BLACK + i + 1, \ xfl.FL_BLACK + i + 1) xfl.fl_hide_object(self.pabox[i]) xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 40, 350, 80, 30, "Exit") xfl.fl_end_form()
def make_form1(self): self.pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 500, 400) xfl.fl_bgn_group() pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 150, 295, 300, 65, "Children ") xfl.fl_set_object_lalign(pobj, xfl.FL_ALIGN_LEFT) xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 175, 310, 50, 35, "1") xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 241, 310, 50, 35, "2") xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 308, 310, 50, 35, "3") xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 375, 310, 50, 35, "4") xfl.fl_end_group() xfl.fl_bgn_group() pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 150, 230, 300, 65, "Married ") xfl.fl_set_object_lalign(pobj, xfl.FL_ALIGN_LEFT) xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 175, 245, 100, 35, "Yes") xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 325, 245, 100, 35, "No") xfl.fl_end_group() xfl.fl_bgn_group() pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 150, 165, 300, 65, "Sex ") xfl.fl_set_object_lalign(pobj, xfl.FL_ALIGN_LEFT) xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 175, 180, 100, 35, "Male") xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 325, 180, 100, 35, \ "Female") xfl.fl_end_group() xfl.fl_add_input(xfl.FL_NORMAL_INPUT, 150, 30, 300, 30, "Name ") xfl.fl_add_input(xfl.FL_NORMAL_INPUT, 150, 75, 300, 30, "Address ") xfl.fl_add_input(xfl.FL_NORMAL_INPUT, 150, 120, 300, 30, "City ") self.pbut = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 25, 360, \ 75, 30, "OK") xfl.fl_end_form()
def create_forms(self): self.sample = xfl.fl_bgn_form(xfl.FL_NO_BOX, 320, 250) self.ptrflobj0 = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 320, 250, '') xfl.fl_set_object_color(self.ptrflobj0, xfl.FL_COL1, xfl.FL_COL1) xfl.fl_set_object_lalign(self.ptrflobj0, xfl.FL_ALIGN_CENTER) xfl.fl_set_object_lstyle(self.ptrflobj0, xfl.FL_NORMAL_STYLE) xfl.fl_set_object_lsize(self.ptrflobj0, xfl.FL_DEFAULT_SIZE) xfl.fl_set_object_lcol(self.ptrflobj0, xfl.FL_BLACK) xfl.fl_set_object_resize(self.ptrflobj0, xfl.FL_RESIZE_ALL) xfl.fl_set_object_gravity(self.ptrflobj0, xfl.FL_NoGravity, xfl.FL_NoGravity) self.mynormalbutton = xfl.fl_add_button(xfl.FL_TOUCH_BUTTON, 60, 30, 170, 50, 'button') xfl.fl_set_object_boxtype(self.mynormalbutton, xfl.FL_UP_BOX) xfl.fl_set_button_mouse_buttons(self.mynormalbutton, 30) xfl.fl_set_object_color(self.mynormalbutton, xfl.FL_COL1, xfl.FL_COL1) xfl.fl_set_object_lalign(self.mynormalbutton, xfl.FL_ALIGN_CENTER) xfl.fl_set_object_lstyle(self.mynormalbutton, xfl.FL_NORMAL_STYLE) xfl.fl_set_object_lsize(self.mynormalbutton, xfl.FL_DEFAULT_SIZE) xfl.fl_set_object_lcol(self.mynormalbutton, xfl.FL_BLACK) xfl.fl_set_object_resize(self.mynormalbutton, xfl.FL_RESIZE_ALL) xfl.fl_set_object_gravity(self.mynormalbutton, xfl.FL_NoGravity, xfl.FL_NoGravity) xfl.fl_set_object_shortcut(self.mynormalbutton, 'o', 1) xfl.fl_set_object_callback(self.mynormalbutton, self.buttoncb, 1001) xfl.fl_set_object_return(self.mynormalbutton, xfl.FL_RETURN_CHANGED) xfl.fl_end_form()
def create_form_0(self): self.pform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 400, 470) pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 400, 470, "") xfl.fl_set_object_color(pobj, xfl.FL_SLATEBLUE, xfl.FL_COL1) pobj = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 140, 40, 120, 120, "This is\na multi-line\nlabelT") xfl.fl_set_object_boxtype(pobj, xfl.FL_BORDER_BOX) xfl.fl_set_object_lalign(pobj, xfl.FL_ALIGN_TOP) pobj = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 140, 160, 120, 120, "This is\na multi-line\nlabelC") xfl.fl_set_object_boxtype(pobj, xfl.FL_BORDER_BOX) xfl.fl_set_object_color(pobj, xfl.FL_PALEGREEN, xfl.FL_COL1) xfl.fl_set_object_lsize(pobj, xfl.FL_LARGE_SIZE) xfl.fl_set_object_lalign(pobj, xfl.FL_ALIGN_CENTER) self.preadyobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 280, 400, \ 100, 50, "I am sure\nthat I am\nReady") xfl.fl_set_object_lsize(self.preadyobj, xfl.FL_SMALL_SIZE) pobj = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 260, 160, 120, 120, "This is\na multi-line\nlabelR") xfl.fl_set_object_boxtype(pobj, xfl.FL_BORDER_BOX) xfl.fl_set_object_lalign(pobj, xfl.FL_ALIGN_RIGHT) pobj = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 140, 280, 120, 120, "This is\na multi-line\nlabelB") xfl.fl_set_object_boxtype(pobj, xfl.FL_BORDER_BOX) xfl.fl_set_object_lalign(pobj, xfl.FL_ALIGN_BOTTOM) pobj = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 20, 160, 120, 120, "This is\na multi-line\nlabelL") xfl.fl_set_object_boxtype(pobj, xfl.FL_BORDER_BOX) xfl.fl_end_form()
def makeform(self): self.pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 300, 330) self.pbutton = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 45, 15, \ 210, 45, "A Color Editor") xfl.fl_set_object_lsize(self.pbutton, xfl.FL_LARGE_SIZE) #xfl.fl_set_object_callback(self.pbutton, self.exit_cb, 0) self.pred = xfl.fl_add_dial(xfl.FL_FILL_DIAL, 30, 240, 60, 60, "Red") xfl.fl_set_dial_bounds(self.pred, 0.0, 255.0) xfl.fl_set_dial_value(self.pred, 128.0) xfl.fl_set_object_color(self.pred, xfl.FL_DIAL_COL1, xfl.FL_RED) xfl.fl_set_object_return(self.pred, xfl.FL_RETURN_CHANGED) self.predtext = xfl.fl_add_box(xfl.FL_DOWN_BOX, 105, 255, 50, 25, \ "") self.pgreen = xfl.fl_add_dial(xfl.FL_FILL_DIAL, 30, 155, 60, 60, \ "Green") xfl.fl_set_dial_bounds(self.pgreen, 0.0, 255.0) xfl.fl_set_dial_value(self.pgreen, 128.0) xfl.fl_set_dial_angles(self.pgreen, 45.0, 360 - 45.0) xfl.fl_set_object_color(self.pgreen, xfl.FL_DIAL_COL1, xfl.FL_GREEN) xfl.fl_set_object_return(self.pgreen, xfl.FL_RETURN_CHANGED) self.pgreentext = xfl.fl_add_box(xfl.FL_DOWN_BOX, 105, 170, 50, \ 25, "") self.pblue = xfl.fl_add_dial(xfl.FL_FILL_DIAL, 30, 70, 60, 60, \ "Blue") xfl.fl_set_dial_bounds(self.pblue, 0.0, 255.0) xfl.fl_set_dial_value(self.pblue, 128.0) xfl.fl_set_object_color(self.pblue, xfl.FL_DIAL_COL1, xfl.FL_BLUE) xfl.fl_set_dial_direction(self.pblue, xfl.FL_DIAL_CCW) xfl.fl_set_object_return(self.pblue, xfl.FL_RETURN_CHANGED) self.pbluetext = xfl.fl_add_box(xfl.FL_DOWN_BOX, 105, 90, 50, 25, "") self.presult = xfl.fl_add_box(xfl.FL_DOWN_BOX, 180, 70, 90, 245, "") xfl.fl_set_object_color(self.presult, xfl.FL_FREE_COL1, \ xfl.FL_FREE_COL1) xfl.fl_set_object_dblbuffer(self.presult, 1) xfl.fl_end_form()
def create_form(self): self.pform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 420, 360) xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 420, 360, "") xfl.fl_add_input(xfl.FL_NORMAL_INPUT, 70, 300, 320, 30, "Name") xfl.fl_add_input(xfl.FL_NORMAL_INPUT, 70, 260, 320, 30, "Address") xfl.fl_add_input(xfl.FL_NORMAL_INPUT, 70, 220, 320, 30, "City") xfl.fl_add_input(xfl.FL_NORMAL_INPUT, 70, 180, 320, 30, "Country") psexobj = xfl.fl_add_select(xfl.FL_NORMAL_SELECT, 70, 130, \ 110, 30, "Sex") pmaleent = xfl.fl_add_select_items(psexobj, "Male%SM") xfl.fl_popup_entry_set_callback(pmaleent, self.cb) xfl.fl_popup_entry_set_state(pmaleent, xfl.FL_POPUP_NONE) # 0 xfl.fl_popup_entry_set_shortcut(pmaleent, "M") pfemaleent = xfl.fl_add_select_items(psexobj, "Female%SF") xfl.fl_popup_entry_set_callback(pfemaleent, self.cb) xfl.fl_popup_entry_set_state(pfemaleent, xfl.FL_POPUP_NONE) # 0 xfl.fl_popup_entry_set_shortcut(pfemaleent, "F") xfl.fl_set_object_shortcut(psexobj, "S", 1) pchildobj = xfl.fl_add_select(xfl.FL_MENU_SELECT, 280, 130, 110, 30, \ "Children") xfl.fl_add_select_items(pchildobj, "Zero|One|Two|Three|Four|Many") xfl.fl_set_object_shortcut(pchildobj, "C", 1) xfl.fl_popup_set_title(xfl.fl_get_select_popup(pchildobj), "Kids") plicenceobj = xfl.fl_add_select(xfl.FL_NORMAL_SELECT, 280, 80, \ 110, 30, "Licence") xfl.fl_add_select_items(plicenceobj, "Yes|No") xfl.fl_set_select_policy(plicenceobj, xfl.FL_POPUP_DRAG_SELECT) pmarriedobj = xfl.fl_add_select(xfl.FL_DROPLIST_SELECT, 70, 80, \ 110, 27, "Married") xfl.fl_add_select_items(pmarriedobj, "Yes|No") self.preadyobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 150, 20, \ 140, 30, "Quit") xfl.fl_set_object_callback(self.preadyobj, self.exitcb, 0) xfl.fl_end_form()
def create_form_twheelform(self): twheelform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 220, 260) pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 220, 260, "") pobj = xfl.fl_add_frame(xfl.FL_ENGRAVED_FRAME, 15, 70, 190, 130, "") self.pvert = xfl.fl_add_thumbwheel(xfl.FL_VERT_THUMBWHEEL, \ 30, 90, 20, 100, "") xfl.fl_set_object_callback(self.pvert, self.valchange_cb, 0) xfl.fl_set_thumbwheel_step(self.pvert, 0.01) self.phor = xfl.fl_add_thumbwheel(xfl.FL_HOR_THUMBWHEEL, \ 60, 130, 120, 23, "") xfl.fl_set_object_callback(self.phor, self.valchange_cb, 0) xfl.fl_set_thumbwheel_step(self.phor, 0.01) self.preport = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 60, 90, \ 120, 30, "") xfl.fl_set_object_lalign(self.preport, xfl.FL_ALIGN_CENTER | \ xfl.FL_ALIGN_INSIDE) preturnsetting = xfl.fl_add_select(xfl.FL_NORMAL_SELECT, \ 35, 20, 160, 30, "") xfl.fl_set_object_boxtype(preturnsetting, xfl.FL_EMBOSSED_BOX) xfl.fl_set_object_callback(preturnsetting, self.returnchange_cb, 0) xfl.fl_add_select_items(preturnsetting, "End & Changed") xfl.fl_add_select_items(preturnsetting, "Whenever Changed") xfl.fl_add_select_items(preturnsetting, "Always At End") xfl.fl_add_select_items(preturnsetting, "Always") pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 120, 215, \ 80, 30, "Enough") xfl.fl_set_object_lalign(pobj, xfl.FL_ALIGN_CENTER) xfl.fl_end_form() return twheelform
def create_form(self): pform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 444, 380) pobj = xfl.fl_add_box(xfl.FL_BORDER_BOX, 0, 0, 444, 380, "") xfl.fl_set_object_color(pobj, xfl.FL_SLATEBLUE, xfl.FL_COL1) pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 444, 29, "") xfl.fl_set_object_color(pobj, xfl.FL_COL1, xfl.FL_COL1) self.pmenu1 = xfl.fl_add_nmenu(xfl.FL_NORMAL_NMENU, 2, 2, \ 110, 25, "Color 1") xfl.fl_set_object_shortcut(self.pmenu1, "1#1", 1) xfl.fl_set_object_callback(self.pmenu1, self.menu_cb, 0) self.pmenu2 = xfl.fl_add_nmenu(xfl.FL_NORMAL_TOUCH_NMENU, 112, 2, \ 110, 25, "Color 2") xfl.fl_set_object_shortcut(self.pmenu2, "2#2", 1) xfl.fl_set_object_callback(self.pmenu2, self.menu_cb, 1) self.pmenu3 = xfl.fl_add_nmenu(xfl.FL_BUTTON_NMENU, 222, 2, \ 110, 25, "Color 3") xfl.fl_set_object_shortcut(self.pmenu3, "3#3", 1) xfl.fl_set_object_callback(self.pmenu3, self.menu_cb, 2) self.pmenu4 = xfl.fl_add_nmenu(xfl.FL_BUTTON_TOUCH_NMENU, 332, 2, \ 110, 25, "Color 4") xfl.fl_set_object_shortcut(self.pmenu4, "4#4", 1) xfl.fl_set_object_callback(self.pmenu4, self.menu_cb, 3) self.pabox[0] = xfl.fl_add_box(xfl.FL_SHADOW_BOX, 20, 80, 70, 230, "") self.pabox[1] = xfl.fl_add_box(xfl.FL_SHADOW_BOX, 130, 80, 70, 230, "") self.pabox[2] = xfl.fl_add_box(xfl.FL_SHADOW_BOX, 240, 80, 70, 230, "") self.pabox[3] = xfl.fl_add_box(xfl.FL_SHADOW_BOX, 350, 80, 70, 230, "") pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 310, 330, \ 110, 30, "Quit") xfl.fl_set_object_shortcut(pobj, "Q#Q", 1) xfl.fl_set_object_callback(pobj, self.done_cb, 0) xfl.fl_end_form() return pform
def __init__(self, lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 240, 400) self.pboxvalue = xfl.fl_add_box(xfl.FL_DOWN_BOX, 120, 180, 100, 30, "") xfl.fl_set_object_lalign(self.pboxvalue, xfl.FL_ALIGN_CENTER) pslider = xfl.fl_add_slider(xfl.FL_VERT_SLIDER, 40, 40, 60, 320, "") xfl.fl_set_slider_bounds(pslider, -1, 1) xfl.fl_set_slider_value(pslider, 0) xfl.fl_set_object_color(pslider, xfl.FL_SLIDER_COL1, xfl.FL_GREEN) xfl.fl_set_object_callback(pslider, self.slider_cb, 0) xfl.fl_add_button(xfl.FL_RETURN_BUTTON, 120, 290, 100, 30, "Exit") xfl.fl_end_form() xfl.fl_show_form(pform, xfl.FL_PLACE_CENTER, xfl.FL_NOBORDER, "Slider") xfl.fl_do_forms() xfl.fl_finish() sys.exit(0)
def __init__(self, lsysargv, sysargv): self.dcol = 1 self.on = 1 xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 400, 400) pobj1 = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 320, 20, 40, 30, \ "Exit") xfl.fl_set_object_callback(pobj1, self.done, 0) pobj2 = xfl.fl_add_free(xfl.FL_CONTINUOUS_FREE, 40, 80, 320, 280, \ "", self.handle_free1) xfl.fl_end_form() depth = xfl.fl_get_visual_depth() if depth < 4: # Can't do it if less than 4 bit deep... print("This Demo requires a depth of at least 4 bits\n") xfl.fl_finish() sys.exit(1) elif depth > 7: # ...but too large a depth also won't do depth = 7 self.cole = (1 << depth) - 1 if self.cole > 64: self.cole = 64 pobj2.contents.u_ldata = col = xfl.FL_FREE_COL1 self.cole += col for i in range(col, self.cole + 1): j = 255 * (i - col) / (self.cole - col) xfl.fl_mapcolor(i, j, j, j) xfl.fl_show_form(pform, xfl.FL_PLACE_CENTER, xfl.FL_NOBORDER, \ "Free Object") xfl.fl_do_forms()
def __init__(self, lsysargv, sysarg): xfl.fl_initialize(lsysargv, sysarg, "FormDemo", None, 0) self.pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 300, 300) self.psl = xfl.fl_add_slider(xfl.FL_VERT_SLIDER, 40, 40, 60, 220, "X") xfl.fl_set_slider_value(self.psl, 0.5) xfl.fl_set_object_callback(self.psl, self.slider_callback, 0) self.pbut1 = xfl.fl_add_lightbutton(xfl.FL_PUSH_BUTTON, 140, 220, \ 120, 40, "0.0") xfl.fl_set_object_callback(self.pbut1, self.but1_callback, 0) self.pbut2 = xfl.fl_add_lightbutton(xfl.FL_PUSH_BUTTON, 140, 160, \ 120, 40, "0.5") xfl.fl_set_button(self.pbut2, 1) xfl.fl_set_object_callback(self.pbut2, self.but2_callback, 0) self.pbut3 = xfl.fl_add_lightbutton(xfl.FL_PUSH_BUTTON, 140, 100, \ 120, 40, "1.0") xfl.fl_set_object_callback(self.pbut3, self.but3_callback, 0) self.pbut = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 140, 40, \ 120, 40, "Exit") xfl.fl_set_object_callback(self.pbut, self.but_callback, 0) xfl.fl_end_form() xfl.fl_show_form(self.pform, xfl.FL_PLACE_CENTER, xfl.FL_NOBORDER, \ "slRadio") while xfl.fl_do_forms(): pass xfl.fl_finish()
def create_form_fbform(): fdui = FD_fbform() fdui.vdata = fdui.cdata = None fdui.ldata = 0 fdui.fbform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 371, 361) pobj = xfl.fl_add_box( xfl.FL_UP_BOX, 0, 0, 371, 361, "") fdui.browser = xfl.fl_add_browser(xfl.FL_NORMAL_BROWSER, 20, 50, \ 240, 290, "") xfl.fl_set_object_color(fdui.browser, xfl.FL_COL1, xfl.FL_YELLOW) pobj = xfl.fl_add_checkbutton(xfl.FL_RADIO_BUTTON, 270, 50, 70, \ 25, "AlphaSort") xfl.fl_set_object_callback(pobj, sort_method_cb, xfl.FL_ALPHASORT) xfl.fl_set_button(pobj, 1) pobj = xfl.fl_add_checkbutton( xfl.FL_RADIO_BUTTON, 270, 85, 70, \ 25, "SizeSort") xfl.fl_set_object_callback(pobj, sort_method_cb, xfl.FL_SIZESORT) pobj = xfl.fl_add_checkbutton(xfl.FL_RADIO_BUTTON, 270, 120, 70, \ 25, "TimeSort") xfl.fl_set_object_callback(pobj, sort_method_cb, xfl.FL_MTIMESORT) pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 275, 310, 75, 25, \ "Done") xfl.fl_set_object_lalign(pobj, xfl.FL_ALIGN_CENTER) xfl.fl_set_object_callback(pobj, done_cb, 0) fdui.total = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 10, 15, 220, \ 30, "") xfl.fl_set_object_boxtype(fdui.total, xfl.FL_NO_BOX) xfl.fl_end_form() return fdui
def main(lsysarg, sysargv): xfl.fl_initialize(lsysarg, sysargv, "FormDemo", None, 0) pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 300, 300) psl = xfl.fl_add_slider(xfl.FL_VERT_SLIDER, 40, 40, 60, 220, "X") psl.contents.radio = 1 pbut1 = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 140, 220, \ 120, 40, "0.0") pbut2 = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 140, 160, \ 120, 40, "0.5") pbut3 = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 140, 100, \ 120, 40, "1.0") pexitbut = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 140, 40, \ 120, 40, "Exit") xfl.fl_end_form() xfl.fl_show_form(pform, xfl.FL_PLACE_CENTER, xfl.FL_NOBORDER, "slRadio") while True: pobj = xfl.fl_do_forms() if xfl.fl_is_same_object(pobj, pbut1): xfl.fl_set_slider_value(psl, 0.0) elif xfl.fl_is_same_object(pobj, pbut2): xfl.fl_set_slider_value(psl, 0.5) elif xfl.fl_is_same_object(pobj, pbut3): xfl.fl_set_slider_value(psl, 1.0) elif xfl.fl_is_same_object(pobj, pexitbut): break xfl.fl_finish() return 0
def makeform(self): label = ["Red", "Green", "Blue"] col = [xfl.FL_RED, xfl.FL_GREEN, xfl.FL_BLUE] y = 70 self.pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 300, 330) pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 45, 15, \ 210, 45, "Color Editor") xfl.fl_set_object_lsize(pobj, xfl.FL_LARGE_SIZE) for i in range (0, 3): self.pdials[i] = xfl.fl_add_dial(xfl.FL_NORMAL_DIAL, 30, y, \ 60, 60, label[i]) xfl.fl_set_object_boxtype(self.pdials[i], xfl.FL_UP_BOX) xfl.fl_set_dial_bounds(self.pdials[i], 0.0, 255.0) xfl.fl_set_dial_value(self.pdials[i], 128.0) xfl.fl_set_object_color(self.pdials[i], col[i], xfl.FL_DIAL_COL2) xfl.fl_set_object_callback(self.pdials[i], self.cb, i) xfl.fl_set_object_return(self.pdials[i], xfl.FL_RETURN_CHANGED) self.ptexts[i] = xfl.fl_add_box(xfl.FL_DOWN_BOX, 105, y + 17, \ 50, 25, "128") y += 85 self.presult = xfl.fl_add_box(xfl.FL_DOWN_BOX, 180, 70, 90, 245, "") xfl.fl_set_object_color(self.presult, xfl.FL_FREE_COL1, \ xfl.FL_FREE_COL1) xfl.fl_mapcolor(xfl.FL_FREE_COL1, 128, 128, 128) xfl.fl_set_object_dblbuffer(self.presult, 1) # to avoid flicker xfl.fl_end_form()