|
|
 |
 |
 |
 |
TCL(Tool Command Language) Scripting
|
 |
 |
 |
 |
 |
 |
 |
 |
Give "curved corners" to entry widget
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
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 On Jun 1, 9: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. 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 Kevinhttp://www.codebykevin.com
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
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 .
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)]
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. -- Kevin Walzer Code by Kevin http://www.codebykevin.com
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. -- Bryan Oakley http://www.tclscripting.com
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. -- set Reply-To [string map {nospam schelte} $header(From)]
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. -- Bryan Oakley http://www.tclscripting.com
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? -- Kevin Walzer Code by Kevin http://www.codebykevin.com
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
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 Schelte -- set Reply-To [string map {nospam schelte} $header(From)]
Mats wrote: > 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
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. -- Kevin Walzer Code by Kevin http://www.codebykevin.com
On 3 Juni, 21:22, Kevin Walzer <k@codebykevin.com> wrote:
> Mats wrote: > > 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 > 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. > -- > Kevin Walzer > Code by Kevinhttp://www.codebykevin.com
Now BSD licensed. In cvs. /Mats
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
|
 |
 |
 |
 |
|