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

BNig bernd.niggemann at uni-wh.de
Sun Sep 18 16:31:30 EDT 2016


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.




More information about the use-livecode mailing list