Re: How can I "fake" the appearance of merged cells (like in Excel)

2016-09-18 Thread Roger Eller
Thanks for the ideas, and for the script.  This is great!  The thing I like
about math in a program is - only having to do it once.  :)

~Roger
___
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 can I "fake" the appearance of merged cells (like in Excel)

2016-09-18 Thread BNig
Hi Rodger

this works for me

if you are going with formatedRect to get to the left and right it is easier
but you would have to find the fudge factors for that.

make a button "indic" and change the script to reflect your table field

-
local sMyTable
on mouseUp
   put "field" && quote & "myTable" & quote into sMyTable
   
   myTable 1, 2, 6
end mouseUp

on MyTable pRow, pColumn, pLinesForIndicator
   put the left of sMyTable into tLeft
   put the top of sMyTable into tTop
   put the borderWidth of sMyTable into tBorderWidth
   put the leftMargin of sMyTable into tLeftMargin
   put tBorderWidth + tLeftMargin - 2 into tLeftFudge
   put the effective textHeight of sMyTable into tLineHeight
   
   put the tabWidths of sMyTable into tTabWidths
   put the number of items of tTabWidths into tWidthItems
   if tWidthItems = 1 then
  put item 1 of tTabWidths into tIndicWidth
  put (tTabWidths * (pColumn - 1)) into tLeftOfIndicator
   else
  if tWidthItems <  pColumn then
 put item - 1 of tTabWidths into tIndicWidth
 put sum(tTabWidths) + ((pColumn - 1 - tWidthItems) * tIndicWidth) 
into tLeftOfIndicator
  end if
  if tWidthItems >= pColumn then
 put (item  pColumn - 1 of tTabWidths * (pColumn - 1))  into
tLeftOfIndicator
 put item pColumn of tTabWidths into tIndicWidth
  end if
   end if
   
   if pColumn > 1 then 
  add tLeftFudge to tLeftOfIndicator
  subtract the hScroll of sMyTable from tLeftOfIndicator
   else
  add tLeftFudge to tIndicWidth
   end if
   
   put item 2 of the formattedRect of item pColumn of line pRow of sMyTable
into tTopIndicator
   put item 4 of the formattedRect of item pColumn of line pRow
+pLinesForIndicator - 1 of sMyTable into tBotIndicator
   
   lock screen
   set the width of btn "indic" to tIndicWidth
   set the height of btn "indic" to tBotIndicator - tTopIndicator
   set the left of btn "indic" to tLeft + tLeftOfIndicator
   set the top of btn "indic" to tTopIndicator
   unlock screen
   --breakpoint
end MyTable
---

Kind regards
Bernd



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/How-can-I-fake-the-appearance-of-merged-cells-like-in-Excel-tp4708548p4708591.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 can I "fake" the appearance of merged cells (like in Excel)

2016-09-18 Thread Curry Kenworthy


Howdy,

You can use math for that, either from scratch or starting from 
formattedrect. Easy if there's a consistent line height, but should be 
doable even if there isn't.


Depending on the content there are ways of faking stuff like this, but 
there were even more ways in the past with some LC versions. You know 
me, I love fields. :)


Best wishes,

Curry Kenworthy
--

Need custom software development or LiveCode help?
http://curryk.com/consulting/




As it turns out, a button works better than a field because its label is
centered both vertically and horizontally.

The issue is defining the size of the rect.  If the table field has the
same content in item 3 of lines 5 to 7, I need to find the rect of those 3
cells combined.  The formattedWidth and height only gives the size of the
content, but I need the visible grid cell dimensions.

~Roger



___
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 can I "fake" the appearance of merged cells (like in Excel)

2016-09-18 Thread Roger Eller
As it turns out, a button works better than a field because its label is
centered both vertically and horizontally.

The issue is defining the size of the rect.  If the table field has the
same content in item 3 of lines 5 to 7, I need to find the rect of those 3
cells combined.  The formattedWidth and height only gives the size of the
content, but I need the visible grid cell dimensions.

~Roger

On Sep 16, 2016 5:53 PM, "Roger Eller"  wrote:

> I have a table field with about 10 columns. Some of the cells may contain
> the same data as the cell above and/or below it.  I want to visually
> portray these occurances as a single cell with the text centered within the
> visually larger cell.
>
> How would you approach this problem?  Would you overlay an opaque field
> whose rectangle is that of the combined cells?
>
> I need it to scroll too.  Thoughts?  Creative solutions?  No, not gonna
> use Excel.  ;-)
>
> ~Roger
>
>
>
___
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


How can I "fake" the appearance of merged cells (like in Excel)

2016-09-16 Thread Roger Eller
I have a table field with about 10 columns. Some of the cells may contain
the same data as the cell above and/or below it.  I want to visually
portray these occurances as a single cell with the text centered within the
visually larger cell.

How would you approach this problem?  Would you overlay an opaque field
whose rectangle is that of the combined cells?

I need it to scroll too.  Thoughts?  Creative solutions?  No, not gonna use
Excel.  ;-)

~Roger
___
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