Constrained Window render error - extjs

Basically we have two problems and they may depend so Here is the link to the second question:
We tried the constrained border layout example from the API with the difference of setting autoShow: true which ends in a broken window rendered to the top left of the document.
How can this be fixed and where is the error?

I guess you are facing the problem that the constraining container didn't finished the layout yet so that the window failed to layout itself by using the constrain target. I recommend you to call setVisible(true) on the window by using the afterFirstLayout method. The method is documented as private but based on the usage within the framework itself it should better be promoted as protected template, so you should be save using it.
I guess the afterRender wouldn't be enough cause the layout hadn't be processed yet. And the afterLayout template method would run more then once.
You may give it a try.

Related

GtkContainer/GtkWidget maximum width

I am trying to write an application that contains a GtkBox (Horizontal) where I add a dynamic number of buttons (with labels) depending on various conditions. Now
I want to prevent the GtkBox to grow more than (for example) 600px. The button labels can be ellipsized.
So my question is, is there any common way to solve this problem? If not, I think i would have to create a new Container Class that will watch its size.
I am using the C API for GTK (gtk+-3.0)
This is not directly possible with the current version of GTK. A max-width CSS property may be implemented in a future version, as there have been plenty of requests for it.
What you would do is indeed create a new container subclass. You could probably inherit from GtkBin to keep things simple, and in your size_allocate handler just clamp the width to the maximum value before passing it on to the child widget.
You can also try out Emeus, the constraint layout library for GTK, similar to how iOS would do this.
There is no simple way to limit the size of a widget, at least as far as I can tell. What you can do is attach to the size-allocate signal and call set_size_request when received.
Since size requests are only requests, not commands, depending on the circumstances you may not be able to shrink the widget as much as you would like, but this should be rare.

Codenameone Detect keyboard showing

Is there a way to add a listener on the Form for when the virtual keyboard shows or dissapears in Codenameone?
The reason is because I want to detect this and recalculate the size of the Form. Currently, the sizeChangedListener does not get called when the keyboard shows, and so some components are hidden from view, as I can't recalculate the sizes of the components.
See Display.getInstance().setVirtualKeyboardListener(...)
You shouldn't do that.
Keyboards resize the UI only on Android and don't have that affect on iOS/Windows. We will probably change that behavior on Android as well so relying on it in that way doesn't make sense.
Size changed is called on the form when running on Android otherwise basic stuff wouldn't work. Notice that you shouldn't rely on it for typical code, if you use scrollable containers properly and the right layout things should automatically rearrange themselves correctly.
I suggest rephrasing the question with a sample of your UI/layout and problems including screenshots. E.g. a common issue is placing a text field within a non-scrollable container so the resize logic can't do anything and it fails by making the text disappear.

Access WPF DataGrid after making element visible

Currently I am stuck with a problem that is simple on the first sight. Its about automated GUI testing.
I want to make a row/cell of a WPF DatGrid completely visible by scrolling using ScrollIntoView(row) and then accessing the row/cell directly after. Unfortunately scrolling in ScrollViewer seems to happen asynchronously. This means I need to wait for the scrolling to finish before accessing the row/cell. For this purpose I found the ScrollChanged event I can subscribe.
There is only one detail I can not solve: If the row/cell I want to access is already visible (and no scrolling is necessary) I do not get that event and the algorithm gets stuck. I was not able to find a reliable way to predict if a call to ScrollIntoView(row) actually scrolls.
Any idea how to solve this?
To make sure layout is updated call UIElement.UpdateLayout after you ScrollIntoView and before you want to use item. Quoting MSDN it
Ensures that all visual child elements of this element are properly updated for layout.

Layout System in WPF

I want to trigger the Measure/Arrange layout pass of an ItemsControl manually in code behind without user interaction. Is it possible? If yes, How? I tried InvalidateMeasure(), UpdateLayout(), but no use.
Use the InvalidateVisual method to invoke a re-render:
Invalidates the rendering of the element, and forces a complete new
layout pass. OnRender is called after the layout cycle is completed.
However, as Microsoft recommends that this should scarcely be used manually in applications, there is likely another solution to your problem (such as proper use of dependency properties, for instance), if we knew it.

Forcing Arrange in a Custom WPF Canvas

I'm working on a project that involves creating a custom graphical editor. The graphical editor has multiple tabs, and I want to create a preview function that will show a popup with Bitmap previews of the content of each of the tabs. However, the problem I'm running into is that the content for each of the tabs must be arranged before a proper preview can be generated for it. This means going into each of the tabs to ensure that they're rendered and arranged. Then, and only then, do the previews get properly generated, otherwise the previews have a size of 0x0. Does anybody know how to force an arrange of a content control so that I can get a properly sized preview generated ?
Apparently you can just call the 'Arrange' method directly, but you have to be careful about the rectangle you pass in as a parameter, because it can adversely affect the display of your control if you just want to force the object to draw itself (ie can force it to draw out of the desired position).
Here is a link to MSDN where it discusses the "arrangeOverride" method of a control.
I'm not sure this is what you need, but this method seems to be what you're asking about.
Hope this helps!

Resources