Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Give "curved corners" to entry widget

13 views
Skip to first unread message

Kevin Walzer

unread,
Jun 1, 2007, 10:52:39 AM6/1/07
to
I'm trying to add an entry widget to my applications that looks like the
Mac-style search widget, i.e. with oval rather than square corners, and
with a magnifying glass embedded as an image. Jeff Hobbs' "menuentry"
widget provides the magnifying glass, which I'm using now, but not the
rounded corners.

Would it be feasible to create an entry megawidget with rounded corners
using the canvas? I can't really think of another way to do it. I know
that Mozilla apps "fake" the rounded corners with images, and that might
be my approach as well. Any pointers on where I can begin?

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com

Damon Courtney

unread,
Jun 1, 2007, 11:21:57 AM6/1/07
to
I've been thinking about this too. I read in your blog that some
Macophiles were saying your apps looked ugly because they didn't have
a native search entry or whatever. I love when people nitpick over
tiny imperfections even when the app looks really good. I think
you're pretty close to native-looking apps, we just need to take it
that one little extra step further.

I think the canvas is your best bet for approximating the search
bar. It's pretty easy to draw the rounded entry, add the search icon,
and the canvas even provides facilities for typing and handling text.
Though I would probably just draw the rounded polygon and then drop an
entry widget on top with an image outside the actual entry. If you
keep it all white, it'll all look like it's one widget. You just need
to make sure the canvas background matches that of the window beneath
it.

It's all pretty easy. I wouldn't use an image though. You have a
lot more flexibility with a canvas, and although the canvas generally
is a heavier widget, you only ever really have one search box per app.

Damon

Bryan Oakley

unread,
Jun 1, 2007, 11:41:21 AM6/1/07
to
Kevin Walzer wrote:
> Would it be feasible to create an entry megawidget with rounded corners
> using the canvas?

Yes, that technique works fine. I've successfully created megawidgets by
drawing them on a canvas. create an entry on the canvas with a
borderwidth of zero, use the canvas to get the bbox of the entry, and
draw a polygon around the edges. Or, depending on how round you want the
ends, draw arcs or circles.

If you really want it to look "mac-like", take a snapshot of your
favorite mac app, use an image manipulation tool to make copies of the
edges, and surround the entry widget with pieces of the bitmaps.

--
Bryan Oakley
http://www.tclscripting.com

Larry W. Virden

unread,
Jun 1, 2007, 12:05:49 PM6/1/07
to
On Jun 1, 10:52 am, Kevin Walzer <k...@codebykevin.com> wrote:
> I'm trying to add an entry widget to my applications that looks like the
> Mac-style search widget, i.e. with oval rather than square corners, and
> with a magnifying glass embedded as an image.

So is the look of the search widget different than the other macos
entry widgets? If so, perhaps it would be worthwhile for the MacTcl
team to put together a package of MacOS-specific widgets for
distribution .

Schelte Bron

unread,
Jun 1, 2007, 2:30:20 PM6/1/07
to
Kevin Walzer wrote:
> I'm trying to add an entry widget to my applications that looks
> like the Mac-style search widget, i.e. with oval rather than
> square corners, and with a magnifying glass embedded as an image.
> Jeff Hobbs' "menuentry" widget provides the magnifying glass,
> which I'm using now, but not the rounded corners.
>
I would expect this should be reasonably easy to do with Tile.


Schelte
--
set Reply-To [string map {nospam schelte} $header(From)]

Kevin Walzer

unread,
Jun 1, 2007, 4:10:37 PM6/1/07
to
Damon Courtney wrote:
> I've been thinking about this too. I read in your blog that some
> Macophiles were saying your apps looked ugly because they didn't have
> a native search entry or whatever. I love when people nitpick over
> tiny imperfections even when the app looks really good. I think
> you're pretty close to native-looking apps, we just need to take it
> that one little extra step further.
>
> I think the canvas is your best bet for approximating the search
> bar. It's pretty easy to draw the rounded entry, add the search icon,
> and the canvas even provides facilities for typing and handling text.
> Though I would probably just draw the rounded polygon and then drop an
> entry widget on top with an image outside the actual entry. If you
> keep it all white, it'll all look like it's one widget. You just need
> to make sure the canvas background matches that of the window beneath
> it.
>
> It's all pretty easy. I wouldn't use an image though. You have a
> lot more flexibility with a canvas, and although the canvas generally
> is a heavier widget, you only ever really have one search box per app.
>
> Damon
>

I've done some work on this, and have gotten a "rounded rectangle" drawn
with an entry embedded in it, and a magnifying glass icon. However, it's
butt ugly, and is way too big--it looks much more out of place than what
I'm currently using, the "menuentry widget" with a modified search icon.
In fact, the only flaw in the menuentry widget is that the corners
aren't rounded; otherwise it is perfect for my needs. So, after an hour
or two of hacking, I'm inclined to stay with what I've got.

Bryan Oakley

unread,
Jun 1, 2007, 5:08:23 PM6/1/07
to
Kevin Walzer wrote:
> I've done some work on this, and have gotten a "rounded rectangle" drawn
> with an entry embedded in it, and a magnifying glass icon. However, it's
> butt ugly, and is way too big--it looks much more out of place than what
> I'm currently using, the "menuentry widget" with a modified search icon.
> In fact, the only flaw in the menuentry widget is that the corners
> aren't rounded; otherwise it is perfect for my needs. So, after an hour
> or two of hacking, I'm inclined to stay with what I've got.
>

If you're good with a bitmap editor, create four tiny rounded corner
images (each probably 4x4 or so) and use "place" to place them over the
corners of your menuentry widget. If you are precise, and pick the right
colors, no one will be the wiser.

Schelte Bron

unread,
Jun 1, 2007, 5:10:47 PM6/1/07
to
Schelte Bron wrote:
> Kevin Walzer wrote:
>> I'm trying to add an entry widget to my applications that looks
>> like the Mac-style search widget, i.e. with oval rather than
>> square corners, and with a magnifying glass embedded as an image.
>> Jeff Hobbs' "menuentry" widget provides the magnifying glass,
>> which I'm using now, but not the rounded corners.
>>
> I would expect this should be reasonably easy to do with Tile.
>
I was right and tried to post my results of about an hour of hacking
here twice. However those posts never showed up. I'm guessing some
"intelligent" filter decided my posts were garbage, probably due to
the inlined gif image data.

Anyway, I put a screenshot and the code up at:
http://www.tclcode.com/search.html
Is that sort of what you are looking for?


Schelte.

Bryan Oakley

unread,
Jun 1, 2007, 5:14:40 PM6/1/07
to
Schelte Bron wrote:

> Schelte Bron wrote:
>> I would expect this should be reasonably easy to do with Tile.
>>
> I was right and tried to post my results of about an hour of hacking
> here twice. However those posts never showed up. I'm guessing some
> "intelligent" filter decided my posts were garbage, probably due to
> the inlined gif image data.
>
> Anyway, I put a screenshot and the code up at:
> http://www.tclcode.com/search.html
> Is that sort of what you are looking for?
>
>
> Schelte.

Very nice.

Kevin Walzer

unread,
Jun 1, 2007, 6:23:00 PM6/1/07
to

This is very nice! Thank you. Any chance on putting this up at the wiki?

Mats

unread,
Jun 2, 2007, 1:55:51 AM6/2/07
to
You can do a lot of tricks with tile. See the shot at:
http://coccinella.sourceforge.net/downloads/tileTricks.png
and my code in coccinella/contrib/tileutils.tcl
The shot was generated from the code at the bottom of that file with
hardcoded
image file paths. Coccinella: coccinella.sourceforge.net

/Mats

Schelte Bron

unread,
Jun 2, 2007, 6:47:29 AM6/2/07
to
Done: http://wiki.tcl.tk/18188


Schelte

Kevin Walzer

unread,
Jun 3, 2007, 3:22:32 PM6/3/07
to

What's the license on the tileutils code? Coccinella as a whole is GPL,
but a lot of the supporting bits say they are licensed under
BSD--tileutils.tcl, however, doesn't specify. I can use BSD stuff, but
not GPL, in my applications.

Mats

unread,
Jun 4, 2007, 1:40:32 AM6/4/07
to

Now BSD licensed. In cvs.

/Mats

Jeff Hobbs

unread,
Jun 4, 2007, 7:35:15 PM6/4/07
to Schelte Bron
Schelte Bron wrote:
> Kevin Walzer wrote:
>> Schelte Bron wrote:
>>> Schelte Bron wrote:
>>>> Kevin Walzer wrote:
>>>>> I'm trying to add an entry widget to my applications that looks
>>>>> like the Mac-style search widget, i.e. with oval rather than
>>>>> square corners, and with a magnifying glass embedded as an
>>>>> image. Jeff Hobbs' "menuentry" widget provides the magnifying
>>>>> glass, which I'm using now, but not the rounded corners.
>>>>>
>>>> I would expect this should be reasonably easy to do with Tile.
>>>>
>>> I was right and tried to post my results of about an hour of
>>> hacking here twice. However those posts never showed up. I'm
>>> guessing some "intelligent" filter decided my posts were garbage,
>>> probably due to the inlined gif image data.
>>>
>>> Anyway, I put a screenshot and the code up at:
>>> http://www.tclcode.com/search.html
>>> Is that sort of what you are looking for?
>>>
>>>
>>> Schelte.
>> This is very nice! Thank you. Any chance on putting this up at the
>> wiki?
>>
> Done: http://wiki.tcl.tk/18188

If someone would like to add this to mentry.tcl or in some other way
enshrine it as a tklib widget, I think it would be generally useful by
all. (read: I accept patches, no time now to integrate it myself).

Jeff

0 new messages