How to create image morph?
Hi, I want to create a custom icon for a list or tab. I can create a simple shape morph and add a text to it, but how do I convert it into an image morph or form? And is it ok to build such things with morphs? Uko P.S. I need to change text on image, so static graphic will not work.
Not sure if this will be of much help, but as far as icons go I used this to generate my custom icons ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | dir files theme | dir := '/home/peter/prog/dynacase/icons' asFileReference. files := (dir allFiles select: [ :each | each extension = 'png' ]) collect: [ :each | each base ]. theme := ThemeIcons current. files do: [ :each | theme createIconMethodsFromFile: each directory: dir ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~ This generates xyIconContents and xyIcon in current ThemeIcons. So you could probably check the implementation of createIconMethodsFromFile:directory: and bend it to your needs. Peter On Fri, Mar 27, 2015 at 11:14 AM, Yuriy Tymchuk <yuriy.tymchuk@me.com> wrote:
Hi, I want to create a custom icon for a list or tab. I can create a simple shape morph and add a text to it, but how do I convert it into an image morph or form? And is it ok to build such things with morphs?
Uko
P.S. I need to change text on image, so static graphic will not work.
I need to draw a different icon/text depending on the situation. So the question is how can I draw an image morph, or a form in an easy way. Uko
On 27 Mar 2015, at 11:43, Peter Uhnák <i.uhnak@gmail.com> wrote:
Not sure if this will be of much help, but as far as icons go I used this to generate my custom icons
~~~~~~~~~~~~~~~~~~~~~~~~~~~ | dir files theme | dir := '/home/peter/prog/dynacase/icons' asFileReference. files := (dir allFiles select: [ :each | each extension = 'png' ]) collect: [ :each | each base ]. theme := ThemeIcons current. files do: [ :each | theme createIconMethodsFromFile: each directory: dir ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~
This generates xyIconContents and xyIcon in current ThemeIcons. So you could probably check the implementation of createIconMethodsFromFile:directory: and bend it to your needs.
Peter
On Fri, Mar 27, 2015 at 11:14 AM, Yuriy Tymchuk <yuriy.tymchuk@me.com <mailto:yuriy.tymchuk@me.com>> wrote: Hi, I want to create a custom icon for a list or tab. I can create a simple shape morph and add a text to it, but how do I convert it into an image morph or form? And is it ok to build such things with morphs?
Uko
P.S. I need to change text on image, so static graphic will not work.
Uko2 wrote
how do I convert it into an image morph or form?
Something like: Morph new addMorph: (TextMorph new contents: 'something'); iconOrThumbnail. ? ----- Cheers, Sean -- View this message in context: http://forum.world.st/How-to-create-image-morph-tp4815501p4815524.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Oh yes, it works. Thank you. Is it ok to do it like that? Uko
On 27 Mar 2015, at 12:54, Sean P. DeNigris <sean@clipperadams.com> wrote:
Uko2 wrote
how do I convert it into an image morph or form?
Something like: Morph new addMorph: (TextMorph new contents: 'something'); iconOrThumbnail. ?
----- Cheers, Sean -- View this message in context: http://forum.world.st/How-to-create-image-morph-tp4815501p4815524.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Oh yes, it works. Thank you. Is it ok to do it like that? Why not? I guess youâll have to handle update notifications if you want it always up to date...
----- Cheers, Sean -- View this message in context: http://forum.world.st/How-to-create-image-morph-tp4815501p4815608.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
participants (3)
-
Peter Uhnák -
Sean P. DeNigris -
Yuriy Tymchuk