Alright, so I am trying for the life of me to understand how to do
this. I'm a GWT noob at the moment, and I'm really struggling to
understand how to fully implement clickhandlers in a grid or flex
table to figure out where they are clicking within the grid.
Apparently from what I can see so far is that individual click
handlers for each location in the grid were not meant to be
implemented. Instead it seems that I can implement a single click
handler for the entire grid, and then somehow using "getCellForEvent
(ClickHandler handler)" I can figure out where was clicked and then
have it react, but I can't seem to figure out how to implement
getCellForEvent() into my code. Here's what I'm using:

private Grid calendarGrid = new Grid(4,4);
        private int cellNum;

        public void onModuleLoad() {
                // Put some values in the grid cells.
            for (int row = 0; row < 4; ++row) {
              for (int col = 0; col < 4; ++col)
                calendarGrid.setText(row, col, "(" + row + ", " + col + ")");
            }
            calendarGrid.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                        getCellForEvent(event);
                }
            });

            RootPanel.get().add(calendarGrid);

        }

What I'm ultimately trying to do:
I'm trying to make something very similar to what's here:
http://google.latest.gwt-web-calendar.appspot.com/
I need to make a calendar-ish program but have some unique
functionality. Everything will be easy enough, but I need to have an
in-depth understanding of how to manipulate the events on such a
calendar once I have it made. The reason I bring this up, is because I
currently intend to have the calendar aspect just be one big grid, and
act according to clicks and drags. I'm not sure if this is a very
efficient way though, and I can't figure how I would display multiple
events, but once I get that figured out I need to have the events
dragable. That seems manageable on a grid (I think), I'm just not sure
how I would limit events to parts of a grid space.

So my questions:
1. How would I implement getCellForEvent into my above code?

2. Do you think my current idea of how to implement my program idea is
going to be effective? Is there perhaps another way you feel I should
do it?

3. What way would you recommend I handle events within the calendar?
That seems to be the part that I'm having the most difficulty
conceptualizing at the moment.

Thanks in advance!

~Scott

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to