How to change the properties of 32 ECSliders or other same components from one procedureI guess you are missing a begin/end, just a guess, I do not have that component.
Actually all the parameters apart from Top and Left will be the same.
I was trying this way but it fails to set them obviously because I am a bit dumb, the ECSLiders are all on form1.
procedure TForm1.Button1Click(Sender: TObject); begin with ECSlider1.Knob do BevelWidth:=2; Color:=clHighlight; Cursor:=crHandpoint; Height:=32; Style := eosButton; TickMarkCount:=1; TickMarkDesign:=etdSimple; TickmarkSpacing:=2; TickmarkStyle:=etsSolid; Width:=40; end;
BTW you are fired. >:D O:-)
procedure TForm1.Button1Click(Sender: TObject); begin with ECSlider1.Knob do // Seriously???? That is all wrong in this context! Use the sender. As I already explained
Sender inside a ButtonClick, what will it be? Let me think... maybe a button?BTW you are fired. >:D O:-)
procedure TForm1.Button1Click(Sender: TObject); begin with ECSlider1.Knob do // Seriously???? That is all wrong in this context! Use the sender. As I already explained
Sender inside a ButtonClick, what will it be? Let me think... maybe a button?Wrong again, even more wrong:
How to change the properties of 32 ECSliders or other same components from one procedureDo I understand correctly? There are 32 ECSliders on a form, and there is a button with which you want to change all properties (except for Left and Top) of the ECSliders?
procedure TForm1.Button1Click(Sender: TObject); begin with ECSlider1.Knob do BevelWidth:=2; Color:=clHighlight; Cursor:=crHandpoint; Height:=32; Style := eosButton; TickMarkCount:=1; TickMarkDesign:=etdSimple; TickmarkSpacing:=2; TickmarkStyle:=etsSolid; Width:=40; end;
Thaddy, please stop playing the boss here. A boss insulting his employees is not a good boss anyway.Well, if even you do not write proper code (using the sender parameter), what else can I do?
Use the sender parameter.
Any control can be identified. I could also use TECSlider.... You are missing the point.Use the sender parameter.
He can't use Sender, because Sender is TButton and he wants to change TECSlider with clicking on the button. Sender will never be TECSlider.
That is the wrong approach. Seriously, do it like my example. How many more stupid answers we get, how many more beginners questions we have to answer. >:D >:D >:D >:D O:-) :-*
Please show how would you change their styles using Sender when pressing one of the buttons.I'm curious too
That is the wrong approach. Seriously, do it like my example.You only showed pseudo-code, unrelated to the question.
That is the wrong approach. Seriously, do it like my example. How many more stupid answers we get, how many more beginners questions we have to answer. >:D >:D >:D >:D O:-) :-*
put all the controls inside of a TFlowPanel.
From there, you have a list of controls that you can step through via the ControlList property.
etc.
if Implemented, and I can't say if it is or not, the ECSlider.Assign(From_Another_ECSlider); should cover most of the settings.
After each one however, you'll most likely need to touch up the LEFT,TOP of the control so it doesn't overlap.
I would do it like this:
procedure TForm1.Button1Click(Sender: TObject); var i: Integer; begin For i := 0 to Pred(ControlCount) do If Controls[i] is TECSlider then With (Controls[i] as TECSlider).Knob do begin BevelWidth:=2; Color:=clHighlight; Cursor:=crHandpoint; Height:=32; Style := eosButton; TickMarkCount:=1; TickMarkDesign:=etdSimple; TickmarkSpacing:=2; TickmarkStyle:=etsSolid; Width:=40; end; end;
...
So I copied the code from 'your button 1' and placed it into one of my buttons 'button 2'.
I get instant compile errors, attached an image.
...
...
So I copied the code from 'your button 1' and placed it into one of my buttons 'button 2'.
I get instant compile errors, attached an image.
...
All of the highlighted errors are defined in the ectypes.pas unit. Does that unit appear in your uses clause?