def control_callback(self, pobj, pvdata): ldata = xfl.fls_convert_ptrvoid_to_ptrlongc(pvdata).contents.value if xfl.fl_is_same_object(pobj, self.psizeobj): self.cursize = int(40 * xfl.fl_get_slider_value(self.psizeobj)) elif xfl.fl_is_same_object(pobj, self.pexitobj): xfl.fl_finish() sys.exit(0)
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 main(lsysargv, sysargv): sc = 1.0 xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) ui = create_form_form() strng = "%.2f" % sc xfl.fl_set_input(ui.pscaleobj, strng) xfl.fl_show_form(ui.pform, xfl.FL_PLACE_CENTER | xfl.FL_FREE_SIZE, xfl.FL_FULLBORDER, "Scaling") while True: oldsc = sc pobj = xfl.fl_do_forms() if xfl.fl_is_same_object(pobj, ui.pexitobj): sys.exit(0) elif xfl.fl_is_same_object(pobj, ui.psmallerobj): sc = sc * 0.8 elif xfl.fl_is_same_object(pobj, ui.plargerobj): sc = sc / 0.8 elif xfl.fl_is_same_object(pobj, ui.pscaleobj): sc = float(xfl.fl_get_input(ui.pscaleobj)) if sc < 0.50: sc = 0.50 elif sc > 3: sc = 3 if sc != oldsc: xfl.fl_scale_form(ui.pform, sc / oldsc, sc / oldsc) xfl.fl_redraw_form(ui.pform) # to avoid garbage on screen strng = "%.2f" % sc xfl.fl_set_input(ui.pscaleobj, strng)
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 __init__(self, lsysargv, sysargv): self.INTERVAL = 800 # wait this long before show tip xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.fd_form0 = self.create_form_form0() # Fill-in form initialization code xfl.fl_set_button(self.fd_form0.peek, 1) xfl.fl_set_button(self.fd_form0.enter, 1) xfl.fl_set_button(self.fd_form0.leave, 1) xfl.fl_set_button(self.fd_form0.push, 1) xfl.fl_set_button(self.fd_form0.release, 1) xfl.fl_set_object_prehandler(self.fd_form0.butt, \ self.preemptive_handler) self.set_tip(self.fd_form0.done, "Want to quit ?\nPress me") self.set_tip(self.fd_form0.peek, "Turn preempting off") self.set_tip(self.fd_form0.override, "Turn preempting on") #xfl.fl_set_object_helper(self.fd_form0.done, \ # "Want to quit ?\nPress me") #xfl.fl_set_object_helper(self.fd_form0.peek, "Turn preempting off") #xfl.fl_set_object_helper(self.fd_form0.override, \ # "Turn preempting on") # Show the first form xfl.fl_show_form(self.fd_form0.form0, xfl.FL_PLACE_CENTER, \ xfl.FL_TRANSIENT, "Preemptive") while not xfl.fl_is_same_object(xfl.fl_do_forms(), \ self.fd_form0.done): pass # empty xfl.fl_finish()
def __init__(self, lsysargv, sysargv): xfl.fl_flip_yorigin() xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.create_form() xfl.fl_show_form(self.pform, xfl.FL_PLACE_CENTER | xfl.FL_FREE_SIZE, \ xfl.FL_TRANSIENT, "Select Object Demo") while True: pobj = xfl.fl_do_forms() if xfl.fl_is_same_object(pobj, self.preadyobj): break
def __init__(self, lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.create_form() xfl.fl_show_form(self.pform, xfl.FL_PLACE_CENTER, \ xfl.FL_TRANSIENT, "Browser Op") while not xfl.fl_is_same_object(xfl.fl_do_forms(), self.pexitobj): pass #xfl.fl_hide_form(self.pform) xfl.fl_finish() sys.exit(0)
def __init__(self, lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.make_form1() xfl.fl_show_form(self.pform, xfl.FL_PLACE_CENTER, xfl.FL_NOBORDER, \ "Demo06") while True: pobj = xfl.fl_do_forms() if xfl.fl_is_same_object(pobj, self.pbut): if xfl.fl_show_question("Do you really want to Quit?", 0): break xfl.fl_finish() sys.exit(0)
def __init__(self, lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.create_form_0() xfl.fl_show_form(self.pform, xfl.FL_PLACE_CENTER, xfl.FL_NOBORDER, \ "Labels") while True: pobj = xfl.fl_do_forms() if xfl.fl_is_same_object(pobj, self.preadyobj): break xfl.fl_hide_form(self.pform) xfl.fl_finish() sys.exit(0)
def __init__(self, lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.makeform() xfl.fl_scale_form(self.pform, 4.0, 4.0) xfl.fl_show_form(self.pform, xfl.FL_PLACE_FREE, \ xfl.FL_TRANSIENT, "colsel") while True: pret = xfl.fl_do_forms() if xfl.fl_is_same_object(pret, self.ptopbox): break xfl.fl_hide_form(self.pform) xfl.fl_finish() sys.exit(0)
def __init__(self, lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.create_form_form() xfl.fl_show_form(self.pform, xfl.FL_PLACE_CENTER | xfl.FL_FREE_SIZE, \ xfl.FL_FULLBORDER, "All Sliders") while True: pobj = xfl.fl_do_forms() if xfl.fl_is_same_object(pobj, self.pexitobj): break xfl.fl_hide_form(self.pform) xfl.fl_finish()
def main(lsysargv, sysargv): global fd_objsform xfl.fl_initialize(lsysargv, sysargv, "", None, 0) fd_objsform = create_form_objsform() init_gui(fd_objsform) # fill-in form initialization code xfl.fl_set_button(fd_objsform.button[0], 1) show_group(0, 0) # show the first form xfl.fl_show_form(fd_objsform.objsform, xfl.FL_PLACE_CENTER, \ xfl.FL_FULLBORDER, "objsform") while True: if xfl.fl_is_same_object(xfl.fl_do_forms(), fd_objsform.quit): break xfl.fl_finish() return 0
def main(lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 400, 450) pobj1 = xfl.fl_add_input(xfl.FL_MULTILINE_INPUT, 30, 270, 340, 150, "") xfl.fl_set_object_callback(pobj1, input2_cb, 0) pobj2 = xfl.fl_add_input(xfl.FL_MULTILINE_INPUT, 30, 90, 340, 150, "") xfl.fl_set_object_lsize(pobj2, xfl.FL_NORMAL_SIZE) xfl.fl_set_object_callback(pobj2, input_cb, 0) pbut = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 160, 30, 80, 30, "Exit") xfl.fl_end_form() xfl.fl_show_form(pform, xfl.FL_PLACE_CENTERFREE, xfl.FL_FULLBORDER, "MultiLineInput") while True: pobj = xfl.fl_do_forms() if xfl.fl_is_same_object(pobj, pbut): break xfl.fl_finish() return 0
def __init__(self, lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 400, 300) ppassword1 = xfl.fl_add_input(xfl.FL_SECRET_INPUT, 140, 40, \ 160, 40, "Password 1:") xfl.fl_set_object_return(ppassword1, xfl.FL_RETURN_CHANGED) ppassword2 = xfl.fl_add_input(xfl.FL_SECRET_INPUT, 140, 100, \ 160, 40, "Password 2:") xfl.fl_set_object_return(ppassword2, xfl.FL_RETURN_CHANGED) pinfo = xfl.fl_add_box(xfl.FL_SHADOW_BOX, 20, 160, 360, 40, "") pbut = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 280, 240, \ 100, 40, "Quit") xfl.fl_end_form() xfl.fl_show_form(self.pform, xfl.FL_PLACE_MOUSE, \ xfl.FL_FULLBORDER, "Secret input demo") while not xfl.fl_is_same_object(xfl.fl_do_forms(), pbut): strng = "Password 1 is: %s , Password 2 is: %s" % \ (xfl.fl_get_input(ppassword1), \ xfl.fl_get_input(ppassword2)) xfl.fl_set_object_label(pinfo, strng) xfl.fl_finish() sys.exit(0)
def main(lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", 0, 0 ) pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 320, 120) xfl.fl_add_box(xfl.FL_NO_BOX, 0, 10, 320, 40, "Do you want to quit?") pyes = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 40, 70, 80, 30," Yes") xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 200, 70, 80, 30, "No") xfl.fl_end_form() xfl.fl_show_form(pform, xfl.FL_PLACE_MOUSE, xfl.FL_TRANSIENT, "Question") while True: pobj = xfl.fl_do_forms() if xfl.fl_is_same_object(pobj, pyes): print("\"Yes\" has been pushed") xfl.fl_hide_form(pform) sys.exit(0) xfl.fl_finish() return 0
def __init__(self, lsysargv, sysargv): strng = "" xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.makeform() xfl.fl_show_form(self.pform, xfl.FL_PLACE_MOUSE, \ xfl.FL_TRANSIENT, "A Form") r = xfl.fl_get_dial_value(self.pred) + 0.001 g = xfl.fl_get_dial_value(self.pgreen) + 0.001 b = xfl.fl_get_dial_value(self.pblue) + 0.001 xfl.fl_freeze_form(self.pform) xfl.fl_mapcolor(xfl.FL_FREE_COL1, r, g, b) strng = "%d" % r xfl.fl_set_object_label(self.predtext, strng) strng = "%d" % g xfl.fl_set_object_label(self.pgreentext, strng) strng = "%d" % b xfl.fl_set_object_label(self.pbluetext, strng) xfl.fl_unfreeze_form(self.pform) while True: if xfl.fl_is_same_object(xfl.fl_do_forms(), self.pbutton): break r = xfl.fl_get_dial_value(self.pred) + 0.001 g = xfl.fl_get_dial_value(self.pgreen) + 0.001 b = xfl.fl_get_dial_value(self.pblue) + 0.001 xfl.fl_freeze_form(self.pform) xfl.fl_mapcolor(xfl.FL_FREE_COL1, r, g, b) strng = "%d" % r xfl.fl_set_object_label(self.predtext, strng) strng = "%d" % g xfl.fl_set_object_label(self.pgreentext, strng) strng = "%d" % b xfl.fl_set_object_label(self.pbluetext, strng) xfl.fl_unfreeze_form(self.pform) xfl.fl_hide_form(self.pform) xfl.fl_finish() sys.exit(0)
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()