For reference: I have solved my problem with: self.getContainerElement().setAttribute('class', 'dialog-div')
On Saturday, June 30, 2012 11:34:10 AM UTC+2, Daniel Gonzalez wrote: > > Thanks Rich, > > You got me again in the right track with your general comment. Now I see > that all has to do with the CSS applied. As I said I am deriving from > PopupPanel, like this: > > class MyDialog(PopupPanel): > def __init__(self, widget, left = 50, top = 50, **kwargs): > Logger("MyDialog", "Initializing. widget=%s" % (widget)) > PopupPanel.__init__(self, glass = True, **kwargs) > self.setWidget(widget) > self.setPopupPosition(left, top) > Logger("MyDialog", "Position set to %d %d" % (left, top)) > #self.getContainerElement().setStyleName('dialog-div') > > def setPopupPosition(self, left, top): > Logger("MyDialog", "Setting position to %d %d" % (left, top)) > if left < 0: > left = 0 > if top < 0: > top = 0 > element = self.getElement() > Logger("MyDialog", "element = %s" % (element)) > DOM.setStyleAttribute(element, "left", "%dpx" % left ) > DOM.setStyleAttribute(element, "top", "%dpx" % top) > > This is supposed to be a popug containing a generic widget. It is still a > work in progress as you can see by the trivial logging entries (I am having > strange problems and since I do not understand this fully, I am logging all > I can to get a feeling of it). I have taken a look at the html generated, > and I have a <div> containing my widget. The problem that I have is that I > need to apply a style to this div (z-index, background, ...), but I am > unable to set the style of the div in PopuPanel. Is it possible? My call to: > > self.getContainerElement().setStyleName('dialog-div') > > Is not working: > > Uncaught TypeError: Object [object HTMLDivElement] has no method > 'setStyleName' > > Thanks, > Daniel > > On Friday, June 29, 2012 2:05:58 PM UTC+2, Rich Newpol wrote: >> >> "Popups" are tricky because they are a trick :) Aside from getting them >> to appear correctly, you have to do some stuff to get "modal" behaviour >> (that's usually what what you want with a popup) as well as to get the >> children to position and render correctly. It's hard to know exactly what >> your problem is without a working example, but it sounds like you are not >> using absolute positioning for the child element correctly. Remember that >> PopupPanel derives from SimplePanel, so it only should have one child. >> Generally, that's some container panel that *you* construct with your >> layout controls inside it (again using absolute positioning). >> >> Not sure if that helps or not, but maybe you can tell us more... >> >> Rich >> >> On Thu, Jun 28, 2012 at 8:17 PM, Daniel Gonzalez <gonva...@gmail.com>wrote: >> >>> Hi, >>> >>> I am trying to create my first popup panel, and I do not yet know how to >>> start. I have taken a look at the examples in "shell", but I am no sure I >>> understand how this is supposed to work. >>> >>> What I want to do is to have a popup window displaying a form with some >>> controls (title, some text, drop downs, some buttons, ...) >>> I have tried to derive from PopupPanel, but the components displayed do >>> not "pop up", they are just showing somewhere in the middle of my >>> "background" components. >>> >>> My popup should be a separate "window", which can be moved around, I can >>> then interact with its components, and it will be dismissed when the data >>> has been entered (the data will be submitted via JSNORPC to my server). >>> >>> What is the suitable base class for this kind of popup? How can I force >>> my popup to "stick out" of my window? >>> >>> Thanks, >>> Daniel >>> >> >>