anylogic how to set port is visible on upper layer false - visible

Can you explain the "is Visible on Upper Layer" property, please? It's on everything, yet I can't seem to find it programmatically.
I have a custom block, and I have parameters for the block that provide functionality options. When the user selects a certain configuration, I want to hide the port, text and graphics group associated with that option.
My preference is just to flip the flag "is Visible on Upper Layer" to false, however, I cannot find that option. For the text and the group, I can only set "isVisible" to true, and it doesn't have an option to set "is Visible on Upper Layer". For the port, there doesn't seem to be any code that impacts its visibility.
How can i control visibility on the upper layer for text, groups and ports in the icon of a custom block?
Please help
Thanks
Brett

The property Visible on upper level is not accessible by code and can only be set via the editor during model development.
As you already noted, the function to use here is setVisible(boolean), on the Agent level. The object will then be hidden both in the block itself, as well as in the upper level.
If you dynamically want to hide some parts on the upper level, but always show them on the Agent level (inside your block), you will have to create two instances of them, one that is visible on upper level and one that is not. Only then you can hide one while showing the other using setVisible(boolean).
For ports you are even more restricted, visibility can only be set via the editor during model development, and Visible on upper level can't be set at all.

Related

Visio protect object from selection

A big problem for me creating diagrams in visio (and powerpoint and similar programs) is that if you have a background object, it blocks you from selecting multiple objects by lassoing. Instead you end up moving the background around, this is annoying.
In many applications there's an option to "lock" or "protect" a specific object so it becomes un-selectable while still visible on the drawing. In Visio there is no simple way of doing this as far as I'm aware.
There's a rather convoluted way of doing this, it feels to me like Visio designers wanted to make this difficult on purpose. The methods I'm aware of I list here, feel free to let me know of a better way(s)
You can protect objects from selection by going to (hidden by default) Developer tab and pick "shape design"-> protection -> selection. However this does not actually protect them from selection, which makes sense . To actually protect the said object from selection, you have to open drawing explorer, which is also hidden by default and the visibility tickbox is in hidden by default Developer tab under show/hide section.
Drawing explorer, however won't highlight whatever object you have selected in the drawing, another unexplicable design decision. If you want to see the name of the object you've selected with live update, you have to enable the diagram navigation pane. That's found in View tab on Show section under "task panes" icon. This pane does highlight whatever you've selected and you can rename the object to give it a meaningful name, but not change the shape in any other way.
To finally protect that shape from selection, right click on the top level document on the drawing explorer and pick "Protect document" and tick "shapes" and hey presto, now your background rectangle is visible but not selectable. Very straightforward indeed
There are also layers which offer similar functionality but they naturally come with their own gotchas.
You can see layers on the Drawing explorer under foreground pages, page name, "Layers" tree. To move an object on a specific layer, you cannot do it by right clicking on the object, because of course you can't. There's an assign to layer button in Home->Editing->Layers->"Assign to Layer", which will let you select the layer(s) for the selected object. You can also do this by right clicking on an object from the Drawing explorer, but you have to know the object name, because there's no reverse selection .. The object name you can get from the Diagram navigation. By default "protected" and "lock" layers do nothing.
To change what the layers do, you again go to the Home -> Editing -> Layers and select "Layer properties". This is also available from Drawing explorer by right clicking on the "layers" tree under a specific page. Here you can control if the layer is visible and/or protected. However, if you lock a layer, you also cannot move objects to/from it, as that'd be too easy. So you have to untick "lock" if you want to move stuff in and out of a protection layer.
So there are two awkward ways of doing that that I'm aware of.
If the shape really is a background object then maybe you should be looking at putting the shape on a background page. You can then make it the background page for your active page. That'll fix all your shape selection problems.

Visibility parameter of WPF control not visible with UI Automation?

I started writing test for a WPF application with FlaUI (UI Automation framework). Now I want to get the Visibility value of a couple of buttons.
These buttons are located on the same position in the WPF window. The first is a start button which will start a measurement. When clicked, the measurement button is replaced with a stop button. The visibility of these buttons are set in the code behind of the xaml and needs to be checked/verified.
With FlaUI I only get IsEnabled boolean and OffScreen boolean. But when using the Offscreen parameter, this boolean is not set or is set to the correct value for a couple of seconds but is changed again while the measurement is still running.
I also tried other ways, like looking for a clickable point of the not visible button. But those are not working.
Can this be done without extending the button class with an AutomationPeer and exposing a ValuePattern? I googled a bit but cannot find an (decent) answer. Hopefully someone can help.
I think an important part of your question is the word "replaced". Commonly a program draws one set of controls (in your case the start button) and later draws another set. Possible on top to hide the first, or possible by deleting them.
Commonly controls, including buttons, are drawn within other containing controls and so it may be that the button controls are not there at all, hence the visibility checks should be done on the parent or ancestor controls.
This Q&A seems related to the problem you are having and it may provide some more insight.

Create a 'Group Box' in Word Userform

"Group Box", for lack of a better word: I want areas in my user form which are visually different from others, with a different background colour and a frame around them, such as is possible to create using Frame controls. However, I want none of the events of Frame controls and none of their interaction with other controls in the form.
More particular, I want to be able to tab through all text, list, combo and check boxes, regardless of their location in 'Group Boxes', in fact also regardless of the possible location of their 'Group Box' within another 'Group Box'. Most of my controls have On Enter, On Exit, On Change and On Key even procedures attached to them which may re-direct the focus to any control on the form. Doing so under the constant interference of Frame controls with their events and rules - many of them not working correctly, none of them properly explained anywhere - is a gargantuan task. The easy way would be to have the visual design capabilities only, without the "intelligence" which assumes control in a way not compatible with my own plans.
Perhaps the one feature of frames which makes them unfit for my purposes is that they act as forms within the form, meaning they appoint an ActiveControl when activated which they refuse to release when another control takes the focus outside their own frame. It is inconvenient to prevent a first control's On Enter procedure from running when any control in a frame receives the focus (different for first and subsequent times), but it's a much bigger task to deal with the selected control's On Exit event which won't fire until the form is closed, meaning it is missed when the control optically loses the focus and a nuisance when it technically does.
Is there a control that fits my needs in MS Word? Or can the Frame control be stripped of its events in some way? Could I place a Text Box, for example, in front of a Frame control without it also being "within" it?
For MS Word use a label with a background color.
For MS Access use the rectangle Object behind the controls.
First make the form background a grey color. Then add subforms(ms access) and rectangles to segment the controls.
The end effect is it looking like a paneled interface.
You can use a Frame control. Place the other controls first, then place the Frame control, and move it to the back. This should look visually identical to having the controls in the Frame.

How to bring label over edit control

I'm trying to set up a TEdit that will be used for research, so, it would be great to have a label displaying "current" / "count" over it, as observed by pressing CTRL + F in Google Chrome:
It seems that the TLabel control's always placed behind the TEdit control.
I also tried label1.BringToFront (Both at designtime and runtime), but it had no effect. Is there a way to place a label over an edit control?
TLabel inherits from TGraphicControl which cannot be shown on top of windowed controls, no matter how many times you try to use BringToFront it's just not going to happen.
However, you can use a container control such as a TPanel that can be used to contain your TEdit and TLabel controls, see this image as an example:
That is a quick and dirty way, it's simply a TPanel containing a TEdit and TLabel as child controls
The preferred way however is to create your own control which would give you full flexibility. Often trying to piece together multiple VCL controls to appear and function how you want is not usually ideal, and so by doing it the custom way gives you more freedom and possibilities.

Enterprise Architect class fill color

I have a very stupid question! I have created class diagram and right now I am trying to change class background fill color. I have not found any info in the help how to do that. Any suggestions?
Not a stupid question at all. There are a couple of different ways of doing this, depending on the scope you want.
To change the colour of one class in a single diagram, right-click it in the diagram. This opens up the context menu, but also opens a mini-toolbar. In this toolbar, the third icon from the left is the class fill colour. This toolbar can also be opened by selecting the class, and then clicking the middle of the three icons EA displays to the right of the class (the paintbrush).
Using this toolbar you can change the class colour locally. It does not affect how the class is displayed in other current or future diagrams, it is specific to the diagram you're in.
If you want to change the appearance of a class in all diagrams, right-click it and select Appearance -- Default Appearance. If you change the colour here, it will affect all future diagrams and all current diagrams except the ones where you've specified a local colour for the class as above.
Finally, you can change the EA-wide colour scheme in Tools -- Options -- Standard Colors. This affects all elements in all diagrams, unless you've specified something else for an element using either of the above methods.
In addition to these, if you create a profile you can specify a different appearance for a particular stereotype using shape scripts. But that's a different question.