Re: scrolling woes
On May 20, 2017, at 12:01 , J.E. Schotsmanwrote: > > I am happy with the result except that I cannot set the placeholder text now. If the text is not editable, then a text view is a better choice than a text field, but it should probably be bordered and maybe have a different background color (otherwise how do users know there’s something to scroll?). However, you don’t need placeholder text in the sense of text that tells the user what to type. Instead, you should probably do what Apple does, e.g. in Xcode when you deselect everything in the project navigator on the left, it shows “No Selection” in the inspector panel on the right. To do that, use a second view (a text field, probably) that’s constrained to the bounds of the text field’s visible extent. Center the placeholder text horizontally and vertically, and use a large font size. Then, when setting text into the text view, hide or show exactly one of the two views, as appropriate to the text. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: scrolling woes
> On 20 May 2017, at 19:11, Saagar Jha wrote: > > Scroll views are dependent on the content size of their subviews. This can be > done > by setting unambiguous constraints to the margins of the scroll view > by manually setting the contentSize of the scroll view. > If you don’t do either of these, the scroll view won’t work. Looks like I can't get the scrolling behaviour for free in this way as I was hoping. >> So I dumbed down the text view to a text field with vertical scroll bar in >> the xib. >> After setting the scroller enabled (why would you want a scroll bar that is >> visible, yet not enabled?) it started to work. > > Wait, what? How did you “dumb” down the text view? Did you start deleting > components? In general, this isn’t what you want to do; you can control > whether the scroll bars are shown through code or the inspector on the right > side. What behavior are you trying to achieve? The behaviour of a non-editable text field with the added property that it can be scrolled. I used the inspector to disable most of the capabilities of the text view. I am happy with the result except that I cannot set the placeholder text now. Jan E. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: scrolling woes
> On 20 May 2017, at 20:02, Quincey Morris wrote: > >> I had a text field within a tab view item whose text was getting too large. > > Too large, as in: there are multiple lines of text whose total vertical > height exceeds the height of the text field? Yes > So I embedded it in a scroll view. No matter what I tried in the xib editor, > I couldn't get the scrolling to work. > > Well, no, of course not. A text field is a control, so you put the control in > a scroll view. The control itself isn’t bigger than the height available, > just the text within the control. Since the scroll bar acts on the control, > it doesn’t scroll the text. So to make this work I would have to set the height of the text field equal to the height of the text every time I change the stringValue? Sounds like I need a text view instead to display a long non-editable text. Jan E. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: scrolling woes
On May 20, 2017, at 06:00 , J.E. Schotsmanwrote: > > I had a text field within a tab view item whose text was getting too large. Too large, as in: there are multiple lines of text whose total vertical height exceeds the height of the text field? > So I embedded it in a scroll view. No matter what I tried in the xib editor, > I couldn't get the scrolling to work. Well, no, of course not. A text field is a control, so you put the control in a scroll view. The control itself isn’t bigger than the height available, just the text within the control. Since the scroll bar acts on the control, it doesn’t scroll the text. > Does this have to be so hard? I went to a (macOS) test project, dragged an editable text field into the main window, and changed its Layout attribute from “scrolls” [== scrolls horizontally] to “wraps” [== scrolls vertically]. When I run the app and type more than one line of text, it scrolls down as I type enough text. If I use the up and down arrow keys to move around the text, it scrolls to keep the selection visible. Certainly, there is no scroll bar, but in what sense doesn’t it scroll? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: scrolling woes
I haven’t seen your xib files, so this is just a guess, but here it goes: Saagar Jha > On May 20, 2017, at 06:00, J.E. Schotsmanwrote: > > Hello, > > I had a text field within a tab view item whose text was getting too large. > So I embedded it in a scroll view. No matter what I tried in the xib editor, > I couldn't get the scrolling to work. > Does this have to be so hard? Scroll views are dependent on the content size of their subviews. This can be done by setting unambiguous constraints to the margins of the scroll view by manually setting the contentSize of the scroll view. If you don’t do either of these, the scroll view won’t work. > > After a little googling I realised I could use a text view instead. Yes, you probably should. > So I dumbed down the text view to a text field with vertical scroll bar in > the xib. > After setting the scroller enabled (why would you want a scroll bar that is > visible, yet not enabled?) it started to work. Wait, what? How did you “dumb” down the text view? Did you start deleting components? In general, this isn’t what you want to do; you can control whether the scroll bars are shown through code or the inspector on the right side. What behavior are you trying to achieve? > > This is a reasonable workaround except that now I have no placeholder value > (would have to code that myself) and I noticed a curious bug in the text > field (which would probably happen in an embedded text field as well): > > Suppose I have three options for the text, one lets the scroll bar autohide, > the second text is too large, the third text barely fits if the scroll bar is > hidden. Now the look of the third text depends on the previous value: it can > show without the scroll bar being visible, or it can show with the scroll bar. > > Jan E. > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com > > This email sent to saa...@saagarjha.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
scrolling woes
Hello, I had a text field within a tab view item whose text was getting too large. So I embedded it in a scroll view. No matter what I tried in the xib editor, I couldn't get the scrolling to work. Does this have to be so hard? After a little googling I realised I could use a text view instead. So I dumbed down the text view to a text field with vertical scroll bar in the xib. After setting the scroller enabled (why would you want a scroll bar that is visible, yet not enabled?) it started to work. This is a reasonable workaround except that now I have no placeholder value (would have to code that myself) and I noticed a curious bug in the text field (which would probably happen in an embedded text field as well): Suppose I have three options for the text, one lets the scroll bar autohide, the second text is too large, the third text barely fits if the scroll bar is hidden. Now the look of the third text depends on the previous value: it can show without the scroll bar being visible, or it can show with the scroll bar. Jan E. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com