Re: How to resize the columns of a datagrid?

2015-08-04 Thread Sri
You may want to try this:

1. Save the original width of datagrid in a custom property cOldWidth.

2. In the datagrid script, handle resizeControl:
on resizeControl
local tFraction
put (the width of me / the cOldWidth of me) into tFraction
repeat for each line tLine in the dgProp[columns] of me
set the dgColumnWidth[tLine] of me to the round of (tFraction * the
dgColumnWidth[tLine] of me)
end repeat

Make sure that the minimum column width and column resizablity properties
are properly set.

I haven't tried this out. Hope it works. The idea is to handle the change
under resizeControl

Regards,
Sri



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/How-to-resize-the-columns-of-a-datagrid-tp4694576p4694577.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: How to resize the columns of a datagrid?

2015-08-04 Thread Bob Sneidar
There's a dgprop for it. Check documentation.


Sent on the new Sprint Network from my Samsung Galaxy S®4.


 Original message 
From: Tiemo Hollmann TB
Date:08/04/2015 6:14 AM (GMT-08:00)
To: LiveCode User Liste senden
Subject: How to resize the columns of a datagrid?

Hello,

I want to resuze a datagrid table by script depending oft he window size.

When just resizing the datagrid (expanding it) an additional column is added
to the datagrid.

Is there an easy way to resize all columns proportional to the new width of
the datagrid?

Thanks

Tiemo





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to resize the columns of a datagrid?

2015-08-04 Thread Klaus major-k
Hi Tiemo,

 Am 04.08.2015 um 17:10 schrieb Tiemo Hollmann TB toolb...@kestner.de:
 
 Hi Bob,
 are you thinking of dgColumnIsResizable? It allows the user to resize
 manually the column width.
 Or do you have another property in mind?

I’m obviously not Bob, but I think he was more thinking of something like:
…
## Set width of single column:
set the dgColumnWidth[„Name of column] of group DataGrid to 150
..
## Set width of all columns, supply a COMMA delimited list of desired widths:
set the dgProps[column widths] of group DataGrid to „200,200,150,300
…
:-)

 Tiemo
 
 -Ursprüngliche Nachricht-
 Von: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] Im Auftrag
 von Bob Sneidar
 Gesendet: Dienstag, 4. August 2015 16:08
 An: How to use LiveCode use-livecode@lists.runrev.com
 Betreff: RE: How to resize the columns of a datagrid?
 
 There's a dgprop for it. Check documentation.

Best

Klaus

--
Klaus Major
http://www.major-k.de
kl...@major-k.de


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: How to resize the columns of a datagrid?

2015-08-04 Thread Mike Bonner
If you want proportional, all the same size relative to each other,
something like this in the card script should work.

on resizestack
   set the rect of group 1 to the rect of this card -- set your dg group to
whatever new size you want
   resizecol
end resizestack
on resizecol
  put the  width of group 1 into tWidth
  put the dgProp[ columns ] of group 1 into tCol
  put trunc((the effective width of group 1) / (the number of lines in
tCol)) into tWidth

  repeat for each line tLine in tCol
 set the dgColumnWidth[tLine] of group 1 to tWidth
  end repeat

end resizecol

It does a pretty good job, but it leaves the horizontal scroll bar up. I'm
sure you could nudge things around so that there was no scroll bar (or just
turn that one off)

If you want different sizes, all changing proportionally, you'll need to do
as sri said and adjust based on a factor. (it should be easy enough to
store the size of each column as a percentage of total width and use that
to generate your widths)

On Tue, Aug 4, 2015 at 9:26 AM, Klaus major-k kl...@major-k.de wrote:

 Hi Tiemo,

  Am 04.08.2015 um 17:10 schrieb Tiemo Hollmann TB toolb...@kestner.de:
 
  Hi Bob,
  are you thinking of dgColumnIsResizable? It allows the user to resize
  manually the column width.
  Or do you have another property in mind?

 I’m obviously not Bob, but I think he was more thinking of something like:
 …
 ## Set width of single column:
 set the dgColumnWidth[„Name of column] of group DataGrid to 150
 ..
 ## Set width of all columns, supply a COMMA delimited list of desired
 widths:
 set the dgProps[column widths] of group DataGrid to „200,200,150,300
 …
 :-)

  Tiemo
 
  -Ursprüngliche Nachricht-
  Von: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] Im
 Auftrag
  von Bob Sneidar
  Gesendet: Dienstag, 4. August 2015 16:08
  An: How to use LiveCode use-livecode@lists.runrev.com
  Betreff: RE: How to resize the columns of a datagrid?
 
  There's a dgprop for it. Check documentation.

 Best

 Klaus

 --
 Klaus Major
 http://www.major-k.de
 kl...@major-k.de


 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode