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
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
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
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
--
set Reply-To [string map {nospam schelte} $header(From)]
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.
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.
This is very nice! Thank you. Any chance on putting this up at the wiki?
/Mats
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.
Now BSD licensed. In cvs.
/Mats
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