0
[JS] User Interface, Sizing Question
New Here
,
/t5/indesign-discussions/js-user-interface-sizing-question/td-p/1146888
Mar 26, 2008
Mar 26, 2008
Copy link to clipboard
Copied
I've have successfully used the minWidth option for textEditboxes and such, but I am trying to use it on a borderPanel and am not having any luck getting it to work. Here's some sample code that doesn't give an error, but also doesn't change the width of the borderPanel like I want (I want the panel to get wider...)
Any thoughts on how to get this to work? The reference says minWidth is an option on borderPanels, so what's the code? FYI, I am supporting CS2 and CS3 for the script I am writing. Thanks in advance!
Dan
myDialog = app.dialogs.add( {name:"My Dialog", canCancel:true} )
with( myDialog ) {
with( dialogColumns.add() ) {
with( dialogRows.add() ) {
with( borderPanels.add( {minWidth:800} ) ) {
with( dialogColumns.add() ) {
staticTexts.add( {staticLabel:"My Label:"} )
}
with( dialogColumns.add() ) {
myTextEditBox = textEditboxes.add( {editContents:"initial text", minWidth:200} )
}
}
}
}
}
Any thoughts on how to get this to work? The reference says minWidth is an option on borderPanels, so what's the code? FYI, I am supporting CS2 and CS3 for the script I am writing. Thanks in advance!
Dan
TOPICS
Scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/indesign-discussions/js-user-interface-sizing-question/m-p/1146889#M278597
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
Daniel,
Try minwidth (all lower case).
Peter
Try minwidth (all lower case).
Peter
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Daniel_Rodney_
AUTHOR
New Here
,
/t5/indesign-discussions/js-user-interface-sizing-question/m-p/1146890#M278598
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
Lower case didn't work Peter, and in the Extended Toolkit's reference, it's minWidth with a capital W.
Any other ideas? Is this even possible to size the Border Panel instead of the elements in it? I was just re-reading the help on it and it talks about boxes
REFERENCE: ============
BorderPanel.minWidth
Data Type: number
The width of the control. For an editbox or combobox, specifies the minimum width of the box.
Any other ideas? Is this even possible to size the Border Panel instead of the elements in it? I was just re-reading the help on it and it talks about boxes
REFERENCE: ============
BorderPanel.minWidth
Data Type: number
The width of the control. For an editbox or combobox, specifies the minimum width of the box.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Beginner
,
/t5/indesign-discussions/js-user-interface-sizing-question/m-p/1146891#M278599
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
Sizing depends on lots of things and there's lots of ways.
For containers, use preferredSize to set height and width to values. It will set the height and width to that setting as a minimum. If the contents of the container need to be larger, it will make the container larger.
If you want to have the container take up the available space (say there's another object not in the panel that makes the window wider/taller than the panel, you can set alignment = "fill";
And you can always use the window.onShow event to do final tweaks. One of my favorites is to replace the name of the panel with a checkbox. The panel is enabled if the checkbox is checked. To do that, use the onShow method to move the checkbox to the correct location.
Bob
For containers, use preferredSize to set height and width to values. It will set the height and width to that setting as a minimum. If the contents of the container need to be larger, it will make the container larger.
If you want to have the container take up the available space (say there's another object not in the panel that makes the window wider/taller than the panel, you can set alignment = "fill";
And you can always use the window.onShow event to do final tweaks. One of my favorites is to replace the name of the panel with a checkbox. The panel is enabled if the checkbox is checked. To do that, use the onShow method to move the checkbox to the correct location.
Bob
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Participant
,
/t5/indesign-discussions/js-user-interface-sizing-question/m-p/1146892#M278600
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
I think Bob is talking about ScriptUI while Daniel is trying to use InDesign dialogs.
I'm not sure about the use of minWidth with Border Panels.
Dave
I'm not sure about the use of minWidth with Border Panels.
Dave
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/indesign-discussions/js-user-interface-sizing-question/m-p/1146893#M278601
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
Ugh. "minwidth" should indeed be "minWidth": I consult3ed some code I have and the values I used with "minwidth" happened to be the default, so I never realised that JS ignored the values I gave it. It has been less than helpful in not producing an error. And Dave is right: minWidth works only as a specified value in textEditboxes.
Peter
Peter
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Daniel_Rodney_
AUTHOR
New Here
,
/t5/indesign-discussions/js-user-interface-sizing-question/m-p/1146894#M278602
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
You are right Dave, I am using InDesign dialogs since I must support CS2.
It's confusing since the help lists minWidth under BorderPanels and no error is generated, but it doesn't work. So far I've been using empty spaces in static texts to "space" things out and make them look nice, but because of font differences between Mac and PC, only one platform looks perfect, while the other doesn't. I hoped that sizing the borderPanel directly would allow both platforms to have things line up perfectly.
Maybe it's a bug that it doesn't work? Maybe it's not meant to? I surely can't figure it out
It's confusing since the help lists minWidth under BorderPanels and no error is generated, but it doesn't work. So far I've been using empty spaces in static texts to "space" things out and make them look nice, but because of font differences between Mac and PC, only one platform looks perfect, while the other doesn't. I hoped that sizing the borderPanel directly would allow both platforms to have things line up perfectly.
Maybe it's a bug that it doesn't work? Maybe it's not meant to? I surely can't figure it out
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Participant
,
/t5/indesign-discussions/js-user-interface-sizing-question/m-p/1146895#M278603
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
JavaScript is a very open language. Need a new property for an object? Go ahead and create it by simply naming it.
Thus, BorderPanel.minwidth = 6 won't cause an error, it'll just add a new property and give it the value 6.
That minWidth doesn't work for BorderPanels is a surprise to me. It's a long time since I did such a dialog though.
Dave
Thus, BorderPanel.minwidth = 6 won't cause an error, it'll just add a new property and give it the value 6.
That minWidth doesn't work for BorderPanels is a surprise to me. It's a long time since I did such a dialog though.
Dave
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Daniel_Rodney_
AUTHOR
New Here
,
LATEST
/t5/indesign-discussions/js-user-interface-sizing-question/m-p/1146896#M278604
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
That's cool Dave, I didn't realize you could define your own properties like that. That explains the lack of an error and I'll have to keep that in mind for the future. Now if only we could get this built in minWidth property to work :)
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

