Page 1 of 1
Maintaining alpha-value in editor.
Posted: Fri Jul 25, 2008 1:11 pm
by jph_wacheski
I have noticed that when using the editors right-click-to-set-alpha-value on a colour,. that it works great, till you change the color. Then the alpha-value is reset to 1. Could this be changed so that the alpha value is maintained when tweeking the colour? I do realise I could just type the alpha in an expresion and be done with it,. however it is much more convienent simply using the editor interface.
Posted: Fri Jul 25, 2008 3:56 pm
by kattle87
Implemented.

DesignerGui, near line 540
Code: Select all
var
ColorDialog : TColorDialog;
procedure TZPropertyColorEdit.OnClick(Sender: TObject);
begin
if ColorDialog=nil then
ColorDialog := TColorDialog.Create(Application);
ColorDialog.Color := ZColorToColor( Value.ColorfValue );
ColorDialog.Options := [cdFullOpen];
if ColorDialog.Execute then
begin
Value.ColorfValue := ColorToZColor(ColorDialog.Color);
UpdateProp;
ValuePanel.Color := ColorDialog.Color;
end;
end;
should be:
Code: Select all
var
ColorDialog : TColorDialog;
AlphaTemp : single;
procedure TZPropertyColorEdit.OnClick(Sender: TObject);
begin
if ColorDialog=nil then
ColorDialog := TColorDialog.Create(Application);
ColorDialog.Color := ZColorToColor( Value.ColorfValue );
ColorDialog.Options := [cdFullOpen];
if ColorDialog.Execute then
begin
AlphaTemp := Value.ColorfValue.V[3];
Value.ColorfValue := ColorToZColor(ColorDialog.Color);
Value.ColorfValue.V[3] := AlphaTemp;
UpdateProp;
ValuePanel.Color := ColorDialog.Color;
end;
end;
Maybe Ville will include it

Posted: Sat Jul 26, 2008 1:33 pm
by jph_wacheski
Hay thats cool you found and remided it! I'm sure if it works and creates no additional problems that it will get included..,
Ok, here is another small thing that has been bugging me with the editor;
When editing a ZExpression,. if I navigate away from the expression, by first clicking on and expanding or collapsing a sepaerate part of the component tree, the changes to the expression are lost. This does not happen if I simply navigate to a seperate component, in that case the changes are saved properly. I am not sure if any other 'moves' cause this but I have nerrowed this annoiyng little querk down to that,. any ideas? I loose a lot of time retyping stuff currently,. as I often forget to hit TAB or click OK.
Posted: Sat Jul 26, 2008 5:52 pm
by kattle87
mmm I don't like the idea of a window like "save changes?" but I think we can add something like a global option: "Auto-save modifications to ZExpressions". If you agree doing something like that, yes I think we can make it working, maybe using a the loss of the focus as a trigger.
Posted: Sat Jul 26, 2008 8:06 pm
by jph_wacheski
I am not sure what you are saying here kattle? The editor already saves the changes to the window when you leave it,. only it forgets to do so if you first open any other part of the component tree,. by pressing on any of the small + [plus signs] or clicking on the heading. I think it is just an oversight,. . not sure.
Posted: Sat Jul 26, 2008 11:58 pm
by kattle87
Actually, it seems to me that changes to the ZExpressions are saved _only_ if the OK button is pressed, and they are discarded when you leave the ZExpression... And it should be so for "design" reasons. Just tell me again what you mean, I might understand better

Posted: Sun Jul 27, 2008 3:51 am
by jph_wacheski
Well just try it! If'n you type in an expression and then click on any other currenly displayed component in the tree, the change is saved,. even if you never pressed Tab or the Ok button. If however you click on one of the + or - icons or the names of other tree elements then click on one of those componenets the info you changed is lost,. . this is a frustration to me as often I change some code then move on,. and the changes are lost,. There is no editor design that I can think of that mandates the lost of the change,. why would that be a good idea,. if I chaged the data, I intend it to be changed, no?
Posted: Sun Jul 27, 2008 9:15 am
by kattle87
Yesterday it worked in a different way for me!!! Today I understood what you meant.
There are some "random" bugs still hidden in the editor I think

We must shoot 'em all

Posted: Mon Jul 28, 2008 1:48 pm
by VilleK
That alpha-fix looks good Kjell, you can check it in to the Subversion repository if you want to.
Posted: Mon Jul 28, 2008 1:53 pm
by kattle87
kjell???

Posted: Mon Jul 28, 2008 2:05 pm
by VilleK
Haha, sorry I thought it was Kjell

I read it too quickly. Good to see you're up to speed with the code too kattle!
I blame the mistake on the heat here in stockholm at the moment.