| 1 | <html> |
|---|
| 2 | <head> |
|---|
| 3 | <title>AlexTableScript: CellProperties</title> |
|---|
| 4 | </head> |
|---|
| 5 | <body bgcolor="#FFFFFF"> |
|---|
| 6 | <font face="Geneva, MS Sans Serif" size=4>The content for the table is provided as property list: <p> |
|---|
| 7 | <b>-- itemlist: property list with two properties:<p> |
|---|
| 8 | </b>#myItems = the cell content and formatting<br> |
|---|
| 9 | #columnInfo = the column widths<br> |
|---|
| 10 | (there is also a #sorttype property for columns in case of sorting the column<br> |
|---|
| 11 | the values can be #alphanumeric or #numeric, #numeric sorts by value rather than by ascii value)<p> |
|---|
| 12 | </font><font color="#000088">rowCells = []<br> |
|---|
| 13 | columnInfo = []<br> |
|---|
| 14 | itemList[#myItems] = rowCells<br> |
|---|
| 15 | itemList[#verteilung] = columnInfo<p> |
|---|
| 16 | </font><font size=3 color="#000000">#verteilung defines the column widths either absolut (-> integer) or relativ (-> float = %) or both mixed up<p> |
|---|
| 17 | </font><font color="#EE0000">-- example: five columns with 150 pixels each:<p> |
|---|
| 18 | </font><font color="#000088">repeat with n = 1 to 5<br> |
|---|
| 19 | column = [:]<br> |
|---|
| 20 | column[#myWidth] = 150<br> |
|---|
| 21 | -- column[#myWidth] = 0.2 -- this would be 20 % of tableformatlist[#targrect].width<br> |
|---|
| 22 | columnInfo.add(column)<br> |
|---|
| 23 | end repeat<p> |
|---|
| 24 | <br> |
|---|
| 25 | </font><font color="#EE0000">-- another example with % and alignmenmt for each column:<p> |
|---|
| 26 | </font><font color="#000088">columnninfo = [[0.08, #right], [0.23, #left], [0.07, #right], [0.12, #right], [0.1, #left], [0.12, #right], [0.12, #right], [0.16, #right]]<p> |
|---|
| 27 | cnt = columnninfo.count<br> |
|---|
| 28 | repeat with hn = 1 to cnt<br> |
|---|
| 29 | column = [:]<br> |
|---|
| 30 | column[#myWidth] = columnninfo[hn][1]<br> |
|---|
| 31 | column[#halign] = columnninfo[hn][2]<br> |
|---|
| 32 | columnInfo.add(column)<br> |
|---|
| 33 | end repeat<p> |
|---|
| 34 | <br> |
|---|
| 35 | </font><font color="#000000">-- row = property list = one row<br> |
|---|
| 36 | -- may have all the formatting properties as tableformatlist has and overrides them for this row<br> |
|---|
| 37 | -- and must have a property: #myItems which is a linear list containing the single cell information<p> |
|---|
| 38 | </font><font color="#EE0000">-- <tr><br> |
|---|
| 39 | </font><font color="#000088">row = [:]<br> |
|---|
| 40 | rowCells = []<br> |
|---|
| 41 | row[#myItems] = rowCells<br> |
|---|
| 42 | row[#myBorderWidth] = 0<br> |
|---|
| 43 | row[#myBorderColor] = rgb(50,50,50)<br> |
|---|
| 44 | row[#myBGColor] = rgb( 238, 216, 195 )<p> |
|---|
| 45 | <br> |
|---|
| 46 | </font><font color="#000000"><b>-- thisCell = property list = single cell<br> |
|---|
| 47 | </b>-- may have all the formatting properties as tableformatlist or #row has and overrides them for this cell<br> |
|---|
| 48 | -- beyond the formatting props there are other props:<p> |
|---|
| 49 | </font><font color="#EE0000"><b>-- required:<p> |
|---|
| 50 | </font></b><font color="#000000">-- thisCell[#<b>myType</b>] = <symbol> type of this cell; possible values: #edittext, #textcell, #imagecell, </font><font color="#004000">#</font><font color="#000000">divider<p> |
|---|
| 51 | -- thisCell[#<b>myContent</b>] = <string>, <image> content of this cell;<br> |
|---|
| 52 | -- if #myType = #imagecell -> accepts image object or <string> in case of <string> the image of member(<string>) is used, if a member(<string>) of type #bitmap exists<p> |
|---|
| 53 | </font><font color="#EE0000"><b>-- not required:<p> |
|---|
| 54 | </font></b><font color="#000000">-- thisCell[#<b>myName</b>] = <string> cellname to reference a cell by name; default = "zelle"&<row>&<column><br> |
|---|
| 55 | -- thisCell[#<b>colspan</b>] = <integer> column span; default = 1<p> |
|---|
| 56 | -- thisItem[#<b>selectable</b>] = <boolean> reacts on mouse Over and Up and sends messages; default = false<p> |
|---|
| 57 | -- thisCell[#<b>minimumLineHeight</b>] = <integer> minimum height of cells (useful for cells with an empty string or only a space); default = 0<p> |
|---|
| 58 | -- thisCell[#<b>nowrap</b>] = <boolean> text doesn't wrap to next line, if it doesn't fit into the columns width, but rather gets cropped<p> |
|---|
| 59 | -- thisItem[#<b>sortby</b>] = <any> 'invisible' sort criterium rather than sorting by thisItem[#myContent] (= default)<p> |
|---|
| 60 | <br> |
|---|
| 61 | </font><font color="#EE0000">-- if #myType = #edittext:<p> |
|---|
| 62 | </font><font color="#000000">-- thisCell[#<b>allowedChars</b>] = <string> accepted chars; default = "" (EMPTY string allows all chars)<p> |
|---|
| 63 | -- thisCell[#<b>numChars</b>] = <integer> allowed number of chars; default = 0 (0 = unlimited -> scrolls horizontal)<p> |
|---|
| 64 | </font><font color="#EE0000">-- if #myType = #imagecell:<p> |
|---|
| 65 | </font><font color="#000000">-- thisCell[#<b>inkmode</b>] = <integer> directors inkmodes;<br> |
|---|
| 66 | -- thisCell[#<b>myBlendLevel</b>] = <integer> blendlevel, range: 0 - 255;<p> |
|---|
| 67 | </font><font color="#EE0000">-- Button cells:<p> |
|---|
| 68 | </font><font color="#000000">-- thisCell[#<b>isButton</b>] = <symbol> allows an #imagecell to act as button; default = #none; possible values: #none, #push, #radio, #toggle, #sortbutton<p> |
|---|
| 69 | -- thisCell[#<b>myPressImage</b>] = <imageObject or string> selfexplaining; default: thisCell[#myContent]<p> |
|---|
| 70 | -- thisCell[#<b>myOverImage</b>] = <imageObject or string> selfexplaining; default: thisCell[#myContent]<p> |
|---|
| 71 | -- thisCell[#<b>myGroupname</b>] = <string> used to group toggle buttons #default: "Group1"<p> |
|---|
| 72 | -- thisCell[#myKeyboardShortCut] = <string> keyboardshortcut for this button. only the first char is used. Use RETURN to mimic the default button<p> |
|---|
| 73 | </font><font color="#EE0000">-- if #myType = #divider:<p> |
|---|
| 74 | </font><font color="#000000">-- thisCell[#<b>lineSize</b>] = <integer><p> |
|---|
| 75 | <br> |
|---|
| 76 | </font><font color="#EE0000">-- further all formatting properties as tableformatlist or #row has and overrides them for this cell<p> |
|---|
| 77 | <br> |
|---|
| 78 | -- examples for different cells:<p> |
|---|
| 79 | -- <td> -- simple text cell<br> |
|---|
| 80 | </font><font color="#000088">thisItem = [:]<br> |
|---|
| 81 | thisItem[#myType] = #textcell<br> |
|---|
| 82 | thisItem[#myContent] = "einerderrechtsalignedwirdeinerderrechtsalignedwird"<br> |
|---|
| 83 | thisItem[#halign] = #right<br> |
|---|
| 84 | thisItem[#myBGColor] = rgb(0,0,200)<br> |
|---|
| 85 | thisItem[#selectable] = 0<br> |
|---|
| 86 | rowCells.add(thisItem)<br> |
|---|
| 87 | </font><font color="#EE0000">-- </td><p> |
|---|
| 88 | <br> |
|---|
| 89 | -- <td> --- simple image cell<br> |
|---|
| 90 | </font><font color="#000088">thisItem = [:]<br> |
|---|
| 91 | thisItem[#myType] = #imagecell<br> |
|---|
| 92 | thisItem[#myContent] = "whale"<br> |
|---|
| 93 | thisItem[#myBGColor] = rgb(0,200,0)<br> |
|---|
| 94 | thisItem[#halign] = #center<br> |
|---|
| 95 | thisItem[#valign] = #center<br> |
|---|
| 96 | thisItem[#colspan] = 3<br> |
|---|
| 97 | thisItem[#selectable] = 1<br> |
|---|
| 98 | rowCells.add(thisItem)<br> |
|---|
| 99 | </font><font color="#EE0000">-- </td><p> |
|---|
| 100 | -- <td> -- imagecell acting as button<br> |
|---|
| 101 | </font><font color="#000088">thisItem = [:]<br> |
|---|
| 102 | thisItem[#myType] = #imagecell<br> |
|---|
| 103 | thisItem[#myContent] = myNormalButtonImage<br> |
|---|
| 104 | thisItem[#isButton] = #toggle<br> |
|---|
| 105 | thisItem[#myGroup] = "custom group"<br> |
|---|
| 106 | thisItem[#myPressImage] = myPressedButtonImage<br> |
|---|
| 107 | thisItem[#myOverImage] = myRolloverButtonImage<br> |
|---|
| 108 | thisItem[#myBGColor] = rgb(0,200,0)<br> |
|---|
| 109 | thisItem[#halign] = #center<br> |
|---|
| 110 | thisItem[#valign] = #center<br> |
|---|
| 111 | thisItem[#selectable] = 1<br> |
|---|
| 112 | rowCells.add(thisItem)<br> |
|---|
| 113 | </font><font color="#EE0000">-- </td><p> |
|---|
| 114 | -- <td> -- <hr><br> |
|---|
| 115 | </font><font color="#000088">thisCell = [:]<br> |
|---|
| 116 | thisCell[#myType] = #divider<br> |
|---|
| 117 | thisCell[#myContent] = ""<br> |
|---|
| 118 | thisCell[#lineSize] = 4<br> |
|---|
| 119 | rowCells.add(thisCell)<br> |
|---|
| 120 | </font><font color="#EE0000">-- </td><p> |
|---|
| 121 | -- <td> -- editable text<br> |
|---|
| 122 | </font><font color="#000088">thisCell = [:]<br> |
|---|
| 123 | thisCell[#myType] = #edittext<br> |
|---|
| 124 | thisCell[#myContent] = "12"<br> |
|---|
| 125 | thisCell[#allowedChars] = "0123456789"<br> |
|---|
| 126 | thisCell[#numChars] = 4<br> |
|---|
| 127 | rowCells.add(thisCell)<br> |
|---|
| 128 | </font><font color="#EE0000">-- </td><p> |
|---|
| 129 | </font><font color="#000088">rowCells.add(row)<br> |
|---|
| 130 | </font><font color="#EE0000">-- </tr><p> |
|---|
| 131 | </font><font color="#000088">derkanal = mGetKanal(#tablekanal)<br> |
|---|
| 132 | if derkanal > 0 then sendsprite(derkanal, #mShowTable, itemList, tableformatlist, "tablename")</font><font color="#000000"> </font></body> |
|---|
| 133 | </html> |
|---|