[27 Jan 2010] SetLayerStyle() on #TEXTOBJECT

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[27 Jan 2010] SetLayerStyle() on #TEXTOBJECT

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Wed, 27 Jan 2010 19:18:04 +0100

Hi all,

it seems there's a HUGE change of HW4.5' API compared to HW4.0 regarding SetLayerStyle()?!!

In HW4.0, I did the following to change the text of my text object (created by CreateTextObject() ),

Code: Select all

SetLayerStyle(LayerIDofTxtObj, {text="my new text"})
It seems that this is not possible anymore?!? Now, you have to create a completely NEW text object for EACH change of it's text and pass the ID of the new textobject to SetLayerStyle() instead? Is that true? Why this huge change? It is much more complicated and from the programmers point of view, much more work? And creating everytime a new text object must be expensive, too?

Well, if this is really true, then it would mean, more or less, that I have to design my HW4.0 script from SCRATCH again in order to get it work on HW4.5?

I don't believe that I want to do that and then I'm stuck -- HW4.0 has some severe bugs and HW4.5 has changed to much, then .. :-(

Please, say that I'm wrong and that it's still possible in HW4.5 to pass a string to SetLayerStyle() in order to change the text of a text object.

regards, Tom

thanks!
PEB
Posts: 591
Joined: Sun Feb 21, 2010 1:28 am

[27 Jan 2010] Re: SetLayerStyle() on #TEXTOBJECT

Post by PEB »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Wed, 27 Jan 2010 10:36:36 -0800 (PST)

Use TextOut() now to create a layer with text that can be modified with SetLayerStyle().
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[28 Jan 2010] Re: SetLayerStyle() on #TEXTOBJECT

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 28 Jan 2010 08:23:34 -0000

Yes, i COULD use TextOut(), but then GetAttribute() works different, as well. I have to pass the LayerID to GetAttribute and not anymore the TextObject-ID.

You see, the new API causes a lot of changes in scripts written for HW4.0 and is totally incompatible.

Is there a reason, why the features of TextObjects have been cut down?

By the way, from the semantic of the words textOBJECT and textOUT, you would expect that textobjects are more powerful and that you can handle them like objects, whereas textout "sounds" more like just a print function.

regards, Tom
PEB
Posts: 591
Joined: Sun Feb 21, 2010 1:28 am

[28 Jan 2010] Re: Re: SetLayerStyle() on #TEXTOBJECT

Post by PEB »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 28 Jan 2010 08:03:32 -0800 (PST)

If you are using SetLayerStyle() to change your text, then you need to specify a layer ID anyway. The nice thing is that you can easily assign a Layer Name for your TextOut layer right when you create it; and this name will stay with the layer no matter how the layer number might change later. Such as: TextOut(#CENTER, #CENTER, "This is a sample line of text", {Name="TextOut_1"}) And if you don't want to display the layer until later, then you can use {Hidden=True}.
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[28 Jan 2010] Re: SetLayerStyle() on #TEXTOBJECT

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 28 Jan 2010 16:38:06 -0000

Yes, I can see that TextOut() got a lot more features. However, that does not explain why a #TEXTOBJECT lost some of its features and hence, got incompatible to HW4.0 scripts.

Of course, I can do the changes you've suggested but it means to rewrite quite a big part of the HW4.0 script, just to change everything from #TEXTOBJECT to #TEXTOUT, which also forces you to change all GetAttribute()-calls, and all references from TextObject-IDs to Layer-IDs and the corresponding datastructure, etc.

Well, but in the end, I have no choice, so no reason to further argue about it ;-)

Actually, I had the hope that I'm wrong and that there's still a chance to easily change the text in #TEXTOBJECTs.

Anyway, thanks a lot for your advices! Tom
User avatar
airsoftsoftwair
Posts: 5914
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[28 Jan 2010] Re: SetLayerStyle() on #TEXTOBJECT

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 28 Jan 2010 22:59:45 +0100
I don't believe that I want to do that and then I'm stuck -- HW4.0 has some severe bugs and HW4.5 has changed to much, then .. :-(

Please, say that I'm wrong and that it's still possible in HW4.5 to pass a string to SetLayerStyle() in order to change the text of a text object.
I'm afraid that you're right :) Here's the history snippet:

Code: Select all

- Change: Layers of type #TEXTOBJECT were accidentally treated in the same way as
  #TEXTOUT and #PRINT although the latter two are fundamentally different; this has
  been changed now; the consequence is that the only attribute of a #TEXTOBJECT
  layer you can change with SetLayerStyle() is the "ID" element to assign a new
  text object to the layer; modifying the text or font is no longer possible; use
  a #TEXTOUT layer for that!
In fact, the 4.0 behaviour was a bug. SetLayerStyle() allowed you to change text objects but this could lead to unpredictable behaviour in case multiple instances of the same text object were on the screen. This was a first class design mistake so it had to be corrected in Hollywood 4.5. You must use #TEXTOUT now. This will be guaranteed to work for every and for always :)
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[29 Jan 2010] Re: SetLayerStyle() on #TEXTOBJECT

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 29 Jan 2010 10:58:48 -0000
In fact, the 4.0 behaviour was a bug. SetLayerStyle() allowed you to change text objects but this could lead to unpredictable behaviour in case multiple instances of the same text object were on the screen. This was a first class design mistake so it had to be corrected in Hollywood 4.5. You must use #TEXTOUT now. This will be guaranteed to work for every and for always :)
ok, THAT is a good reason for a change :-)

However, it makes life more complicated. If you use TextOut() you already have to know where your want to place the text (i.e. it's x,y-coordinates). So, the way to go here is, to draw them somewhere and use the attribute "hidden=true") and later to move them to the appropriate location.

Thanks, Tom

T
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[30 Jan 2010] Re: SetLayerStyle() on #TEXTOBJECT

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sat, 30 Jan 2010 14:25:37 +0100
However, it makes life more complicated. If you use TextOut() you already have to know where your want to place the text (i.e. it's x,y-coordinates). So, the way to go here is, to draw them somewhere and use the attribute "hidden=true") and later to move them to the appropriate location.
Another problem here is, that if u use TextOut the layer is created immediately. So you may have the problem that "groups of layers" appear behind another "group of layer" which may be not intended, and hence, the group of layers is hidden then.

So, therefore, I have feature request:

I'd like to have something like:

1) LayerToFront(LayerID) -- which brings a layer to top without the need to swap the position with another layer (like in SwapLayer()).

and

2) InsertLayerBehindOf(LayerID-a, Layer-b) or InsertLayerInFrontOf(LayerID-a,LayerID-b) --- which means, to insert a layer behind/in front of layer b and shift all other layers appropriately, such that the relative order of all layers (but LayerID-a) is not effected.

The available function "SwapLayer()" is not very useful for this task because it exchanges the position of two layers and that makes it difficult to bring a certain number of layers to front without permutating the order of these layers.

There's also already a function "InsertLayer()" but that only works with type BRUSH, ANIM and something else, but not with an already existing layer.

Thanks, Tom
Locked