It is necessary to change the property enabled for all components (TextEdit, ComboBox, etc.), united in the groupbox.
Closed due to the fact that the essence of the issue is incomprehensible by the Enikeyschik participants, AK ♦ , 0xdb , LFC , Edward 25 Jan at 7:39 .
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
|
1 answer
Because TGroupBox inherited from TWinControl , it has the Controls property - an array of all controls that lies inside it. In the loop, loop through everything (indexes from 0 to ControlCount -1) and change Enabled
PS The Enabled property is missing from components ( TComponent ). It appears only in controls ( TControl )
- var I, K, x: Integer; ChildGroupBox, ChildControl: TControl; begin for i: = 0 to ComponentCount - 1 begin begin If Components [i] is TGroupBox then for k: = 0 to ControlCount - 1 do begin ChildControl: = Controls [k]; if ChildControl.Name = 'gbHeader' then for x: = 0 to gbHeader.ControlCount -1 do begin ChildGroupBox: = gbHeader.Controls [x]; ChildGroupBox.Enabled: = True; end; end; end; end; - djoni
- I have one question left
if ChildControl.Name = 'gbHeader' then for x := 0 to gbHeader.ControlCount -1 doin the cycle itself I indicated the object itself. What type should I declare to be able to use a variable instead of an object name? for example_VariableName.ControlCount -1- djoni _VariableName: TControl- German Borisov- oneBut I can not understand why you are looking for, ChildControl. Name = 'gbHeader', if you already have gbHeader? - German Borisov
- oneThe fact is that I have 4 GroupBoxs on my frame, and in some GroupBox not all controls need to be made active. - djoni
|