For portability, I set the units of my GUIs to 'characters'. Now I have a user who wants to use Matlab on his netbook, and the GUI window is larger than the screen (and thus cropped at the top).
I think I could try and write something in the openingFcn of the GUI that measures screen size and then adjusts the GUI accordingly, but I'd rather avoid that, because I then need to deal with text that is bigger than the text boxes, etc.
What I'd rather like to do is somehow adjust the unit 'character' on his Matlab installation. None of the font sizes in the preferences seem to have an effect on unit:character, though. Does anyone know whether there's a setting for that, which can be changed from within Matlab (I don't mind if it's something that is reset at every reboot, since I can just put it into the startup script)?
Might I suggest an alternative to consider when designing your GUI:
Create all of your GUI objects with the 'FontUnits' property set to 'normalized'.
Create the figure with a default size, with everything set to look the way you want.
Set one or more of the CreateFcn/OpeningFcn/ResizeFcn functions so they will resize the GUI to fit the screen size.
When the GUI and its objects are resized, the text will resize accordingly, thus helping to avoid text that ends up bigger than the text boxes. One thing to keep note of is that normalized units for the font will interpret the value of 'FontSize' property as a fraction of the height of the uicontrol. I also make it a habit to set the 'FontName' property to 'FixedWidth' to help control the width of the text.
Related
I'm trying to create an "underlay" (as opposed to overlay) widget that needs to size like the overlay widget. I can't use a Stack since it seems Stack requires its children to have a defined size. It also seems I can't use CustomMultiChildLayout since MultiChildLayoutDelegate doesn't support the container size from depending on the size of the children (per docs.)
That leaves me with MultiChildRenderObjectWidget for which I can't find a good sample anywhere.
The goal is to show a progress bar underneath a text label. The progress bar should automatically scale to the size of the text. These in turn are enclosed in a Column, and FittedBox set to scale down automatically. The FittedBox ensures the layout nicely adjusts to any screen width.
Any help hugely appreciated!
To answer my own question; CustomMultiChildLayout actually does work, and it's explained really well here.
I am building a simple python application without GUI, in which I wished to add some colors, which I was able to do with the help of some modules like termcolor, tqdm, simple_colors etc.. I also need a way to increase font size in the print statement whenever necessary. It would be good if someone also can tell me if there is a way to use different font styles at required positions rather than changing the font of the entire application.
I've made a simple shape editor. I can change colors (used to fill shapes) by click on buttons in a menu bar. The disadvangate of this solving is the fact that the numbers of colors are so restricted. I can't find a better solution for my program. Can somebody help me and give me an idea how can I improve it? I thought about color palette, but I have no idea how can I do this.
The image:
("Aktywny kolor" means active colors, and there is the list of colors below, which I can use)
You would need to use a color picker where the colors are distributed on many pixels and not on a very small set of color names. Since you are using applet, you might want to download an already made color picker compatible with your environment, or you might want to write your own, depending on whether the things you find meet your expectations.
I'm building a Container using code and now I want to set the Styleusing one UnselectedStyle from the Resource Editor.
I'm doing this because, I don't find the way to add a LinearBackground color and a RoundBorder to my Container. When I put the two properties to the Style, the background color has gone.
So I finally add this Style using the UIManager.getInstance().addThemeProps(String name ThemeFromResource); and later the setUIID(String nameStyle). Is working fine...my Containergets the Style, but the app lose the navigation, the back Commandhas gone.
How can do this? I would like to do with my first way...creating the lineargradient and the border and adding it to the style, but I don't find the way.
I would strongly suggest against doing that.
Border's override other forms of background, round border tries to respect some of them but is REALLY inefficient about that. It effectively draws the background on a mutable image then draws the round border on another mutable image, gets the RGB for both and performs a NOT operation to crop the background into a round image. This (as you might understand) is REALLY expensive in terms of performance, while the image is then cached it is still expensive in the longer term.
You should use image borders which are MUCH faster.
I draw some text on screen using ID3DXFont::DrawText. This text should be displayed the same regardless of screen resolution.
For example, if screen resolution is low, text wrapped and when it is higher text is not wrapped. How can I avoid such situation? I want text size to be connected to screen resolution so if resolution is lower I want the text to be relatively smaller so that no wrapping happens. Is there any way?
Thanks in advance
Below is a logical solution. It doesn't have any of the code or procedures needed to make work in direct X but having done something similar outside of DirectX I wanted to share the logic
Working on whatever default screen resolution you want set the font to be the size needed.
Find the percentage of the screen height the font size you chose takes up.
Then having stored that value when you go to render again, in the final version of the program, calculate the font size based on the screen size and the percentage
What I was working in had functions like GetTextHeight and properties on the font size to allow you to set the height (which in turn set the font size appropriately). So if can find anything similar to this in DirectX than this could be a route for you to take.