Re: selection of a cell from multiple cells on a row in the table
puicheng2004 <puicheng <at> sympatico.ca>
2005-10-26 11:44:16 GMT
Hi,
It doesn't seem to detect selected cell. Your case is pretty similar
to my room reservation scenario. You could build your own grid using
textfield or button. See http://demo.artsoft.ca/
Clifford
--- In thinlet <at> yahoogroups.com, "bibhutiparida2002"
<bibhutiparida2002 <at> y...> wrote:
>
> i have made something for this preblem.
> just look at these codes:
>
> String[] arrTime = {"12:00 AM", "12:30 AM", "1:00 AM", "1:30 AM",
> "2:00 AM", "2:30 AM", "3:00 AM", "3:30
> AM","4:00 AM",
> "4:30 AM", "5:00 AM", "5:30 AM", "6:00
> AM", "6:30 AM",
> "7:00 AM", "7:30 AM", "8:00
> AM", "8:30 AM", "9:00 AM",
> "9:30 AM", "10:00
> AM", "10:30 AM", "11:00 AM", "11:30 AM",
> "12:00 PM", "12:30
> PM", "1:00 PM", "1:30 PM", "2:00 PM",
> "2:30 PM", "3:00 PM", "3:30
> PM", "4:00 PM", "4:30 PM",
> "5:00 PM", "5:30 PM", "6:00
> PM", "6:30 PM", "7:00 PM",
> "7:30 PM", "8:00 PM", "8:30
> PM", "9:00 PM", "9:30 PM",
> "10:00 PM", "10:30
> PM", "11:00 PM", "11:30 PM"};
>
>
>
> Object table;
>
> if ((table = mm.find("Body")) != null) {
> Object[] items = mm.getItems(table);
>
> for (int i = 1; i < items.length; i++)
> {
> mm.remove(items[i]);
> }
>
> for (int i = 0; i < arrTime.length; i++) {
>
> Object objpan = mm.create("panel");
> mm.setString(objpan, "name", "panel" + i);
> mm.setBoolean(objpan, "border", false);
> mm.setInteger(objpan, "colspan", 1);
> mm.setInteger(objpan, "columns", 0);
> mm.setBoolean(objpan, "enabled", true);
> mm.setChoice(objpan, "halign", "fill");
> mm.setInteger(objpan, "height", 0);
> mm.setBoolean(objpan, "scrollable", false);
> mm.setChoice(objpan, "valign", "fill");
> mm.setBoolean(objpan, "visible", true);
> mm.setInteger(objpan, "weightx", 1);
> mm.setInteger(objpan, "weighty", 0);
>
> Object objtable1 = mm.create("table");
> mm.setString(objtable1, "name", "table1" +
> i);
> mm.setInteger(objtable1, "height", 20);
> mm.setInteger(objtable1, "width", 55);
> mm.setInteger(objtable1, "weightx", 0);
> mm.setInteger(objtable1, "weighty", 0);
> mm.setBoolean(objtable1, "enabled", true);
> mm.setBoolean(objtable1, "visible", true);
>
> Object objtable2 = mm.create("table");
> mm.setString(objtable2, "name", "table2" +
> i);
> mm.setInteger(objtable2, "height", 20);
> mm.setInteger(objtable2, "width", 20);
> mm.setInteger(objtable2, "weightx", 1);
> mm.setInteger(objtable2, "weighty", 0);
> mm.setMethod
> (objtable2, "action", "selectedRow(this)", this, this);
>
> Object objRow1 = mm.create("row");
> Object objRow2 = mm.create("row");
>
> Object objCell1 = mm.create("cell");
> mm.setString(objCell1, "name", "cell1" + i);
> mm.setString(objCell1, "text", arrTime[i]);
> mm.setChoice(objCell1, "alignment", "left");
>
> if (i >= 8 && i <= 17)
> mm.setColor(objCell1, "background", new Color
> (255, 255, 255));
> else
> mm.setColor(objCell1, "background", new Color
> (238, 238, 229));
>
> Object objCell2 = mm.create("cell");
> mm.setString(objCell2, "name", "cell2" + i);
> mm.setString(objCell2, "text", "");
> mm.setChoice(objCell2, "alignment", "left");
>
> mm.add(objRow1, objCell1);
> mm.add(objRow2, objCell2);
>
> mm.add(objtable1, objRow1);
> mm.add(objtable2, objRow2);
> mm.add(objpan, objtable1);
> mm.add(objpan, objtable2);
>
> mm.add(table, objpan);
> }
> }
>
> next for creating dynamic tables:
>
>
> if (dd == day && mon == month && yy == year)
> {
> String subject = temp.elementAt
> (2).toString();
> String location = temp.elementAt
> (3).toString();
> for (int j = 0; j < 48; j++)
> {
> Object objpanel = mm.find
> ("panel" + j);
> Object objtable1 = mm.find
> (objpanel, "table1" + j);
>
> Object cell = mm.find
> (objtable1, "cell1" + j);
> cellValue = mm.getString
> (cell, "text");
> //int k = 2;
> if (cellValue.equals(time))
> {
> int noOfTables =
> mm.getItems(objpanel).length;
>
> Object objtable2 =
> mm.find(objpanel, "table"+ noOfTables+"" + j);
> Object cellSubject =
> mm.find(objtable2, "cell"+ noOfTables+"" + j);
> if (mm.getString
> (cellSubject, "text").equals("")) {
> mm.setString
> (cellSubject, "text", subject+"("+location+")");
>
> //mm.screenIcons.addIcon("CalendarScreen", "cell2" +
> j, "Appointment.gif" );
> } else {
> Object table
> = mm.create("table");
> mm.setString
> (table, "name", "table" + (noOfTables+1)+"" + j);
> mm.setInteger
> (table, "height", 20);
> mm.setInteger
> (table, "width", 20);
> mm.setInteger
> (table, "weightx", 1);
> mm.setInteger
> (table, "weighty", 0);
> mm.setMethod
> (table, "action", "selectedRow(this)", this, this);
> Object objRow = mm.create
> ("row");
>
> Object objCell = mm.create
> ("cell");
> mm.setString
> (objCell, "name", "cell" + (noOfTables+1)+"" + j);
> mm.setString(objCell, "text",
> subject+"("+location+")");
> mm.setChoice
> (objCell, "alignment", "left");
>
> mm.add(objRow, objCell);
> mm.add(table, objRow);
> mm.add(objpanel, table);
> }
> }
>
> }
> }
>
>
>
> --- In thinlet <at> yahoogroups.com, "bibhutiparida2002"
> <bibhutiparida2002 <at> y...> wrote:
> >
> > Hi,
> >
> > i am not able to select a patricular cell from
> > table having a row with multiple cells.
> > i want to clicking on the particular cell, it will display the
> value
> > of that cell instead of all cell values.
> >
> >
> > please help me.
> >
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~->
_________________________________________________________________
Thinlet Project Site | http://thinlet.com
Thinlet Addon Central | http://thinletplus.com
Thinlet World News Blog | http://thinletworld.com
Thinlet F.A.Q. | http://xul.sourceforge.net/thinfaq.html
(Continue reading)