Popup Windows in Groovy?

Curious if we have access to libraries necessary to use popups in our custom apps? I have no idea how to do this at the moment but wanted to see if it's possible before going down this rabbit hole!

If we do, any direction would be greatly appreciated! lol

@gopher.ny @bravenel @thebearmay or anyone else that might have any insight.

Thanks!

Tool tip type popups can be done via CSS, this is from a driver but can do the same thing in apps

@Field static String ttStyleStr = "<style>.tTip {display:inline-block;border-bottom: 1px dotted black;}.tTip .tTipText {display:none;border-radius: 6px;padding: 5px 0;position: absolute;z-index: 1;}.tTip:hover .tTipText {display:inline-block;background-color:yellow;color:black;}</style>"
...
	prefList.each { l1 ->
        l1.each{
		    pMap = (HashMap) it.value
            input ("${it.key}", "enum", title: "<div class='tTip'>${pMap.desc}<span class='tTipText'>${pMap.attributeList}</span></div>", options:pollList, submitOnChange:true, width:4, defaultValue:"0")
        }
	}
3 Likes

Depending on what you want to do, I found pop-ups, at least the way I wanted to do it, quite difficult to master when a group of inputs were displayed together, but I did eventually solve it. You can take a look here if you are interested.

2 Likes

This stuff isn't actually in libraries. See this post, it has code examples of how tool tips are done for a table. Lights Usage Table

3 Likes

Sorry, I should have been more clear. I've been using tool tips in my apps (especially Event Engine) for years. I'm looking for a pop up window like in the new Visual Rules.

Thanks

Where did everyone go...

Looking Nat Geo GIF by Dr. Donna Thomas Rodgers

5 Likes

The short answer is that the app in your screenshot above is cheating--it's not using the regular app framework. :slight_smile:

1 Like

I want to say I did similar at one point with app endpoints and an app constructed HTML that I opened in a new window but didn't like the result so stopped pursuing it. I'll look and see if I still have the code but...

1 Like

Take a look here.

1 Like

Yeah, I figured that but was hoping someone knew how to do something similar within Groovy. Not looking to copy it, but would be fun to poke around with.

I think your best bet in a user app if you want something this different is to serve whatever UI (or whatever content) you want via OAuth endpoints, as @thebearmay sounds like he tried. (This is how the actual dashboard part of Hubitat Dashboard works, and some community apps like Z-Wave Mesh Details use it for the actual app functionality, too--though there isn't escaping the need to select devices in the actual Hubitat app first for user code.)

You probably could finagle something into a "regular" app since it's easy to inject arbitrary HTML (as people have done with tricks like tables, for example), but with less control over what happens outside that, I doubt it will be easy. But maybe someone has tried... :smiley:

1 Like

Something else that might work is building a HTML div within the app that you can flip the CSS display element from block to hidden as required. If done correctly you may be able use “regular” app inputs to capture your interactions.

2 Likes

That's what the iFrameAdvanced driver uses to display pop-up HTML content on a dashboard, just not sure how you would go including device selections or other app inputs, as @bertabcd1234 mentioned.