|
#1
|
||||
|
||||
|
Use of variables for object definition (not name)
Is it possible to do that?
I"ll explain: I have one image (Image1) and one Button (Button1) on the page. Based on a given event, I want to influence one object or the other with something like that: objectdef = "Image" objectdef.setpos (......) Thanks Yossi |
|
#2
|
||||
|
||||
|
Yes you can do that.
Since the SetPos actions are the same from one object to another you can determine what type of object you are dealing with, set a variable to be that object type and then execute the SetPos Action.Code:
Object = nil;
if ObjectType == "OBJECT_IMAGE" then
Object = Image; --no quotes around the word image
--What this does is set the Object variable to the Image table which
--defines all of the Image actions. Cool huh
elseif ObjectType == "OBJECT_BUTTON" then
Object = Button;
end
if Object then
Object.SetPos(sName, x, y)
end
__________________
TJ-Tigger "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools." "Draco dormiens nunquam titillandus." Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine |
|
#3
|
||||
|
||||
|
Here is a larger chunk of code showing the above
Code:
local tblObjects = Page.EnumerateObjects() local Object = nil; --if there are objects on the page if tblObjects then for index, CurrentObject in tblObjects do --check for object type, if Page.GetObjectType(CurrentObject) == OBJECT_FLASH then Object = Flash; elseif Page.GetObjectType(CurrentObject) == OBJECT_INPUT then Object = Input; elseif Page.GetObjectType(CurrentObject) == OBJECT_VIDEO then Object = Video; elseif Page.GetObjectType(CurrentObject) == OBJECT_WEB then Object = Web; end if Object then tblPos = Object.GetPos(CurrentObject) tblSize = Object.GetSize(CurrentObject) Object.SetEnabled(CurrentObject, false) Object.SetEnabled(CurrentObject, true) end end end
__________________
TJ-Tigger "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools." "Draco dormiens nunquam titillandus." Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine |
|
#4
|
|||
|
|||
|
tks for the code TJ ..
|
|
#5
|
||||
|
||||
|
I think adam's sample resize project makes use of this technique.
|
|
#6
|
||||
|
||||
|
GREAT TJ. Thanks a bunch for that
Yossi |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP Passing Variables | ianhull | Developer's Den | 4 | 07-06-2005 05:10 AM |
| Variables in message dialogs now broken? | Tek | Setup Factory 7.0 Discussion | 2 | 03-14-2005 03:09 AM |
| Help passing screen variables | swilk | Setup Factory 7.0 Discussion | 2 | 12-06-2004 12:07 PM |
| INFO: Setting Environment Variables | Support | Setup Factory 6.0 Knowledge Base | 0 | 10-10-2002 01:07 PM |
All times are GMT -6. The time now is 04:40 AM.








Since the SetPos actions are the same from one object to another you can determine what type of object you are dealing with, set a variable to be that object type and then execute the SetPos Action.
Linear Mode

