[Bug-12795] Popup Title Bar Should Not Be Required In Certain Instances

ignition80
scripting
#1

I’m calling a popup window via system.perspective.openPopup().

Tried this but I didn’t like the Title Bar that appears.
system.perspective.openPopup(‘uniqueName’, ‘popupLocation’)

Noticed that the close window [x] was in the upper right hand corner.

Thought removing it might work:
system.perspective.openPopup(‘uniqueName’, ‘popupLocation’, showCloseIcon=False).

Then noticed that you can only move the window via the bar at the top, so I tried this.
system.perspective.openPopup(‘uniqueName’, ‘popupLocation’, showCloseIcon=False, draggable=False)

Tried sending a blank title.
system.perspective.openPopup(‘uniqueName’, ‘popupLocation’, title=’’, showCloseIcon=False, draggable=False)

Still didn’t work. Did I do something incorrectly?PopUpTitleBar

0 Likes

#2

You’ve done everything correctly. It looks like all of our manual testing for the popup uses Views with white backgrounds, so instances without titles displayed white-on-white - so we never saw the offending title bar. I would think that we should be able to remove the title bar in the instance a Popup

  1. has no title
  2. has no close icon
  3. is not draggable

but I’m not positive… I’ll open a ticket and we’ll see what happens.

2 Likes

#3

That would be good - or if it can’t be removed, allowing some way of modifying the appearance would be helpful.

I have a small popup with no title, no close icon, not draggable, and a white background. If I align some header text right at the top of the view, it doesn’t appear to be at the top at runtime, because of the white space above which blends with the white background. Instead, it just looks like I’ve mistakenly pushed all my content 20 pixels down the page.

If I make the popup background a different colour, you can see the title bar and it looks normal - but if I want a white background, and I can’t change the title bar from white, it just looks misaligned.

0 Likes

#4

Just to provide some points for designing around Popups since it sounds like some of you want to get crazy and strip out the title bar (and by extension the Close Icon):

  1. Unless you’re using a modal configuration, your popup should ALWAYS have some way to be closed or moved - whether it’s the close icon or being draggable, you don’t want to open a Popup your user can’t close. An internal strategy is to always open a Popup with a script action which sends the Popup ID as a parameter to the View being used in the Popup. It’s then the responsibility of whoever designs the View to have a Button in the View which closes the Popup (either on submit or cancel).

  2. Think about mobile users as well - Popups are great on desktops, but not always great on mobile.

1 Like

#5

That raises a point I hadn’t thought of - I do have a “dismiss” button on my popup, which is just uses a popup action to close that popup. But, by your description of passing the popup identifier to the view when opening it, I’m thinking it might be more complicated.

Presumably that action would close all instances of that popup in my particular session, hence the need to pass the identifier to the view so that it can act only on its own instance. I’m currently passing a tagPath parameter to the view, which would be unique. Let’s say I’m calling this popup using an Open Popup action from an onClick even. I pass [default]Motors/Motor_1 to the tagPath parameter, and also enter that same text in the Identifier field. Then on the popup, I create a “dismiss” button, and onClick trigger a Popup Close action. I configure it to close the view with the identifier {view.params.tagPath}. Would this work, or do I have to do it via scripting? And, is there no way of scripting it to act only on itself via something like self.closePopup?

One other question - reading through the documentation for the openPopup and closePopup function, you can specify the particular session, and if you don’t, it acts on the current session. So that being the case, presumably if I use the method above, it would act only on the current session by default?

0 Likes

#6

Your example of using the tagPath should work just fine. I’m not sure if it’s any sort of a security concern, but the id provided to a Popup DOES appear in the Browser DOM with a “popup-” prefix attached to it.

As for the self.closePopup() idea, you’re giving the View far too much credit. Views essentially know only about their properties and their child component/container properties - Views themselves take no actions and do not interact with anything. system.perspective.closePopup() and similar methods are the system (Gateway) performing an action or gathering/manipulating/sending data through the web socket connection. Even bindings are the Gateway performing actions behind the scenes. So a View (self) or its child components/containers can’t perform actions like closing themselves or removing themselves because they’re really nothing more than a JSON holding data.

Your session conclusion is also correct - not specifying a session will result in the action only being taken on your session. Localized session interaction can be expected for EVERYTHING in Perspective, outside of Gateway-side data manipulation (tags and database) because other sessions would be viewing/accessing that same data.

2 Likes

#7

I learned this the hard way.

0 Likes

#8

Thanks, that fills out the picture for me quite a bit.

1 Like

#9

This issue was fixed in the build that was uploaded on 3/9.
Please let us know if you continue to see this behavior after upgrading.

1 Like

#10

Apologies for the raising the dead a bit here. Based on this thread I am under the assumption that when a popup:

that the popup should not have a title bar. Should this still be the case or has something changed in the last 8 months?

0 Likes

#11

That should be true, yes.

0 Likes

#12

Well, I was going to say that I was still experiencing this issue, but apparently I just missed the fact that the draggable parameter defaults to true. You can disregard my comments.

0 Likes

#13

I think I am experiencing this issue also (v8.05) and some others. I made a popup that I load with this script:
system.perspective.openPopup(‘myPopupId’, ‘Popups/Alarm Display’, {‘Alarm Group’:‘AlarmGroup’,‘TagFolderPath’:’[default]Tagpathhere’}, position = {‘left’:250,‘bottom’:20}, showCloseIcon = False)

I’m getting a gray bar over my popup in all browsers I’ve tried (Edge, Chrome and Firefox).

0 Likes

#14

Sounds like you might have the same cause of the issue that I did. I needed to specifically set draggable= False in the function’s parameters.

2 Likes

#15

@swolnisty is correct.

@Steve_Laubach, in your example, you do not set the draggable argument to False, so it uses the default value of True. Please look more into the documentation, where we clarify the default values.

If a popup is draggable, OR (inclusive) it has a title, OR (inclusive) it has a close icon, then you can expect the title bar.

1 Like

#16

Thanks for your help (both of you). I knew about the draggable property from the help but I didn’t realize it was adding my header bar. I’m happy to see it isn’t a bug.

0 Likes