I have an view with an image(gif) of fixed size but when i re-size window or view its not adapting according to respective window or view. Can any one suggest some solution please?
This sounds like a layout issue - your Label/Image is not being told to 'fill' the available space, and instead to render at it's natural size. See this article for more information on layouts, particularly the area the shows an example of this code:
gridData.horizontalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
Related
I am working on a macOS app and I programmatically adding NSToolbarItems following Apple's documentation and I am adding the new NSTrackingSeparatorToolbarItem to support the new macOS 11 toolbar look and feel.
The tracking separator seems to work fine as long as I don't resize the split view below a certain width, then the separator breaks out and just looks out of place.
The tracking separator working as expected
And the separator breaking out when the split view size is below a certain width.
Is there a way to avoid this?? I know that I can set a minimum size for the split view, but is there a way to keep them synchronized (I don't want to hard code a minimum width)?? Especially if the user adds toolbar items dynamically.
Thanks in advance.
Ok I think I figured it out...
I noticed a interesting behavior when playing around with the Mail app, which when the preview pane is showing the NSTrackingSeparatorToolbarItem follow the resizing of the split views but the moment the preview is collapsed the toolbar changes appearance and becomes like a static toolbar. Furthermore the NSTrackingSeparatorToolbarItem stays in place and looks just like a normal toolbar separator (like you might find on other OS's).
So I played around in IB with my toolbar and discovered my error, my NSWindow had the titlebar set to transparent!!
I unchecked the option and voila I could replicate the look and feel of the Mail app, all automatically.
this property has to be set to false in NSWindow
#available(macOS 10.10, *)
open var titlebarAppearsTransparent: Bool
And of course the toolbar style should be set to unified
#available(macOS 11.0, *)
public enum ToolbarStyle : Int {
// The default value. The style will be determined by the window's given configuration
case automatic = 0
// The toolbar will appear below the window title
case expanded = 1
// The toolbar will appear below the window title and the items in the toolbar will attempt to have equal widths when possible
case preference = 2
// The window title will appear inline with the toolbar when visible
case unified = 3
// Same as NSWindowToolbarStyleUnified, but with reduced margins in the toolbar allowing more focus to be on the contents of the window
case unifiedCompact = 4
}
Please note that the break out behavior still occurs but when this happens the toolbar changes look and feel and you don't see any ugly split view divider line like I had experienced. Hope this helps anyone else who might run into this issue.
I'm developing an application with Electron and Ionic 4 and i would like to set the window size (BrowserWindow object) in order to fit content width and height of the home page, as i would do in java swing by calling JFrame pack method.
Is it possible?
I'm in a similar situation. i.e. I'd like the Electron to fit the html content. Plus if I show other content (e.g. div.hidden = false) I'd like the Electron Window to expand.
Best solution I've found so far is to send a event indicating a resize and handle that in the main process.
https://discuss.atom.io/t/how-to-re-size-electron-main-window-dynamically/48183/3
Neater solutions would be welcome.
I'm using Centura / TeamDeveloper 6.1
Is it possible to make the content of a Dialog / Window dynamic?
For example if I load a table inside a tab it is dynamic because the child table always takes the size of the tab.
I want the same behaviour with buttons etc. not that they always change size but that they move their position to stay like in the center no matter how far I resize the window without me having to write a function that calculates everything and that moves them around.
In C++ / QT I would use Layouts.
As it is right now I maximize the Window but the design is stuck on the left side.
Team Developer does not offers support this feature in native way.
however you can design your app to capturing when the formwindow size change and so your visual objects can change their position according the new container size.
there are some samples demonstrating this behaviour.
please, do a search here for "resize" samples
I'd like to have the effect of one of two panels visible at given time in the same place on the screen. Perhaps I could use the DeckPanel but then in the designer I wouldn't be able to edit the hidden one. Maybe you could recommend a technique?
I've found a solution which works but is not pretty IMHO. Ie. in the code I insert the panel which I want to be visible and remove the panel which I don't want to be visible (from the containing panel).
Just put both panel within another panel and then set their visibility.
Panel mainPanel = new Panel();
Panel subPanel1 = new Panel();
Panel subPanel2 = new Panel();
mainPanel.add(subPanel1);
mainPanel.add(subPanel2);
subPanel1.setVisible(true);
subPanel2.setVisible(false);
And then when you want to see panel 2 you just do this:
subPanel1.setVisible(false);
subPanel2.setVisible(true);
If you want to do this the "right" way, I'd suggest looking into the MVP pattern that GWT team in is suggesting for maintaining large-ish GWT application.
Take a look at possible implementations: mvp4g or gwt-platform. They will take care for you of switching views, as well as maintaining history (the back/forward buttons will work as they should) and many more.
You can go for Tablayoutpanel Need not to maintain your own code .
I am building a simple interface using a 3 row GtkVbox. Inside middle row, I'd like to show a centered image and a small config panel. If config panel is shown, it must appear over the image. How could I simulate a layered panel where the config panel appers in an upper level than the image. Any ideas?
Regards
Overlaying widgets on top of each other isn't really what GTK is built for - you might be using the wrong tool for the job. Maybe you should check out Clutter?
I believe you can use GtkOverlay to put the panel over the image.