je ne crois pas que ca soit faisaible aussi simplement...
il faut, je pense, qu'a la creation de ta form, tu parcours tous tes composants, et si c'est une checkbox avec un nom qui commance par 'ccAdr', l'ajouter a un tableau de checkbox puis apres, utiliser le tableau pour changer les captions de tes checkbox
par ex:
Code :
- type
- TCheckArray = array[1..9] of TCheckbox;
- tabAdr = array [1..9] OF string
- var
- FCheckBoxes : TCheckArray;
- procedure TForm1.FormCreate(Sender: TObject);
- var
- iIndex, iChkCount, iCmpCount, iPos : integer;
- chkCheck : TCheckBox;
- begin
- iCmpCount := Form1.ComponentCount;
- // on parcourt tous les composants
- for iIndex := 0 to iCmpCount - 1 do
- begin
- // on ne prend en compte que les checkboxs
- if (Form1.Components[iIndex] is TCheckBox) then
- begin
- chkCheck := (Form1.Components[iIndex] as TCheckBox);
- // on verifie sa taille
- if length(chkCheck.Name) = length('ccAdrX' ) then
- // on verifie son nom
- if Copy(chkCheck.Name,1,length('ccAdr' )) = 'ccAdr' then
- begin
- // on assign la checkbox a la bonne position du tableau
- // position qui est donnee par le dernier caractere composant le nom
- iPos := StrToInt(chkCheck.Name[length(chkCheck.Name)]);
- FCheckBoxes[iPos] := chkCheck;
- end;
- end;
- end;
- end;
|
et donc maintenant, tu as un tableau avec toutes tes checkboxes et tu peux le parcourir dans une boucle pour modifier les captions ou autres proprietes
ps: c'est pas dit que le code marche, je l'ai fait comme ca de tete !
[edit]--Message édité par JWhy--[/edit]
---------------
www.alliancefrancophone.org ... Home is where the heart is