more cells in a table field

Robert Sneidar slylabs13 at mac.com
Fri Mar 28 18:50:53 EDT 2008


I wrote a simple function where you feed it a comma delimited list of  
column lengths and it returns a comma delimited tabstops list. So if I  
feed it "10,20,10,5" it returns "10,30,40,45". I find this easier than  
the math exercise I have to do EVERY TIME I want to set up some  
columns. Column Widths is how people think about tables, not tab stops.

FUNCTION ColumnWidth mColumnWidths
     #breakpoint
     put the itemdelimiter into moldDelim -- save the old delimiter

     IF tab is in mColumnWidths THEN
         set the itemdelimiter to tab -- accept tab delimited
     ELSE IF comma is in mColumnWidths then
         set the itemdelimiter to comma -- accept comma delimited
     END IF

     put the number of items of mcolumnwidths into mColumnCount

     put "" into mWidths -- initialize output variable
     put 0 into mtotalWidth

     REPEAT WITH mloop = 1 to mColumnCount
         put item mloop of mcolumnWidths into mcurwidth

         IF mcurwidth = 0 THEN
             put 10 into mcurwidth -- can't have a column width of 0
         END IF

         put mtotalWidth  + mcurwidth into mTotalWidth
         put mwidths & mTotalWidth into mwidths

         IF mloop = mcnt THEN
             exit REPEAT
         END IF

         put mWidths & "," into mwidths
     END REPEAT

     IF tab is in mColumnWidths THEN
         set the itemdelimiter to mOldDelim
     END IF

     delete last char of mwidths
     return mwidths
END ColumnWidth


Bob Sneidar
IT Manager
Logos Management
Calvary Chapel CM

On Mar 28, 2008, at 10:27 AM, -= JB =- wrote:

> Thanks for the info and advice.
>
> -=>JB<=-
>
>
>
> On Mar 28, 2008, at 3:14 AM, Björnke von Gierke wrote:
>
>>
>> On 28 Mar 2008, at 03:32, -= JB =- wrote:
>>> Here are a few more questions about a table field;
>>
>> Generally I'll advise against using the rev made table field. It's  
>> easily confused, and will cause you lots of headaches. It's very  
>> simple to get basic cell editing going by yourself, and there's  
>> example stacks abound. Because of that, the hints below are not  
>> table field specific, but apply to all fields.
>>
>>> 1.  If you click on a line you can get the number of line clicked.
>>> Question:  can you get the item(cell) clicked?
>>
>> clickChunk
>> clickCharChunk
>>
>> you'll need to do some calculations to get items from that though.
>>
>>> 2.  If you enter text in line 4 item 2 and then leave the item by
>>> going to another line, item or leave the field can you detect
>>> which line and item you last altered.
>>
>> You can, rev can't. Just store the information you need in a  
>> customproperty.
>>
>>> 2.  How do you resize a column?
>>> Is it possible for the user to click on the column divider and  
>>> resize it?
>>> Can you resize a column by script?
>>
>> can be done by using the tabstops property
>>
>>
>> -- 
>>
>> official ChatRev page:
>> http://chatrev.bjoernke.com
>>
>> Chat with other RunRev developers:
>> go stack URL "http://homepage.mac.com/bvg/chatrev1.3.rev"
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list