Description GetPropList utilises Delphi's RTTI (Run Time Type Information) to retrieve a list of property information records for a component or component type. In one form of this function, TypeInfo defines the component type, PropList defines a variable to receive the list of properties : a pointer to a TPropList variable, and TypeKinds defines the type of properties that will be returned. Use tkAny to return all types. The list may optionally be sorted by setting SortList true. The Delphi inbuilt TypeInfo function may be used to provide the TypeInfo value. In the other form of this function, you specify a component instance rather than component type. The TypeKinds and SortList parameters can no longer be specified. Note: If you do not need the count of properties returned, use GetPropInfos.
GetPropLIst utilise RTTI pour aller chercher des informations concernant une liste de propriétés d'un composant sous forme de "records". Cette fonction a plusieurs formes possibles. Sous l'une de ces formes, Typeinfo définit le type de composant, Proplist est une variable destinée à recevoir la liste des propriétés, un PPropList est un pointeur de PropList, et Typekind définit le type de propriété (entier, caractere, string, etc...) La fonction TypeInfo peut remplacer GetPropList (Korgis n'a pas menti). Sous une autre forme de cette fonction, (celle que j'utilise) le 1er paramètre peut être le nom d'un composant ('Label1') plutôt qu'un type (TLabel) On peut aussi utiliser la fonction GetPropInfos.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionbegin Ma_procedure:= 'Afficher_salut"; Ma_procedure; end;
PROCEDURE TForm1.Afficher_salut; Begin ShowMessage('Salut!') ; End; PROCEDURE TForm1.Button1Click(Sender: TObject) ; Begin Executer(Form1, 'Afficher_salut') ; End; PROCEDURE TForm1.Executer(La_Classe: TObject; Nom_de_la_procedure: String) ; type TModule_executable = PROCEDURE Of OBJECT; var Ma_methode: TMethod; Module_executable: TModule_executable; begin // On définit Ma_méthode Ma_methode.Data := Pointer(La_Classe) ; Ma_methode.Code := La_Classe.MethodAddress(Nom_de_la_procedure) ; // Si le nom de la procédure est bidon, on laisse tomber IF NOT Assigned(Ma_methode.Code) THEN EXIT; // On définit la partie exécutable et on l'exécute Module_executable := TModule_executable(Ma_methode) ; Module_executable; end;
Valeur_de_la_propriete:= GetPropValue(Le_composant,Nom_de_la_propriete); Memo1.lines.add(vartostr(valeur_de_la_propriete));
Name = 'Button1' OnClick = TNotifyEvent OnContextPopup = TContextPopupEvent OnDragDrop = TDragDropEvent OnDragOver = TDragOverEvent OnEndDock = TEndDragEvent OnEndDrag = TEndDragEvent OnEnter = TNotifyEvent OnExit = TNotifyEvent OnKeyDown = TKeyEvent OnKeyPress = TKeyPressEvent OnKeyUp = TKeyEvent OnMouseDown = TMouseEvent OnMouseMove = TMouseMoveEvent OnMouseUp = TMouseEvent OnStartDock = TStartDockEvent OnStartDrag = TStartDragEvent
IF propriete<> Nil THEN