Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sun Nov 19, 2017 3:31 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Tue May 20, 2014 12:35 pm 
Offline

Joined: Tue Jul 20, 2010 10:40 am
Posts: 15
Hello,

I'm doing redevelopment of the K65 (one of old Qlarity HMI's) application into the G72 one. What am I doing is I parse VTP commands, receive object reference with GetObjRef call and then set property values with SetObjProp call.

But there are such commands as "bD" which should be interpreted and set differently depending on the type of the object it is pointing to. So, the question is how to check if the object received from GetObjRef call has the type of, for example, LabelV2 or ButtonV2?

Thanks in advance,
Alexey.


Top
 Profile  
 
PostPosted: Tue May 20, 2014 10:28 pm 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Alverev,

Can you send me an email or a PM with your email address? Use the buttons under my reply to try one of those options. I would like to talk a little more in depth about what you are trying to accomplish. I may have something that can get you a jump start on your project.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
PostPosted: Wed May 21, 2014 7:02 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Also, to directly answer the question -- if you are writing custom objects, or even deriving from the standard ones then there are some things you could do. For instance, you could create a new template MyButtonV2 that extends ButtonV2 and a template MyLabelV2 that extends LabelV2.

In each of these classes you could add a new property called Data with an appropriate validation function. Your generic VTP parser can then use SetObjProp to set the Data property on any template which supports that property (And throw an exception if the object doesn't have that property).

Code:
'In MyButtonV2
dim Data as string
func Data(newVal as string)
    Value = newVal
    Data := newVal
endfunc

'In the VTP parser
if command == "bD" then
    check error
        SetObjProp(CurrentObject, "Data", subParameter1)
    on error
        LogError("bD not supported on object " + str(CurrentObject))
    enderr
endif


Note that the code sample is a bit loose and would very much have to be adapted to whatever you are doing

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
PostPosted: Wed May 21, 2014 7:12 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
The other approach that you can use is to try and cast the variable to the right data type. This is going to be a bit cumbersome as you don't easily know off hand the right type. But at least the set of choices is fairly small.

Code:
dim btn as ButtonV2
dim lbl as LabelV2
dim name as string

name = str(selectedObject)
check error
    val(btn, name)
    btn.Value = parm1
    return
on error
    _ClearException()
enderr

check error
    val(lbl, name)
    lbl.Value = parm1
    return
on error
    _ClearException()
enderr

LogError(name + " is not of a supported type")


_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
PostPosted: Sat Aug 16, 2014 6:53 pm 
Offline

Joined: Sat Aug 16, 2014 6:47 pm
Posts: 2
I am curious if you have had much luck with this. I am attempting to do the same thing.


Top
 Profile  
 
PostPosted: Tue Aug 19, 2014 11:52 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
kpilquist

Which are you trying to do? Casting objects of different types or emulating the K65 on a G72?

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
PostPosted: Wed Aug 27, 2014 11:43 am 
Offline

Joined: Sat Aug 16, 2014 6:47 pm
Posts: 2
I am trying to emulate k65 on a g70. I have been playing around with parsing the VTP, but my programming skills aren't up to that level yet.


Top
 Profile  
 
PostPosted: Wed Aug 27, 2014 11:58 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Send me an email or a PM and I will get you more information

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group