Yes, I'm mixing things: If we talk about the Pointers - I mix the Pointer from the BaseStructure and the derivated Structure.
Both Pointers are the same. That's the trick in Purebasic!
No, I was talking about mixing up what I wanted to do. I clearly distinguish between what is virtual and what is visual, although, yes, I admit it can also be confusing because both are actually virtual.
I don’t know how to explain it better, so maybe this small code will help.
Later, to use it with my visual object manager, I could, for example, use it like this and do:
Code: Select all
; Visual Objects Handler
; Module, EndModule, structure etc, etc.
; Includes the Virtual Objects Handler module for use with my Visual Objects Handler module
Procedure CreateObject(ObjectNumber.i, X.i, Y.i, Widht.i, Height.i)
; Création d'un Objet, #PB_Any = ID automatique.
; Renvoie un Objet.
;
; Creates an Object, #PB_Any = Automatic ID.
; Returns an Object.
MyObjectRoot = VOM_CreateObject(ObjectNumber.i = #PB_Any, Name.s "") ; VOM_ = VirtualObjectManager, Evite les conflits de Nom potentiel avec d'autres fonctions existantes.
; VOM_ = VirtualObjectManager, Avoids potential naming conflicts with other existing functions.
; Si la création de l'Objet a réussi.
; Si l'objet existe bien et est initialisé.
;
; If the Object creation was successful.
; If the object exists and is initialized.
If MyObjectRoot.Init
MyObjectRoot.X = X.i
MyObjectRoot.Y = Y.i
MyObjectRoot.Width = Widht.i
MyObjectRoot.Height = Height.i
EndIf
; ....
EndProcedure
------
Yes an abstract Manager of grafical Objects which can handle all the basic functions like
- Move, Rezize, Select groups, draw, docking objects ...
No, that's in the second phase, but yes, in the long term, that's right, in the first phase I want to make the virtual object manager (Data).
Does this mean anything to you, it's an idea of what I think I'd like, no graphics, just data:
I know that this kind of thing is not possible in purebasic:
MyObjectRoot.X = 48
MyObjectRoot.Y = 25
but we'll replace it with this, for example:
MyObjectRoot\X = 48
MyObjectRoot\Y = 25
Code: Select all
; Initialise le gestionnaire d'objet virtuel pour pouvoir l'utiliser.
; On accède aux objets depuis ce gestionnaire.
;
; Initializes the virtual object manager so it can be used.
; Objects are accessed through this manager.
If InitVirtualObjectManager()
; Création d'un Objet, #PB_Any = ID automatique.
; Renvoie un Objet.
;
; Creates an Object, #PB_Any = Automatic ID.
; Returns an Object.
MyObjectRoot = VOM_CreateObject(ObjectNumber.i = #PB_Any, Name.s "") ; VOM_ = VirtualObjectManager, Evite les conflits de Nom potentiel avec d'autres fonctions existantes.
; VOM_ = VirtualObjectManager, Avoids potential naming conflicts with other existing functions.
; Si la création de l'Objet a réussi.
; Si l'objet existe bien et est initialisé.
;
; If the Object creation was successful.
; If the object exists and is initialized.
If MyObjectRoot.Init
; Définit les propriétés de l'objet:
;
; Defines the object's properties:
MyObjectRoot.Name = "MyObjectRoot"
MyObjectRoot.X = 48
MyObjectRoot.Y = 25
MyObjectRoot.Width = 48
MyObjectRoot.Height = 25
EndIf
; ----------------
; Création d'un Objet Enfant, #PB_Any = ID automatique.
; Renvoie un Objet.
;
; Creates a Child Object, #PB_Any = Automatic ID.
; Returns an Object.
MyObjectChild = VOM_CreateObject(ObjectNumber.i = #PB_Any, Name.s "") ; VOM_ = VirtualObjectManager, Evite les conflits de Nom potentiel avec d'autres fonctions existantes.
; VOM_ = VirtualObjectManager, Avoids potential naming conflicts with other existing functions.
; Si la création de l'Objet a réussi.
; Si l'objet existe bien et est initialisé.
;
; If the Object creation was successful.
; If the object exists and is initialized.
If MyObjectChild.Init
; Si l'objet parent existe bien et est initialisé.
;
; If the parent object exists and is initialized.
If MyObjectRoot.Init
; Ajout d'un Objet enfant (MyObjectChild) à l'Objet MyObjectRoot.
;
; Adds a Child Object (MyObjectChild) to the MyObjectRoot Object.
MyObjectRoot.AddChild(MyObjectChild) ; MyObjectChild est l'enfant de MyObjectRoot.
; MyObjectChild is the child of MyObjectRoot.
; Définit les propriétés de l'objet:
;
; Defines the object's properties:
MyObjectChild.Name = "Child 1 - MyObjectRoot"
MyObjectChild.X = 10
MyObjectChild.Y = 15
MyObjectChild.Width = 65
MyObjectChild.Height = 32
EndIf
EndIf
; ----------------
; Création d'un Objet Enfant d'un Enfant, #PB_Any = ID automatique.
; Renvoie un Objet.
;
; Creates a Sub-Child Object, #PB_Any = Automatic ID.
; Returns an Object.
MyObjectSubChild = VOM_CreateObject(ObjectNumber.i = #PB_Any, Name.s "") ; VOM_ = VirtualObjectManager, Evite les conflits de Nom potentiel avec d'autres fonctions existantes.
; VOM_ = VirtualObjectManager, Avoids potential naming conflicts with other existing functions.
; Si la création de l'Objet a réussi.
; Si l'objet existe bien et est initialisé.
;
; If the Object creation was successful.
; If the object exists and is initialized.
If MyObjectSubChild.Init
; Si l'objet parent existe bien et est initialisé.
;
; If the parent object exists and is initialized.
If MyObjectChild.Init
; Ajout d'un Objet enfant (MyObjectSubChild) à l'Objet MyObjectChild.
;
; Adds a Child Object (MyObjectSubChild) to the MyObjectChild Object.
MyObjectChild.AddChild(MyObjectSubChild) ; MyObjectSubChild est l'enfant de MyObjectChild.
; MyObjectSubChild is the child of MyObjectChild.
; Définit les propriétés de l'objet:
;
; Defines the object's properties:
MyObjectSubChild.Name = "Child 1 - MyObjectSubChild"
MyObjectSubChild.X = 25
MyObjectSubChild.Y = 48
MyObjectSubChild.Width = 100
MyObjectSubChild.Height = 35
EndIf
EndIf
; --------------------------------------------------------
; Affichage des objets et de leurs valeurs respectives.
; Displays objects and their respective values.
; On pourrait imaginer une fonction qui liste des objets en fonction de paramètres, par exemple à partir d'un objet parent et de ses enfants et en fonction de leur position X, dans l'ordre croissant ou décroissant.
; Properties.i (ID, Name, X, Y, Width, Height, Layer, etc), peut être par exemple #VOM_ExamineNoProperties pour dire que ce paramètre est ignoré.
; Options.i (Ascending, Descending, NoCase (If Name))
;
; We could imagine a function that lists objects based on parameters, for example from a parent object and its children, and based on their X position, in ascending or descending order.
; Properties.i (ID, Name, X, Y, Width, Height, Layer, etc), could be for example #VOM_ExamineNoProperties to indicate that this parameter is ignored.
; Options.i (Ascending, Descending, NoCase (If Name))
Object = VOM_ExamineObject(ObjectParent.i = #None, ExamineSubChild.b = #True, level.i = 0, Properties.i = #VOM_ExamineByID, Options.i = #VOM_ExamineAscending) ; Réinitialise l'examination et Renvoie le premier objet examiné en fonction des paramètres indiqués.
; Resets the examination and returns the first examined object based on the specified parameters.
; Si le paramètre ObjectParent est différent de #None et est un objet valide (Renvoie 0 si ObjectParent n'existe pas), ça peut être n'importe quel objet.
; Alors l'examination démarrera à partir d'ici dans la hiérarchie des objets et si ExamineSubChild.b = #True (Si #False, juste le parent est concerné), alors cherchera dans tous les enfants de ce ObjectParent.
; Et si Level est supérieur à 0 (car 0 est le parent actuel et tous ses enfants), alors examine les enfants des enfants en fonction de la profondeur de recherche (Level).
; Par exemple, si 1, cherchera dans tous les enfants des enfants du parent, si 2 alors cherchera dans tous les enfants des enfants des enfants du parent, etc.
;
; If the ObjectParent parameter is not #None and is a valid object (Returns 0 if ObjectParent does not exist), it can be any object.
; Then the examination will start here in the object hierarchy, and if ExamineSubChild.b = #True (If #False, only the parent is concerned), it will search through all the children of this ObjectParent.
; And if Level is greater than 0 (since 0 is the current parent and all its children), it examines the children of the children based on the search depth (Level).
; For example, if 1, it will search through all the children of the children of the parent, if 2 then it will search through all the children of the children of the children of the parent, etc.
; Exemple: (Dans cet exemple, si ExamineSubChild.b = #True, alors l'objet MyObjectSubChild sera pris en compte dans l'examination, sinon non.)
; Example: (In this example, if ExamineSubChild.b = #True, then the MyObjectSubChild object will be included in the examination, otherwise not.)
MyObject = VOM_ExamineObject(ObjectParent.i = MyObjectChild, ExamineSubChild.b = #True, level.i = 4, "X", #Descending) ; Ici il n'y a pas 4 niveaux, donc examinera tous les niveaux qui existent mais jusqu'à 4 maximum.
; Here there are not 4 levels, so it will examine all existing levels but up to a maximum of 4.
While MyObject
Debug "Object Name: " + Object.Name
Debug "Object ID: " + Object.ID
Debug "Object X: " + Object.Name
Debug "Object Y: " + Object.Name
Debug "Object Width: " + Object.Width
Debug "Object Height: " + Object.Height
Debug "-----------------------------"
Object = VOM_NextObject() ; Renvoie le prochain objet examiné.
; Returns the next examined object.
Wend
; --------------------------------------------------------
; Recherche un Objet quelconque portant ce nom.
; Renvoie un Objet.
;
; Searches for any Object with this name.
; Returns an Object.
Object = VOM_FindObjectByName(ObjectName.s)
If Object.X = 45
...
EndIf
; Recherche un Objet spécifique depuis son numéro d'identification.
; Renvoie un Objet.
;
; Searches for a specific Object by its identification number.
; Returns an Object.
Object = VOM_FindObjectByID(ObjectID.i)
If Object.Width = 200
...
EndIf
; Recherche un Objet très spécifique portant ce numéro d'identification ainsi que ce Nom.
; Renvoie un Objet.
;
; Searches for a very specific Object with this identification number and this Name.
; Returns an Object.
Object = VOM_FindObjectByIDAndName(ObjectName.s, ObjectName.s)
If Object.Width = 50 And Object.Height = 75
...
EndIf
; Renvoie l'objet Parent de l'objet indiqué ou 0 si il n'y en a pas.
; Si Object = MyObjectRoot, renverra donc MyObjectRoot par exemple, si c'est MyObjectSubChild, renverra donc MyObjectChild.
;
; Returns the Parent object of the specified object, or 0 if there is none.
; If Object = MyObjectRoot, it will return MyObjectRoot, for example. If it's MyObjectSubChild, it will return MyObjectChild.
ParentObject = VOM_FindObjectParent(Object)
If ParentObject.Name = "Child 1 - MyObjectRoot"
...
EndIf
; Renvoie le parent racine d'un objet (Le tout premier).
; Renvoie un Objet.
;
; Returns the root parent of an object (the very first one).
; Returns an Object.
MyObjectRootParent = VOM_FindObjectRootParent(MyObjectSubChild) ; Renvoie: MyObjectRoot.
; Returns: MyObjectRoot.
; Détruit un Objet et éventuellement tous ses enfants.
; Si DeleteChild.b = #True, tous les enfants seront aussi supprimés, sinon ils seront placés dans le parent de l'objet (Object) précédent.
; Si pas de parent, ils n'auront alors pas de parent = Orphelin (Note: Un objet créé par défaut est orphelin !).
; Si un objet enfant est le parent d'autres objets enfants, alors les enfants de cet objet enfant (Parent) garderont leur parent qui est l'objet enfant de base.
;
; Destroys an Object and optionally all its children.
; If DeleteChild.b = #True, all children will also be deleted; otherwise, they will be placed in the previous parent of the Object.
; If there is no parent, they will have no parent = Orphan (Note: An object created by default is orphaned!).
; If a child object is the parent of other child objects, then the children of that child object (Parent) will keep their parent, which is the base child object.
VOM_DeleteObject(Object.i, DeleteChild.b = #True)
EndIf
I am French, I do not speak English.
My apologies for the mistakes.
I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.