Beijer Electronics (formerly QSI Corporation)

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

All times are UTC - 7 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Screens inheritance
PostPosted: Tue Jul 20, 2010 10:55 am 
Offline

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

I am still learning QLarity, came to that language after using of other programming languages like Delphi, C++, C.Net. In all these languages I can create a screen or a (custom) form and then create new one inheriting the interface elements and functionality. Is it possible to do the same here?

Regards,
Alexey.


Top
 Profile  
 
 Post subject: Re: Screens inheritance
PostPosted: Tue Jul 20, 2010 10:59 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Probably not the way you mean.

It is possible to inherit a new object based on the screen object and inherit its properties/methods/behavior. However you do not inherit the children, which is what I suspect you want to do. (e.g. have 5 screens that all have the same layout, including the children).

Can you elaborate a bit more on what you are trying to accomplish and perhaps we can give you some ideas as to the best direction to take.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
 Post subject: Re: Screens inheritance
PostPosted: Tue Jul 20, 2010 11:11 am 
Offline

Joined: Tue Jul 20, 2010 10:40 am
Posts: 15
Jeremy, thanks for a quick reply!

In fact, you answerred to my question. I am creating an application with three completely identical screens differing just with event code, the layout is the same. Screens are quite complex so I wanted to build a custom screen with all elements and with common code and then just to inherit from that screen to add event handlers for buttons and code specific for every screen.

So, as you say it is impossible to create a template with children elements, I have a different approach. I plan to create one screen, add a flag specifying which form is opened, then in screenEnabled() event handler I will change labels according to the flag (if-then-elseif...), and in buttons click event handlers I'll add same code to execute needed set of instructions.

Or, maybe, there is a better approach?


Top
 Profile  
 
 Post subject: Re: Screens inheritance
PostPosted: Tue Jul 20, 2010 11:17 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
It is fairly rare that I am in your situation. However, I have been there on occasion. There are two main approaches that I have taken.

One is the approach that you describe (use a single screen to do all the lifting, with some conditional code to handle the differences). This approach works fine.

Another approach, which may or may not be more appropriate (depending on your workspace) would be the following:

Create one screen with all the common stuff on it (like you already have). Now you can create a transparent screen that sits over the top of the first screen. Put objects whose behavior will be different based on context in the transparent sub screens. By using multiple transparent overlay screens and changing which one(s) are enabled, you can vary the screens behavior.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
 Post subject: Re: Screens inheritance
PostPosted: Tue Jul 20, 2010 11:34 am 
Offline

Joined: Tue Jul 20, 2010 10:40 am
Posts: 15
Well... I didn't think about such a trick. So, thank you for the idea and for all your help!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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