Scuri,
I implemented the resize callback on the dialog instead. This did fix the
problem with the matrix view not being drawn, but the matrix columns are
not being resized when I expand the dialog bounds. I turned on the matrix
view border, so I can see that the matrix view is resizing, just not the
table itself. Am I setting FITTOSIZE correctly, or is there something else
I am missing?
function OpenTimeStepDialog()
local 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")
...
tsd = iup.dialog{ iup.hbox{mat; margin="5x5";expand="Yes"}, title="Time
Step Data", }
function tsd:resize_cb(w, h)
iup.Refresh(tsd)
mat.FITTOSIZE = "Columns"
return iup.DEFAULT
end
end
~Lance
On Fri, Apr 5, 2013 at 11:25 AM, Antonio Scuri <antonio.sc...@gmail.com>wrote:
> Hi Lance,****
>
> ** **
>
> The resize_cb callback in Lua can not be replaced, you must do it in C.
> But I suggest you to use the resize_cb of the dialog instead, but you will
> have to call the iup.Refresh(dlg) function before setting FITTOSIZE.****
>
> ** **
>
> When setting FITTOSIZE all columns that don’t have RASTERWIDTH set to a
> given value will be resized, in other words all columns that RASTERWIDTH is
> set to NULL will be resized.****
>
> ** **
>
> Best Regards,****
>
> Antonio Scuri****
>
> ** **
>
> *From:* Lance Larsen [mailto:gaffer...@gmail.com]
> *Sent:* sexta-feira, 5 de abril de 2013 13:08
> *To:* iup-users@lists.sourceforge.net
> *Subject:* [Iup-users] Auto-resizing the Matrix component****
>
> ** **
>
> 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
>
>
------------------------------------------------------------------------------
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