CPTextField Rounded Style has incorrect positioning : patch proposition

2 views
Skip to first unread message

Thomas Balthazar

unread,
Jan 4, 2009, 12:46:52 PM1/4/09
to objecti...@googlegroups.com
Commit : http://github.com/suitmymind/cappuccino/commit/b21a827b4199a7fa8a8a6355c9873363820f7ad3
Ticket : http://cappuccino.lighthouseapp.com/projects/16499/tickets/124-cptextfield-rounded-style-has-incorrect-positioning

Hello,

This patch modify the setBezelStyle method.
If the bezel style is CPTextFieldRoundedBezel, it modifies the
horizontal padding with ROUNDEDBEZEL_HORIZONTAL_PADDING (12 px).

This is my try to help and correct this bug.
Feel free to comment so I can learn more and improve my (future) contributions.

Best,
Thomas.

Ross Boucher

unread,
Jan 4, 2009, 2:54:41 PM1/4/09
to objecti...@googlegroups.com
Hi Thomas,

Thanks for sending the patch! I noticed a couple things about this
commit. First thing was that it looks like you are using "tab"
characters, instead of spaces. This complicates things for people who
use different editors with different tab widths, so we always use 4
spaces instead of a tab in Cappuccino.

The other problem is that you overwrite HORIZONTAL_PADDING with
ROUNDEDBEZEL_HORIZONTAL_PADDING. This means you lose
HORIZONTAL_PADDING forever -- which will break any text fields created
after this, since its a "static" variable.

Instead, you should probably look to where HORIZONTAL_PADDING is used,
and then selectively choose whether to use it, or to use
ROUNDEDBEZEL_HORIZONTAL_PADDING instead.

Hope that makes sense, let us know if you have any trouble with the
changes.

-Ross

Thomas Balthazar

unread,
Jan 4, 2009, 4:23:31 PM1/4/09
to objecti...@googlegroups.com
Hello Ross,

Thanks for the advices.
It of course totally makes sense to me.
I'll rework the patch (and the other I submitted too) and resubmit
them tomorrow.

About the tab thing, I was sure my editor was set to "Soft tabs", but
it indeed wasn't :-/

For the TextMate users, you have to switch to "Soft Tabs" in the
status bar of the text editor.

Cheers,
Thomas.

Thomas Balthazar

unread,
Jan 5, 2009, 11:48:40 AM1/5/09
to objecti...@googlegroups.com
Hello,

Here is the new commit :
http://github.com/suitmymind/cappuccino/commit/b5ccd53dcb95267b0c0aa12ab2f84bcfe1b78e5a

For the same ticket :
http://cappuccino.lighthouseapp.com/projects/16499/tickets/124-cptextfield-rounded-style-has-incorrect-positioning

Any comment welcome.
I hope this helps.

Best,
Thomas.

On Sun, Jan 4, 2009 at 8:54 PM, Ross Boucher <rbou...@gmail.com> wrote:
>

Ross Boucher

unread,
Jan 10, 2009, 10:43:18 PM1/10/09
to objecti...@googlegroups.com
Hey Thomas,

I had a chance to try out your patch. I think it has some unfortunate
side effects. Try running it on a new project, making the label
editable, and rounded. Then, try typing something longer than the
length of the field. This happens:

Picture 1.png

Thomas Balthazar

unread,
Jan 11, 2009, 9:55:42 AM1/11/09
to objecti...@googlegroups.com
Hello Ross,

Thanks for reporting this.
I think I solved this here :
http://github.com/suitmymind/cappuccino/commit/12b9e84442ae2c58675cabf77434909435deda34

In fact, the input element has to be resized too.

This whole patch is in those 2 commits :
* first :
http://github.com/suitmymind/cappuccino/commit/b5ccd53dcb95267b0c0aa12ab2f84bcfe1b78e5a
* second :
http://github.com/suitmymind/cappuccino/commit/12b9e84442ae2c58675cabf77434909435deda34

What do you think?

Best,
Thomas.
> <Picture 1.png>
>
>
> Not sure what the cause of the problem is, but I did verify that it
> used to work correctly before the patch.
>
> -Ross
>> --~--~---------~--~----~------------~-------~--~----~
>> You received this message because you are subscribed to the Google
>> Groups "Cappuccino & Objective-J Development List" group.
>> To post to this group, send email to objecti...@googlegroups.com
>> To unsubscribe from this group, send email to objectivej-de...@googlegroups.com
>> For more options, visit this group at http://groups.google.com/group/objectivej-dev?hl=en
>> -~----------~----~----~----~------~----~------~--~---
>>
>

Reply all
Reply to author
Forward
0 new messages