Object To Custom Type?
BlitzMax Forums/BlitzMax Beginners Area/Object To Custom Type?
| ||
Hi! iīm really stuck here...i donīt grasp the use of Object very well. GadgetItemExtra returns an Object, but how can i access that objectīs fields? Letīs say my extra object was a string, or another custom type object... how can i convert the Object returned, to my custum type object inserted? or access the string or custom object fields? Thanks in advance! |
| ||
That a MaxGUI thing? Anyway, you have to cast the object back to the original type:m:myType = myType(GadgetItemExtra()) x = myType.whatever |
| ||
Well, not a MaxGui Think actually... i just tried to explain myself with a built in command and that came up... but Omg i totally forgot about cast and even then... i didnīt knew you could cast objects in Bmax... Thanks a lot! |
| ||
Local MyCustomObject:TCustomObject = TCustomObject(PlainObject) where: MyCustomObject is the variable that will point the object with the apropiate fields, methods, etc. TCustomObject is the name of the type for MyCustomObject PlainObject Is the object to cast from. The base Object. |