Odd behaviours of PopupPanels

2 views
Skip to first unread message

Moskito

unread,
Aug 13, 2006, 5:21:47 PM8/13/06
to Google Web Toolkit
Hello

I'm using gwt 1.1 and I have some troubles with PopupPanels.

First, I added a PopupPanel to my document and use setStyleName to set
the style for it. So far, so good, but as soon as I use setPixelSize to
resize the PopupPanel, it looses its style and turns white. Below is a
snippet of the code where I'm using it. It's the onBrowserEvent of my
class called SPGrid, which extends a Grid. Am I using setPixelSize the
right way? Do I have to call some kind of a refresh function to get the
PopupPanel repainted?

public void onBrowserEvent(Event event)
{
Element td;
Element tr;
Element body;
int row;
int column;

switch (DOM.eventGetType(event))
{
case Event.ONMOUSEDOWN:
this.setText(0, 0, ""+Math.random());
td = getEventTargetCell(event);
if (td == null)
break;
tr = DOM.getParent(td);
body = DOM.getParent(tr);
row = DOM.getChildIndex(body, tr);
column = DOM.getChildIndex(tr, td);

if(column == 0 || column == this.getColumnCount()-1)
break;

DOM.setCapture(this.getBodyElement());

DragTopStart = SPGrid.eventGetAbsoluteTop(event);
DragRowStart = row;
DragCol = column;
greyPopupDrag = true;

greyPopup.setPixelSize(SPGrid.getOffsetWidth(td),
SPGrid.getOffsetHeight(td)+1);
greyPopup.setPopupPosition(DOM.getAbsoluteLeft(td),
DOM.getAbsoluteTop(td));
greyPopup.show();
break;

case Event.ONMOUSEMOVE:
if (greyPopupDrag)
{
td = this.getCellFormatter().getElement(DragRowStart, DragCol);
int evtTop = SPGrid.eventGetAbsoluteTop(event);
int pHeight = 0;
int pWidth = SPGrid.getOffsetWidth(td);

if(DragTopStart<=evtTop)
{
pHeight = (int) Math.floor(((double)evtTop -
DOM.getAbsoluteTop(td))/SPGrid.getOffsetHeight(td)+1)*SPGrid.getOffsetHeight(td);
if(pHeight > (this.getOffsetHeight()-(DOM.getAbsoluteTop(td) -
this.getAbsoluteTop())))
pHeight = (this.getOffsetHeight()-(DOM.getAbsoluteTop(td) -
this.getAbsoluteTop()))-1;
greyPopup.setPixelSize(pWidth, pHeight);
}
}
break;
case Event.ONMOUSEUP:
if (greyPopupDrag)
{
int intDragRowEnd = DragRowStart + (int)
(greyPopup.getOffsetHeight()/SPGrid.getOffsetHeight(this.getCellFormatter().getElement(DragRowStart,
DragCol)))-1;
DOM.releaseCapture(this.getBodyElement());
greyPopup.hide();
greyPopupDrag = false;
spgridlisteners.fireEventTimeSelected(DragRowStart, DragCol,
intDragRowEnd, DragCol);
t = new SPGridEventBox("Caption", "Desc", DragRowStart,
intDragRowEnd, DragCol, this);
}
break;
}
super.onBrowserEvent(event);
}


Second, after ONMOUSEUP, I add a DialogBox to my document, but after
having added it, my spgrid-class doesn't receive mouse events anymore.
Does it have to be like that? And if yes, is there a workaround to
receive mouseevents even if one or more DialogBox' were added to the
document?

Thanks.

Beni

Reply all
Reply to author
Forward
0 new messages