Hi Milind,
Let's approach this in parts...
> So now here is the 1st thing I don't understand. Why is matC which has
more columns has a natural size in X which is smaller than matA which has 1
less column? This is even before I do any modifications to the sizes of the
columns.
Here are both matrices, side by side (I removed the tabs so we can see
both), and without any Fit:
[image: Inline image 2]
So. Your Fit functions are actually doing that, because resizematrix_cb
is called whenever the matrix layout is computed. Notice that both matrices
have expand=yes, so they are already occupying the whole dialog
space, although this is not visible because the columns are not expanding.
If the dialog is resized, all stays the same.
The if I just add
matA.fittosize = "Yes" and
...
matC.fittosize = "Yes"
And there is no need to redraw="all", both at the respective resizematrix_cb,
then I get this:
[image: Inline image 3]
Since width1=8 is set for matC, it will not be automatically resized.
Notice the scrollbar area reserved there.
If the dialog is resized, all stays the same. So we need to clear the
width(s) that we want to control:
matA.rasterwidth1 = nil
matA.rasterwidth2 = nil
matA.fittosize = "Yes"
.....
matC.rasterwidth2 = nil
matC.rasterwidth3 = nil
matC.fittosize = "Yes"
But this will not work because you set this:
numcol = 2,
numcol_visible = 3,
on matA. So we fix it to numcol_visible = 2, then the result is:
[image: Inline image 1]
If I let the numcol_visible = 3, the application behaves just like
the fitMat*
functions by slowly increasing the matrix size in each interaction.
Well, something is not being computed right inside that functions. If you
really want to manually control all those sizes then I suggest you to take
a look at the matrix source code, file "iup/srccontrols/matrix/iupmatrix.c"
function iMatrixSetFitToSizeAttrib. From there you will be redirected to
iupMatrixGetColumnWidth and iupMatrixGetLineHeight that are also used
inside iMatrixComputeNaturalSizeMethod, and have all the details for
computing line and column sizes.
Also, inside those functions you are setting DX and DY, that is not
necessary. The matrix will automatically calculate that and update the
scrollbar.
PS: we are having some visibility issues with the scrollbars in the
IupCanvas (used by IupMatrix), that we are working on.
Best,
Scuri
On Wed, Jun 17, 2015 at 5:06 PM, Milind Gupta <milind.gu...@gmail.com>
wrote:
> A follow up for the above value snap shop. After I just resize matA cells
> (matC is not resized) the values change to:
>
> [image: Inline image 1]
> My calculation distributed 459 to each cell width since it satisfied the
> equation 936 = 2+ 459*2 + 8*2 and the rows are 10 and 488 since they
> satisfy the equation 516 = 2 + 10+488+8*2 but when I do that the rastersize
> of A has not changed from 936x516 to 1010x531. I am not able to explain
> this.
>
> On Wed, Jun 17, 2015 at 12:56 PM, Milind Gupta <milind.gu...@gmail.com>
> wrote:
>
>> Hi Antonio,
>> Thanks for the quick reply. I modified the program (as
>> attached). When I start the program and the dlg:show calls the
>> resizematrix_cb for matA I see the following values (as shown in the pasted
>> and attached image watch1):
>>
>> [image: Inline image 1]
>>
>> So now here is the 1st thing I don't understand. Why is matC which has
>> more columns has a natural size in X which is smaller than matA which has 1
>> less column? This is even before I do any modifications to the sizes of the
>> columns.
>>
>> Now as soon as I resize matA rows and columns with my resize calculations
>> the matA naturalsize and rastersize get bigger. So somehow something is not
>> right in my calculations. Let me repeat my calculation rules I use:
>>
>> 1. Every cell has 8 pixels of decoration in X and in Y direction.
>> 2. The matrix has a border of 2
>> 3. rastersize is the actual size of the matrix control I can use when I
>> include the matrix control border (2) and decoration for each cell (8)
>> 4. rasterheightX and rasterwidthX gives the size of the cell after
>> removing the decoration part (8).
>>
>> So with a rastersize dimension of X and n cells of dimensions x1,x2,...xn
>> the following is true:
>> X = 2+x1+x2+...+xn+8*n
>>
>> Is this not right? I am forcing the scroll bar to autohide by setting dx
>> = xmax-xmin and dy=ymax-ymin.
>>
>>
>> Thanks,
>> Milind
>>
>> On Wed, Jun 17, 2015 at 10:21 AM, Antonio Scuri <sc...@tecgraf.puc-rio.br
>> > wrote:
>>
>>> Hi,
>>>
>>> I didn't check all your calculations, but did you noticed that when
>>> the dialog is resize you do the FitMat* twice? When MatA is resized, you
>>> compute both, then MatC is also resized and you compute both again.
>>>
>>> I think it would more interesting to set the size only of the
>>> respective metrix inside resizematrix_cb.
>>>
>>> And if the size is growing this means that you are setting a
>>> combination of sizes that are larger than the current size. Must recheck
>>> those calculations. Try inspecting the new sizes and comparing them to the
>>> calculated size.
>>>
>>> Best,
>>> Scuri
>>>
>>>
>>>
>>>
>>> On Wed, Jun 17, 2015 at 12:50 PM, Milind Gupta <milind.gu...@gmail.com>
>>> wrote:
>>>
>>>> I think the problem may be occurring because of the following which I
>>>> don't understand:
>>>>
>>>> I have a iuptabs control that starts off with a size of 776x361
>>>> clientsize (which is the same as either matrix rastersize.) I have 2 matrix
>>>> controls in the 2 tabs and I resize its rows and columns as follows:
>>>>
>>>> matA has 2 rows (including title) and 2 columns (no column title).
>>>> Title row rasterheight = 10 (fixed) row 1 rasterheight = 333 (adjusted to
>>>> occupy the remaining height of the matrix). This should give the total
>>>> matrix height of 333+10+2*8+2 = 361 which matches the height of the matrix.
>>>> (2 is for the border and 8 for the cell decorations)
>>>>
>>>> matA has 2 columns with no title. Both columns are distributed the
>>>> space equally. So their rasterwidth is set to 379 both. That should give
>>>> the total matrix width of:
>>>> 379*2+2*8+2 = 776 which matches the width of the matrix
>>>>
>>>> matC has 2 rows same as matA and they are given the same size of 10 and
>>>> 333
>>>>
>>>> matC has 3 columns. 1st column is fixed at 12 the remaining 2 columns
>>>> get the space equally and are set to 369. This should give the matrix width
>>>> of:
>>>> 369*2+8*3+12+2 = 776 which matches the width of the matrix
>>>>
>>>> *After these sizings happen the natural size and rastersize of matA
>>>> changes to 850x376 and the natural size of matC changes to 791x376 while
>>>> its rastersize if 850x376. The iuptabs natural size and rastersize changes
>>>> to 858x407*
>>>>
>>>> I don't understand why does the natural and rastersize of the matrix
>>>> elements and iuptabs change when I resize the columns to precisely fit in
>>>> their current rastersize? Am I calculating something wrong here?
>>>>
>>>> Thanks for any help.
>>>>
>>>> Milind
>>>>
>>>>
>>>> On Tue, Jun 16, 2015 at 11:41 PM, Milind Gupta <milind.gu...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>> I have this sample attached. The aim is to resize the matrix
>>>>> columns and cells automatically depending on the weight assigned to the
>>>>> columns whenever the dialog is resized. The sizing algorithm works fine
>>>>> when I trace the steps of the sizes allotted to different columns.
>>>>> The problem is that after a few resize iterations the iuptab
>>>>> size suddenly becomes larger than the dialog clientsize. I am not able to
>>>>> explain that and that causes the automatic resizing of the matrix not to
>>>>> work as intended.
>>>>> I would really appreciate any help as to why the tabs size
>>>>> increases beyond the dialog client size.
>>>>>
>>>>> Thanks,
>>>>> Milind
>>>>>
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> Iup-users mailing list
>>>> Iup-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Iup-users mailing list
>>> Iup-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Monitor 25 network devices or servers for free with OpManager!
> OpManager is web-based network management software that monitors
> network devices and physical & virtual servers, alerts via email & sms
> for fault. Monitor 25 devices for free with no restriction. Download now
> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
>
------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors
network devices and physical & virtual servers, alerts via email & sms
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users