regular HTML has no notion of a double-click, it is in many ways very much a windows thing (just ask a mac user)
So anything that's reacting to a double-click is obviously doing it via javascript code that is looking for that event to occur. So using .fire_event is the way to go. The challenge is figuring out a) what element on the page you need to fire the event against b) if some precursor event is needed such as mouseover c) (sometimes) what element you have to fire the precursor event against. the choice of elements is usually limited to whatever is stacked in that area, it might be the table cell, or it might be the div that holds the graphic. If there's more than one clickable thing inside the cell, then the cell itself won't be it. If the "Hutchison, Robb" text is not double-clickable (or does something else when you double- click it) then the span (which I mistakenly called a div in my code below, sorry) is likely to be what you have to click on. I find using IRB the easiest way to develop/debug stuff like this because you can work at your own pace, fire specific events and watch what happens as a result. On Apr 14, 12:07 pm, Francisco Diaz Trepat - gmail <[email protected]> wrote: > Yes I know. I think ZK has a global event handler, because there is no > ondoubleclick > > ondblclick sorry > > I really don't know how to address a double click, the click method works > fine and paints the row, but the double click action is suppose to selected > and close the popup window (fake popup) and put the selected on a label on > the owner window. > > I am lost. > > f(t) > > On Thu, Apr 14, 2011 at 3:57 PM, Chuck van der Linden <[email protected]>wrote: > > > > > > > > > I don't see any onmouseover stuff in the code you presented. > > > I do see onmousedown > > > perhaps try firing that first, against the z-tree div itself? > > > The other thing is, do you know it's always the first div of class z- > > tree-cell-cnt > > > If so the other contents don't matter, just address things starting > > from the first index of a div of that class. > > > Otherwise if it's the first time you see the close arrow then go for > > the first instance of that div to get your element > > > element = browser.div(:class ==> "z-tree-ico z-tree-root- > > close", :index ==> 0) > > > On Apr 13, 7:36 am, Francisco Diaz Trepat - gmail > > <[email protected]> wrote: > > > Hi guys I am trying to do a select on a patient by which I need to do a > > > double click on a table row. > > > > The ZK part is this: > > > > public void render(Treeitem item, Object data) throws Exception { > > > blah blah... some code.... > > > item.getTreerow().addEventHandler("onDoubleClick", new > > EventHandler(new > > > ZScript( > > > null, "java", > > > "ar.com.eoc.hco.util.ComponentsUtil.getContainerWindow(self).doAction(self.parent.value)", > > > null), > > > null)); > > > blah blah some other code. > > > > My latest futile (that I read on some blog about doing first a > > onmouseover > > > and then the doubleclick) try is: > > > > if(@browser.div(:class, "z-window-modal").divs(:class, > > > "z-tree-cell-cnt")[0].exist? and @browser.div(:class, > > > "z-window-modal").div(:text, patient_medical_record.to_s).exist?) then > > > #this element holds a small right pointing arrow that collapses > > when > > > clicked, but also is the first left most element in the row. > > > element = @browser.div(:class, "z-window-modal").divs(:class, > > > "z-tree-cell-cnt")[0].span(:class, "z-tree-ico z-tree-root-close") > > > sleep 3 > > > #element.parent.parent.parent.click > > > puts "First OnClick Fired" > > > element.parent.parent.parent.fire_event("onmouseover", 1) > > > element.parent.parent.parent.fire_event("ondblclick", 1) > > > > sleep 5 > > > end > > > > This throws a JavaScript Error: > > > > For input string: "NaN" > > > > Any Ideas? How about trying to execute the javascript function delegate > > for > > > the event? > > > > Please I really need Urgent help, I am working on an Ubuntu 10.10 64 > > machine > > > and I am not used to the WebDriver limitations, although I have been able > > to > > > advance pretty well, but not on this double click issue. > > > > The HTML is awful really really awful, I am new to this project and I am > > > only here to test it via Watir: > > > > <div class="z-center-body" id="z_4e_ve1!cave" style="width: 1913px; > > height: > > > 406px;"> > > > <div style="height: 100%;" id="z_4e_0f1"> > > > <div onselectstart="return false;" onmousedown="return false" > > > z.fixed="false" z.tchsib="z_4e_ef1" z.vflex="true" z.selid="zk_n_a" > > > z.size="0" z.zcls="z-tree" style="height: 90%; background: none repeat > > > scroll 0% 0% rgb(255, 255, 255);" class="z-tree" z.type="zul.tree.Tree" > > > id="z_4e_1f1" zk_realsize="17"> > > > > <div class="z-tree-header" id="z_4e_1f1!head" style="width: 1911px;"> > > > <table cellspacing="0" cellpadding="0" border="0" width="100%" > > > style="table-layout: fixed; width: 1911px;"> > > > <tbody style="visibility: hidden; height: 0px;"> > > > <tr class="z-tree-faker" id="z_4e_2f1!hdfaker"> > > > <th z.zcls="z-tree-col" style="width: 954px;" class="z-tree-col" > > > id="z_4e_3f1!hdfaker"> > > > <div style="overflow: hidden;"></div> > > > </th> > > > <th z.zcls="z-tree-col" style="width: 287px;" class="z-tree-col" > > > id="z_4e_4f1!hdfaker"> > > > <div style="overflow: hidden;"></div> > > > </th> > > > <th z.zcls="z-tree-col" style="width: 96px;" class="z-tree-col" > > > id="z_4e_5f1!hdfaker"> > > > <div style="overflow: hidden;"></div> > > > </th> > > > <th z.zcls="z-tree-col" style="width: 478px;" class="z-tree-col" > > > id="z_4e_6f1!hdfaker"> > > > <div style="overflow: hidden;"></div> > > > </th> > > > <th z.zcls="z-tree-col" style="width: 96px;" class="z-tree-col" > > > id="z_4e_7f1!hdfaker"> > > > <div style="overflow: hidden;"></div> > > > </th> > > > </tr> > > > </tbody> > > > <tbody><tr align="left" z.rid="z_4e_1f1" z.zcls="z-tree-cols" > > > class="z-tree-cols" z.type="Tcols" id="z_4e_2f1"> > > > <th z.zcls="z-tree-col" style="width: 948px;" class="z-tree-col" > > > z.type="Tcol" id="z_4e_3f1"><div class="z-tree-col-cnt" > > id="z_4e_3f1!cave" > > > style="width: 948px;">Name</div></th> > > > <th z.zcls="z-tree-col" style="width: 281px;" class="z-tree-col" > > > z.type="Tcol" id="z_4e_4f1"><div class="z-tree-col-cnt" > > id="z_4e_4f1!cave" > > > style="width: 281px;">DOB</div></th> > > > <th z.zcls="z-tree-col" style="width: 90px;" class="z-tree-col" > > > z.type="Tcol" id="z_4e_5f1"><div class="z-tree-col-cnt" > > id="z_4e_5f1!cave" > > > style="width: 90px;">Gender</div></th> > > > <th z.zcls="z-tree-col" style="width: 472px;" class="z-tree-col" > > > z.type="Tcol" id="z_4e_6f1"><div class="z-tree-col-cnt" > > id="z_4e_6f1!cave" > > > style="width: 472px;">Medical Record Number</div></th> > > > <th z.zcls="z-tree-col" style="width: 90px;" class="z-tree-col" > > > z.type="Tcol" id="z_4e_7f1"><div class="z-tree-col-cnt" > > id="z_4e_7f1!cave" > > > style="width: 90px;"></div></th> > > > </tr> > > > </tbody></table> > > > </div> > > > > <div class="z-tree-body" id="z_4e_1f1!body" style="height: 343px; width: > > > 1911px;"> > > > <table cellspacing="0" cellpadding="0" border="0" width="100%" > > style="width: > > > 1911px;"> > > > <tbody style="visibility: hidden; height: 0px;"> > > > <tr class="z-tree-faker" id="z_4e_2f1!bdfaker"> > > > <th z.zcls="z-tree-col" style="width: 954px;" class="z-tree-col" > > > id="z_4e_3f1!bdfaker"> > > > <div style="overflow: hidden;"></div> > > > </th> > > > <th z.zcls="z-tree-col" style="width: 287px;" class="z-tree-col" > > > id="z_4e_4f1!bdfaker"> > > > <div style="overflow: hidden;"></div> > > > </th> > > > <th z.zcls="z-tree-col" style="width: 96px;" class="z-tree-col" > > > id="z_4e_5f1!bdfaker"> > > > <div style="overflow: hidden;"></div> > > > </th> > > > <th z.zcls="z-tree-col" style="width: 478px;" class="z-tree-col" > > > id="z_4e_6f1!bdfaker"> > > > <div style="overflow: hidden;"></div> > > > </th> > > > <th z.zcls="z-tree-col" style="width: 96px;" class="z-tree-col" > > > id="z_4e_7f1!bdfaker"> > > > <div style="overflow: hidden;"></div> > > > </th> > > > </tr> > > > </tbody> > > > <tbody z.zcls="z-tree-children" class="z-tree-children" id="z_4e_ef1"> > > > <tr z.visible="true" z.dbclk="true" z.lod="t" z.tchsib="z_4e_u32" > > > z.ptch="z_4e_ef1" z.rid="z_4e_1f1" z.pitem="z_4e_n32" z.zcls="z-tree-row" > > > class="z-tree-row" z.type="Trow" id="z_4e_o32"> > > > <td z.zcls="z-tree-cell" style="width: 50%;" class="z-tree-cell" > > > id="z_4e_p32" z.type="Lic"><div class="z-tree-cell-cnt" > > > id="z_4e_p32!cave"><span id="z_4e_o32!open" z.type="Tcop" > > class="z-tree-ico > > > z-tree-root-close" z.fc="t"></span>Hutchison, Robb </div></td> > > > <td z.zcls="z-tree-cell" style="width: 15%;" class="z-tree-cell" > > > id="z_4e_q32" z.type="Lic"><div class="z-tree-cell-cnt" > > > id="z_4e_q32!cave">06/21/1970</div></td> > > > <td z.zcls="z-tree-cell" style="width: 5%;" class="z-tree-cell" > > > id="z_4e_r32" z.type="Lic"><div class="z-tree-cell-cnt" > > > id="z_4e_r32!cave">M</div></td> > > > <td z.zcls="z-tree-cell" style="width: 25%;" class="z-tree-cell" > > > id="z_4e_s32" z.type="Lic"><div class="z-tree-cell-cnt" > > > id="z_4e_s32!cave"> </div></td> > > > <td z.lfclk="true" z.zcls="z-tree-cell" style="width: 5%; color: blue;" > > > class="z-tree-cell" id="z_4e_t32" z.type="Lic"><div > > class="z-tree-cell-cnt" > > > style="color: blue;" id="z_4e_t32!cave">Edit</div></td> > > > </tr></tbody> > > > </table><a style="position: absolute; left: 0px; top: 0px; padding: 0pt ! > > > important; margin: 0pt ! important; border: 0pt none ! important; > > > background: none repeat scroll 0% 0% transparent ! important; font-size: > > 1px > > > ! important; width: 1px ! important; height: 1px ! important; outline: > > 0pt > > > none; -moz-user-select: text;" href="javascript:;" onclick="return > > false;" > > > tabindex="-1" id="z_4e_1f1!a" z.keyevt="true"></a> > > > </div> > > > > </div> > > > <div z.numpg="1" z.actpg="0" z.zcls="z-paging" style="display: none;" > > > class="z-paging" z.type="zul.pg.Pg" name="z_4e_8f1" id="z_4e_8f1"> > > > <table cellspacing="0"> > > > <tbody> > > > <tr> > > > <td> > > > <table cellspacing="0" cellpadding="0" border="0" class="z-paging-btn > > > z-paging-btn-disd" name="z_4e_8f1!tb_f" id="z_4e_8f1!tb_f"> > > > <tbody> > > > <tr> > > > <td><div><button class="z-paging-first" type="button"> > > </button></div></td> > > > </tr> > > > </tbody> > > > </table> > > > </td> > > > <td> > > > <table cellspacing="0" cellpadding="0" border="0" class="z-paging-btn > > > z-paging-btn-disd" name="z_4e_8f1!tb_p" id="z_4e_8f1!tb_p"> > > > <tbody> > > > <tr> > > > <td><div><button class="z-paging-prev" type="button"> > > </button></div></td> > > > </tr> > > > </tbody> > > > </table> > > > </td> > > > <td><span class="z-paging-sep"></span></td> > > > <td><span class="z-paging-text"></span></td> > > > <td><input type="text" size="3" value="1" class="z-paging-inp" > > > name="z_4e_8f1!real" id="z_4e_8f1!real"></td> > > > <td><span class="z-paging-text">/ 1</span></td> > > > <td><span class="z-paging-sep"></span></td> > > > <td> > > > <table cellspacing="0" cellpadding="0" border="0" class="z-paging-btn > > > z-paging-btn-disd" name="z_4e_8f1!tb_n" id="z_4e_8f1!tb_n"> > > > <tbody> > > > <tr> > > > <td><div><button class="z-paging-next" type="button"> > > </button></div></td> > > > </tr> > > > </tbody> > > > </table> > > > </td> > > > <td> > > > <table > > ... > > read more » -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
