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 bounds_cb(pobj, data):
    # char buf[ 50 ]

    if not data:
        xmin = float(xfl.fl_get_input(xypui.xmin))
        xmax = float(xfl.fl_get_input(xypui.xmax))

        if xmin <= 0.0:
            xmin = 1.0
            xfl.fl_set_input(xypui.xmin, "1.0")

        if xmax <= 0.0:
            xmax = 10.0
            xfl.fl_set_input(xypui.xmax, "10.0")

        xfl.fl_set_xyplot_xbounds(xypui.xyplot, xmin, xmax)

        xmin, xmax = xfl.fl_get_xyplot_xbounds(xypui.xyplot)
        #sprintf( buf, "%g", xmin );
        buf = str(xmin)
        xfl.fl_set_input(xypui.xmin, buf)
        #sprintf( buf, "%g", xmax );
        buf = str(xmax)
        xfl.fl_set_input(xypui.xmax, buf)

    else:
        ymin = float(xfl.fl_get_input(xypui.ymin))
        ymax = float(xfl.fl_get_input(xypui.ymax))

        if ymin <= 0.0:
            ymin = 1.0
            xfl.fl_set_input(xypui.ymin, "1.0")

        if ymax <= 0.0:
            ymax = 10.0
            xfl.fl_set_input(xypui.ymax, "10.0")

        xfl.fl_set_xyplot_ybounds(xypui.xyplot, ymin, ymax)

        ymin, ymax = xfl.fl_get_xyplot_ybounds(xypui.xyplot)
        #sprintf( buf, "%g", ymin );
        buf = str(ymin)
        xfl.fl_set_input(xypui.ymin, buf)
        #sprintf( buf, "%g", ymax );
        buf = str(ymax)
        xfl.fl_set_input(xypui.ymax, buf)
 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 replaceit(self, pobj, arg):
     n = xfl.fl_get_browser(self.pbrowserobj)
     if n:
         xfl.fl_replace_browser_line(self.pbrowserobj, n, \
                 xfl.fl_get_input(self.pinputobj))
 def insertit(self, pobj, arg):
     xfl.fl_insert_browser_line(self.pbrowserobj, \
             xfl.fl_get_browser(self.pbrowserobj), \
             xfl.fl_get_input(self.pinputobj))
 def addit(self, pobj, data):
     # append and show the last line. Don't use this if you just want
     # to add some lines. use fl_add_browser_line
     xfl.fl_addto_browser(self.pbrowserobj, \
             xfl.fl_get_input(self.pinputobj))