In WP7 I am trying to limit the Textboxtext size.
Please guide me in this with sample.
You can limit it by Width or Height property. In this case TextBox will be only with provided sizes.
Otherwise, you can set MaxWidth and MaxHeight. In this case Width and Height will automatically adjust by situation but not great than you specify.
MaxLength property can be used also. It limits the number of characters that can be displayed. TextTrimming handles how to trim text when it out of screen, i.e. add ... in the end, for example.
Related
On iOS by default if you add the button in SwiftUI its size is equal to the size of the text. Setting the padding to some value expands the size to be bigger than the text by that value.
On watchOS by default the button has the text and background with applied padding. I don't see any way to reduce that padding (to make the button height closer to the height of the text). I have tried with setting padding and frame but it doesn't appear to be helpful - it appears even counter intuitive as increasing the padding reduces the height of the visible button but it keeps the overall size of the button in the layout which still isn't helpful.
Just to note that with storyboards this reduction of height is possible so I would assume that there should be a way in SwiftUI.
Set the button’s buttonStyle(:) to PlainButtonStyle() and you’ll have full control over the padding and frame. The downside is that you no longer get the default button background, so you’ll need to recreate it if you need it.
i have a function where i manually set the width of a jqgrid column. If I after this want to use the resize handle, it adds or substracts relative from the original width size. So it doesn't see my new width to take as a base. I have tried putting the width and withOrg in the colModel without success.
I have a click handler inwhich i resize a column to a certain width on click. i set the width of the th trought JS. After this i would like to be able to use the .ui-jqgrid-resize element for resizing the column.
a short version of my code, say the th is 200px wide:
$('th').dblclick(function(){
$(this).width('100px');
});
after the user doubleclicked, and the th went smaller in size to 100px, the user uses the resize handle to widen the th 10px. The expected result is a th of 110px wide, but the thjumps to 210px wide. It adds the 10px the user wanted to add to the original state, not the state i have set with the doubleclick.
I would recommend you to use setColWidth method, from the plugin which I wrote before (see the answer), to change the width of the grid column. You can download the current version of the plugin from github.
If you trying to set the width of columns based on the width of the content of the column then I would recommend you to take a look at the demo created for the answer and read the answer too. I don't see the suggested code as final solution, but the demos shows my view on the problem and the ways to implement "autowidth" functionality.
I am implementing an iChat-like app, using NSTextView to display chat records. The problem is how to change the width of NSTextView automatically based on characters in it. For example, the width of NSTextView is only one character width if there's only one character in it. More than 100 characters will automatically increase the height of NSTextView.
You can use the string addition [-NSString boundingRectWithSize:options:attributes:] to get a bounding rectangle. You might also want to look into the Layout Manager.
I have a TForm object whose height is greater than the required vertical resolution of my screen.
For some reason, Windows doesn't allow the visible (client?) area of the form to exceed the screen resolution, so vertical scrollbars appear on my form.
How would I get a TBitmap image or screenshot of the entire form (no scrollbars, all form components visible) so that all content of the form is visible?
At first you have to make sure the form has no scrollbars. For that you can write an event handler for FormConstrainedResize and adjust MaxWidth and MaxHeight to your needs. If the form size is restricted during design, set the required Width and Height in the FormCreate event to the desired values.
Now you can use GetFormImage to get the screenshot.
I have an NSTextField where the font used can be changed by the user.
Although the font's point size remains the same, the actual height of the font is much bigger for some fonts. This means if the user changes the font to 'Zapfino' for example, most of the text is cropped. I would like it so the text in the box always looks roughly the same size.
Also the line height seems to change depending on which font is used meaning they don't line up well and sometimes get pushed down and the bottom gets cropped off.
How can I keep the text size and line height looking the same?
You need NSTextField which is using single line. You can do it in Attributes inspector by checking Uses Single Line Mode.
How to do it:
And now Your text will be like this:
Do programatically:
To change NSTextField height programatically by font size or scale the text to fit the bounds example here.