Farbflash projects: Imaging lingo table | 3-D scene list | Find all | Handler menu | Lingo message window

Ignore:
Timestamp:
09/29/11 12:55:54 (8 months ago)
Author:
alex
Message:

updated scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lingosource/castlib1/TableManager.ls

    r61 r71  
    11-- Manager for DrawTable Parentscript used on Bitmap sprites and 3-D Sprites 
    2 -- Alex da Franca c2002  da.franca@online.de 
     2-- Alex da Franca c2002  alex@farbflash.de 
    33-- Use this behavior on any dummy sprite to display a scrolling table with selectable items, text (fixed and editable) and images. 
    44-- It creates a temporary bitmap member, which is used to display the table on the stage. 
     
    18131813  if voidP(retval) then retval = [:] 
    18141814  return retval 
     1815end 
     1816 
     1817-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1818 
     1819on mAXTable_RefreshItem me, cellObject, refreshBackGround, tabname 
     1820    ----------------------------------- 
     1821  -- ACTION: Render a single cell 
     1822  --         render only one single cell, after changing its properties (e.g. #selected) NOT the #content property !!! 
     1823  --         ALWAYS change the content of a cell ONLY with the handler: mSetCellContent()  
     1824  --            to take a change of lineheight into consideration 
     1825  --         of course, if you change the content of a cell and don't want the dimension of the cell to change 
     1826  --            you can go with this function, much faster.. 
     1827  -- INPUT: <cellObject> ; object ; can be: 
     1828  --                                    a cell object itself 
     1829  --                                    or a linear list of two integers => [row, column] 
     1830  --                                    or a string => name of the cell 
     1831  --        <refreshBackGround> ; boolean (integer) ; whether to referesh the background as well 
     1832  --                                                  (only relevant for cells with a transparent background e.g. an image for the whole table) 
     1833  --        <tabname> ; string ; name of the table, which shall be addressed, 
     1834  --                              if empty, the first table in the list of tables is used 
     1835  -- RETURNS: - 
     1836  -- EXAMPLES: sendSprite(xscr().mGetKanal(#tableSprite), #mAXTable_RefreshItem, cellRef, 0, "myTable") 
     1837  --                         -- refresh cell 3 in row 2 
     1838  --           sendSprite(xscr().mGetKanal(#tableSprite), #mAXTable_RefreshItem, [2, 3], 0, "myTable") 
     1839  --                         -- the same as above 
     1840  --           sendSprite(xscr().mGetKanal(#tableSprite), #mAXTable_RefreshItem, "cellName", 0, "myTable") 
     1841  --                         -- the same as above 
     1842  ----------------------------------- 
     1843   
     1844  if count(pTableList) < 1 then exit 
     1845   
     1846  if not voidP(tabname) then 
     1847    table = pTableList.getaprop(tabname) 
     1848  else 
     1849    table = pTableList[1] 
     1850  end if 
     1851  if ilk(table) <> #proplist then exit 
     1852  scr = table.getaprop(#myScriptObject) 
     1853   
     1854  if objectP(scr) then 
     1855    if ilk(cellObject) = #string then 
     1856      cellObject = mGetCellByName(me, cellObject, tabname) 
     1857    else 
     1858      if ilk(cellObject) = #list then cellObject = mGetCellByIndex(me, cellObject, tabname) 
     1859    end if 
     1860   
     1861    if objectP(cellObject) then call(#mRefreshItem, scr, cellObject, refreshBackGround) 
     1862  end if 
     1863end 
     1864 
     1865-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1866 
     1867on mSetCellProperty me, cellObject, symbol_propname, any_propvalue, tabname 
     1868  ----------------------------------- 
     1869  -- ACTION: Change a property (e.g. #myFontColor) NOT the #content of a single cell and render that single cell 
     1870  --         ALWAYS change the content of a cell ONLY with the handler: mSetCellContent()  
     1871  --            to take a change of lineheight into consideration 
     1872  --         of course, if you change the content of a cell and don't want the dimension of the cell to change 
     1873  --            you can go with this function, much faster.. 
     1874  --         If you use mSetCellContent, you can change any other cell property before that call, 
     1875  --            as it will re-render the whole cell anyway 
     1876  -- INPUT: <cellObject> ; object ; can be: 
     1877  --                                    a cell object itself 
     1878  --                                    or a linear list of two integers => [row, column] 
     1879  --                                    or a string => name of the cell 
     1880  --        <symbol_propname> ; symbol ; one of several cell properties EXCEPT #content 
     1881  --        <any_propvalue> ; new value for the above property 
     1882  --        <tabname> ; string ; name of the table, which shall be addressed, 
     1883  --                              if empty, the first table in the list of tables is used 
     1884  -- RETURNS: - 
     1885  -- EXAMPLES: sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellProperty, cellRef, #myBGColor, rgb(200, 200, 220), "myTable") 
     1886  --                         -- refresh cell 3 in row 2 
     1887  --           sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellProperty, [2, 3], #myBGColor, rgb(200, 200, 220), "myTable") 
     1888  --                         -- the same as above 
     1889  --           sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellProperty, "cellName", #myBGColor, rgb(200, 200, 220), "myTable") 
     1890  --                         -- the same as above 
     1891  ----------------------------------- 
     1892 
     1893 
     1894  if ilk(cellObject) = #string then 
     1895    cellObject = mGetCellByName(me, cellObject, tabname) 
     1896  else 
     1897    if ilk(cellObject) = #list then cellObject = mGetCellByIndex(me, cellObject, tabname) 
     1898  end if 
     1899 
     1900  if objectP(cellObject) then 
     1901    cellObject[symbol_propname] = any_propvalue 
     1902    mAXTable_RefreshItem(me, cellObject, 1, tabname) 
     1903  end if 
     1904end 
     1905 
     1906-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1907 
     1908on mSetCellProperties me, cellObject, proplist_newProps, tabname 
     1909  ----------------------------------- 
     1910  -- ACTION: Bulk change several properties (e.g. #myFontColor, NOT the #content or font properties, size and font and antialias) 
     1911  --            of a single cell and render that single cell 
     1912  --         ALWAYS change the content of a cell ONLY with the handler: mSetCellContent()  
     1913  --            to take a change of lineheight into consideration 
     1914  --         of course, if you change the content of a cell and don't want the dimension of the cell to change 
     1915  --            you can go with this function, much faster.. 
     1916  --         If you use mSetCellContent, you can change any other cell property before that call, 
     1917  --            as it will re-render the whole cell anyway 
     1918  -- INPUT: <cellObject> ; object ; can be: 
     1919  --                                    a cell object itself 
     1920  --                                    or a linear list of two integers => [row, column] 
     1921  --                                    or a string => name of the cell 
     1922  --        <proplist_newProps> ; proplist ; property list with new values for the specified properties 
     1923  --        <tabname> ; string ; name of the table, which shall be addressed, 
     1924  --                              if empty, the first table in the list of tables is used 
     1925  -- RETURNS: - 
     1926  -- EXAMPLES: sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellProperties, cellRef, [#myBGColor: rgb(200, 200, 220), #myFontColor: rgb(20, 30, 40)], "myTable") 
     1927  --                         -- refresh cell 3 in row 2 
     1928  --           sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellProperties, [2, 3], [#myBGColor: rgb(200, 200, 220), #myFontColor: rgb(20, 30, 40)], "myTable") 
     1929  --                         -- the same as above 
     1930  --           sendSprite(xscr().mGetKanal(#tableSprite), #mSetCellProperties, "cellName", [#myBGColor: rgb(200, 200, 220), #myFontColor: rgb(20, 30, 40)], "myTable") 
     1931  --                         -- the same as above 
     1932  ----------------------------------- 
     1933   
     1934  if not(objectP(proplist_newProps)) then exit 
     1935   
     1936  if ilk(cellObject) = #string then 
     1937    cellObject = mGetCellByName(me, cellObject, tabname) 
     1938  else 
     1939    if ilk(cellObject) = #list then cellObject = mGetCellByIndex(me, cellObject, tabname) 
     1940  end if 
     1941 
     1942  if objectP(cellObject) then 
     1943    repeat with n = count(proplist_newProps) down to 1 
     1944      cellObject[proplist_newProps.getPropAt(n)] = proplist_newProps[n] 
     1945    end repeat 
     1946     
     1947    mAXTable_RefreshItem(me, cellObject, 1, tabname) 
     1948  end if 
    18151949end 
    18161950 
Note: See TracChangeset for help on using the changeset viewer.