0

How do I prevent dynamic tooltip to show when there is no text?

asked 2013-02-25 15:57:09 +0800

digulla gravatar image digulla
502 4

I'm using this pattern to implement complex dynamic tooltips.

My problem is that my "tooltip calculation code" can return "no tooltip". How do I prevent the popup from showing in this case?

I tried to call popup.close() in the ON_OPEN event listener but that causes the popup to flicker.

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-02-26 07:35:17 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Read the last part of RobertPic's writing how he does handle the popup. Seems meantime he create a MyPopup class that extends from GenericForwardComposer. In this case you can check if data exists in the doAfterCompose() method. If there is no data to shown you can call a myPopup.detach(). So it sould not flicker.

best Stephan

link publish delete flag offensive edit

Comments

if detach the popup, then it will not able be use later.

dennis ( 2013-02-26 08:30:54 +0800 )edit

The tooltip is calculated when the mouse hovers over a UI element, not in doAfterCompose(), so detaching isn't an option for me.

digulla ( 2013-03-05 16:51:27 +0800 )edit
0

answered 2013-02-26 08:50:57 +0800

dennis gravatar image dennis
3669 1 6
http://www.javaworld.com....

why can't you just decide to show or not before calling show()? if you can't, you can post a event after call popup.open(). and the listener (I guess it is the popup itself) can listen to the event to call close.

<zk>
    <zscript>
        void show(Component comp,String text){
            helptext.setContent(text);
            help.open(comp);

            Events.postEvent(help,new Event("onShowCheck"));

        }
        void onShowCheck(){
            if(org.zkoss.lang.Strings.isEmpty(helptext.getContent())){
                help.close();
            }
        }
    </zscript>
    <hbox>
        <button label="show1" onClick='show(self,"Show me")'/>
        <button label="show2" onClick='show(self,null)'/>
    </hbox>
    <popup id="help" onShowCheck="onShowCheck()">
        <html id="helptext"/>
    </popup>
</zk>
link publish delete flag offensive edit

Comments

I'm not calling popup.open(); that happens somewhere in ZK. I can't use a ON_MOUSE_OVER listener unless you can show me a way to implement the tooltip delay with this.

digulla ( 2013-03-05 16:53:47 +0800 )edit

Second question: What is onShowCheck? Google turns up exactly one search result and that's this page :-/

digulla ( 2013-03-05 16:54:35 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2013-02-25 15:57:09 +0800

Seen: 40 times

Last updated: Feb 26 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More