I am evaluating iup for a project where I am combining the SciTE text
editor for popup dialogs that help with adding or editing content. I need
to use Lua to access iup. One thing I wanted to do was set up a dialog that
included a spreadsheet view that expands with the dialog. I saw that there
is a FITTOSIZE option that should allow you to do this, but I am having
trouble figuring out how to set it up correctly.

I did see an incomplete c example in the archive where a RESIZE_CB was
defined and RASTERWIDTH2 was set (does this control which columns are
expanded) and FITTOSIZE was set to "COLUMNS". When I created a Lua
resize_cb callback, it stopped drawing the matrix view. I saw another
archived item indicating that the original callback needed to be called
inside the resize_cb that I create, but I am not sure how to do this in
Lua. I tried to get a reference to the original resize_cb, but the value is
'nil'. Below is one of my attempts to get this right followed by some
specific questions. Any help is appreciated.


  mat = iup.matrix {border="Yes", resizematrix = "Yes", scrollbar="Yes",
redraw="All", \
     numcol=7, numlin=3, numcol_visible=7, numlin_visible=3, widthdef=34}
  mat:setcell(0,1,"End\nTime")
  mat:setcell(0,2,"Minimum\nStep")
  mat:setcell(0,3,"Maximum\nStep")
  mat:setcell(0,4,"Control\nOption")
  mat:setcell(0,5,"Plot\nFreq.")
  mat:setcell(0,6,"Edit\nFreq.")
  mat:setcell(0,7,"Restart\nFreq.")

  old_resize = mat.resize_cb

  function mat:resize_cb(w, h)
    mat.RASTERWIDTH2 = nil
    mat.FITTOSIZE = "Columns"

    -- The following line fails since old_resize is nil
    --mat:old_resize(w,h)

    return iup.DEFAULT
  end

  dlg = iup.dialog{ iup.hbox{mat; margin="5x5";expand="Yes"}, title="Time
Step Data", }
  dlg:show()


How do I set FITTOSIZE, and is resize_cb the right place to do this?

How do I indicate which columns expand (RASTERWIDTH? - if so what do I set
this to?)

How do I call the original resize_cb function for the matrix view (if there
is one)? If there isn't why does the view not redraw correctly?

-Lance Larsen
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to