Microsoft Windows: A thirty-two bit extension and graphical shell to a sixteen-bit patch to an eight-bit operating system originally coded for a four-bit microprocessor which was written by a two-bit company that can't stand one bit of competition
1
2
3
4
5
| for i := 0 to Form1.ControlCount - 1 do begin if Form1.Controls[i] is TCheckBox then (Form1.Controls[i] as TCheckBox).Checked := not (Form1.Controls[i] as TCheckBox).Checked; end; |
Zoiets draait als het goed is alle checkboxes om (aangevinkt wordt niet aangevinkt en andersom). Code is ongetest though, en ik heb al een tijd niks met Delphi gedaan.
[ Voor 10% gewijzigd door NMe op 02-10-2005 20:09 ]
'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.
Edit: Hmm, spuit 11, en dat met zo'n korte reply
[ Voor 38% gewijzigd door Paul op 02-10-2005 20:10 ]
"Your life is yours alone. Rise up and live it." - Richard Rahl
Rhàshan - Aditu Sunlock
Daar kan je dus doorlopen, en bij ieder element kan je mbhv de is operator gaan checken of het een TCheckbox betreft of niet.
1
2
3
4
5
6
7
| for Indx := 0 to Self.Controls.Count - 1 do begin
if Self.Controls[Indx] is TCheckbox then begin
// do stuff.
end;
end; |
Dit zou je al op weg moeten kunnen helpen. Je zult er geloof ik ook wel rekening moeten mee houden, dat, als je bv een panel hebt, of een andere 'container-control', je dan de controls-collection van die panel zult moeten uitlezen om de checkboxes die op die panel staan, op te vragen. (Je zult dus een recursieve functie moeten schrijven).
Hmm.... beetje te laat.
[ Voor 3% gewijzigd door whoami op 02-10-2005 20:11 ]
https://fgheysels.github.io/
'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.
https://fgheysels.github.io/
je code raised een exception, maar ik snap iig het doel. ik begrijp nu beter hoe de hiearchie in mekaar steekt en het is me zojuist gelukt om over mijn elementen heen te loopen. bedankt!-NMe- schreef op zondag 02 oktober 2005 @ 20:08:
Delphi:
1 2 3 4 5 for i := 0 to Form1.ControlCount - 1 do begin if Form1.Controls[i] is TCheckBox then (Form1.Controls[i] as TCheckBox).Checked := not (Form1.Controls[i] as TCheckBox).Checked; end;
Zoiets draait als het goed is alle checkboxes om (aangevinkt wordt niet aangevinkt en andersom). Code is ongetest though, en ik heb al een tijd niks met Delphi gedaan.
nu heb ik nog een vraagje. is het mogelijk om aan een checkbox een waarde toe te kennen (bijvoorbeeld een getal) of kun je alleen kijken of een checkbox gechecked is of niet?
Microsoft Windows: A thirty-two bit extension and graphical shell to a sixteen-bit patch to an eight-bit operating system originally coded for a four-bit microprocessor which was written by a two-bit company that can't stand one bit of competition
'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.
Verder kan ik me ook het nut niet voorstellen om een waarde toe te kennen aan die checkbox ?
https://fgheysels.github.io/
Microsoft Windows: A thirty-two bit extension and graphical shell to a sixteen-bit patch to an eight-bit operating system originally coded for a four-bit microprocessor which was written by a two-bit company that can't stand one bit of competition
Je kan wel de Tag property van de checkbox gebruiken om er 'control-specifieke' data in te zetten.
https://fgheysels.github.io/
Microsoft Windows: A thirty-two bit extension and graphical shell to a sixteen-bit patch to an eight-bit operating system originally coded for a four-bit microprocessor which was written by a two-bit company that can't stand one bit of competition
https://fgheysels.github.io/
ik heb net nog ff snel gekeken in de delphi help en daar staat ook dat het tag attribuut geen vast doel heeft, en dat het aan de programmeur is om te bepalen wat hij er mee doet. je kan er bijvoorbeeld een integer value in opslaan. dat is dus precies wat ik wil
dus probleem opgelost en weer wat geleerd
Microsoft Windows: A thirty-two bit extension and graphical shell to a sixteen-bit patch to an eight-bit operating system originally coded for a four-bit microprocessor which was written by a two-bit company that can't stand one bit of competition