jQuery UI dialog: Combine width:auto and minWidth - jquery-ui

I am initializing my jQuery dialog like this:
.dialog({
maxHeight: 600,
minWidth: 500,
width: "auto",
height: "auto"
});
The goal is to have the dialog auto-size width to content on open, but cap the max width to 500. When it opens, it's honoring width: "auto", but not minWidth: 500 (it opens very narrow for smaller content, but I want it to be at least 500 wide). I think there's either 1) a bug in the dialog or 2) I can't set both during initialization. I consider there to be a bug because, when I click the border to resize it, it automatically snaps to the minWidth at the slightest drag of the border. This tells me it recognizes the minWidth property, but doesn't initialize it. However, when I omit width: "auto", it initializes at minWidth as expected.
Here's a fiddle showing the issue:
https://jsfiddle.net/oedgwkvL/1/
Dialog initializes at the size of the content, but I want minWidth to take priority. Drage one of the border as little as a pixel and it will snap to minWidth size.

Related

How to make card fill the entire height of a Grid Row in Ant Design?

I am trying to make the height of the right Ant Design card match the height of the left Ant Design card:
https://codesandbox.io/s/ant-design-start-forked-wy6z3?file=/index.js
I can easily do it with a div, however I can't do it with a Card for some reason. Any help is appreciated since I feel like I've tried everything under the sun!
You're changing the body of the card and not the card container.
Instead of bodyStyle={{ height: "100%" }} use style={{ height: "100%" }}
bodyStyle: change the body content
style: change the entire card container
headStyle: change the header content

unwanted move when resizing div width min-width property

I have a problem with jquery ui resizable, I face this problem many times, It make me confuse, the problem is: The right side of the div moves when resizing. Why?
The problem occurs when I set min-width for the div.
This is the fiddle of my problem: My fiddle
stackoverflow asked me to accompanied by code also it's not necessary but here it is:
$('div').resizable({
handles: 'e, w'
});
I found the answer here.
I should set the minWidth in resizable initialization so instead of min-width property in css. I should do this:
$('div').resizable({
handles: 'e, w',
minWidth: 50
});

make UIButton tap area larger

I have a lot of buttons, but they are quite small, and I dont want to make them bigger, I just want to make tap area bigger. I tried
func makeInsets(button: UIButton) {
button.imageEdgeInsets = UIEdgeInsets(top: -40, left: -40, bottom: -40, right: -40)
}
but this make bigger only image. Any advices on this case?
You can do this by making the button frame bigger and then adjust it with EdgeInsets:
1 Select your button;
2 Go to this menu and at "Edge" category;
3 Select "Content" and chose "Image";
4 Adjust "top" "bottom" "left" Right" insets to adjust image inside button
For this to work Image must be added to button with "..setImage" and not "..setBackgroundImage"
If "Content" is selected it will modify both: Images and Text inside button
It can also be done programatically but it's a little bit harder for not being able to see live modifications and you must calculate.
Hope it helps.
Update:
As an update to your question update you could try:
-change -40 into 40 : this will make your button remain bigger and image inside will smaller in every side with 40 and it will answer to your question
if you want to modify whole button (text + image) you whould use btn.contentEdgeInsets instead btn.imageEdgeInsets and set values
Make the frame of the button bigger, but change the view mode in interface builder to center the image, and not fill. This keeps the image at the original size but the borders of your button extend invisibly beyond.

JQuery UI Resizable Fixed Size Table

I'm trying to use JQuery UI Resizable in order to add resize handles to 4 Td tags in a Table.
My intention is for all td's to react to the resize and to be constrained in the table width, height. (pretty much what the resize handles used on JS Fiddle are doing)
Currently, the td's are not constrained to the table and although the handles work, if I use the handle on one side of the table, then use the second half of the handle, the second half of the handle will never go above the height (or width) I stopped at with the first half (this happens vertically and horizontally).
Here's my fiddle: http://jsfiddle.net/fdLkqv2L/
$("td").resizable({ handles: 's, e' });
Heres the fix man:
http://jsfiddle.net/fdLkqv2L/1/
The problem is the other cells height are not updated while resizing, and the <tr> height is the same as the highest height of its <td>s:
With this code you also resize all the siblings (all other <td>s in current <tr>):
$("td").resizable({
handles: 's, e',
resize: function (event, ui) {
$(this).siblings().height(ui.size.height);
}
});

How to set a buttons width dynamically to match its title value in Titanium?

Creating a button in Titanium it gets a 100% width from the system if width is not defined or
set to auto:
var button = Titanium.UI.createButton({
title: 'Some Title',
width: 'auto'
});
I want to have the button have the exact width of its content without calculating the contents width myself or setting it manually.
In the documentation I can not find any options to achieve that.
Is there an option to have the button width match its contents?
Favo, I'm not sure I understand the question. I believe the answer to your question is setting the width to auto, so why is that not what you are looking for?
Answering my own question to allow me to close it:
Currently a default button can not be sized dynamically to its content in Titanium.

Resources