Using widget databases question

!Hello QNX masters!

I hope you’re doing great. This is my first post (I hope nobody gets bother). :laughing:

Here it’s the thing. I’m kind of newbie with photon programming. I’m developing photon applications using custom widgets (so far everything works great). However our apps are used as UI and the core is being develop for other team. we have had a really bad time, when we got finished a set of photon screens and the core team asks for change properties in the custom widgets. Thats why I’m trying to write a photon application which allow us to change properties of current screens and save those changes. I’ve been working with widget databases, experimenting it’s functionality but sadly I’m stuck, I haven’t been able to modify ApDBWidgetInfo_t. My question is. Is that possible to create a widget Database at runtime?. I mean. I want to open a given base.wgtw with ApOpenDDaseFile copy the widgets, modify its properties and stores in other widget database.

I hope I have explained well :blush:

Thank you for your time.

BR

I think the answer is yes, but it really feels like you are doing this the hard way.
Why not create your own database of widget properties, and at run time you can apply them.

maschoen
thanks for answer. :smiley:

Ups… I thought by copying widget Databases was the only way it could be done.:open_mouth: Please let me give you more details about my case.

I have read about the advantages that Widget Databases. I understand that we can add a lot of widgets (same kind or not) in runtime to our applications. I also understand that if I create the logic for creating and loading the widgets. When the core team asks for a change, I just have to apply the change on my widget database and the application will have the changes with the minimal effort. :smiley: (Is that what you mean? ).

if that is:
I thought that way earlier, but it doesn’t fit with our needs. The thing its. Our custom widgets have properties, which should be different among them, especially one we call “read tag” we use that property for accessing share memory than the core team writes. And the annoying thing it’s to change this field on each widget one by one (and the time we spend on it). So I was thinking on develop a photon application witch allow me to open a “base.wgtw” file, make queries of all its widgets and properties and displays it in table (rows and columns). change properties and save the base.wgtw file for replace the old one.

I really appreciate the time you took for reading this post, I’m just trying to make my job easier and quicker. If you think that I did not understand your point please let me know, that happens so frequently

Thanks for your time.
BR.

You can do that. You could just do that with PhAB. That would be the obvious and easy way.
You could also update the widgets in your application at runtime. Since you want the application to be flexible, I was suggesting you might create a separate database that would indicate what properties to apply to what widgets at startup. That might not work if you are building your own widgets whose list of properties itself might change.

As you probably have seen, the widget files including a widget database are mostly just text files. You could probably update these directly if that would help.

Now that I’ve heard about the custom widget that reads shared memory, I have to repeat my comment that, this doesn’t feel like the way to do things.

Widgets are a programming abstraction that makes it convenient to build a graphical user interface. This removes from the programmer the requirement to graphically paint a widget, and deal with all the possible Photon events.
Writing a Photon Application without widgets would be tedious but possible. Some Widgets such as the Timer widget don’t fit this description and have nothing to do with the screen. QNX provides this widget and I sometimes use it as a convenience, but if it weren’t there, I would not write it myself as a widget. I’d write it as piece of code with a fixed interface.

I’m in the dark here about your application and why you are doing it this way, so there may be a good logical reason.

Getting back to your question, I think you could develop a photon application that allows you to open widget files and change them. There already is an application that does this, PhAB. There may be features it doesn’t have that you want, and in that case, I see nothing wrong with building your own “editor”.

As Mitchell has said, PHAB is not the only way to go. In our application we don’t use PHAB at all. We think it sucks (at least the QNX4 version). We wrote our own PHAB type editor and create the widgets dynamically at run time from the text files created by our editor. This way we have complete control on what data the widgets contain and have extensions that PHAB doesn’t provide.

There is a whole chapter in the Photon Programming Guide on writing an app without PHAB, take a look at it. It may be what you need to do too.

maschoen: Thanks a lot for your advice. I’m agree with you about How things should be, sadly I’m just user Interfaces developer and I got in to the project as it is, I would like give you more information about the core and why the things are like they are but sometimes is hard to me understand it. Again, I appreciate your comments and I will try to write my editor :smiley:. (At least the functionality I need) for have a little fun. Thanks.

ianc: Thank you for the reference, I have seen the chapter title but I didn’t put attention, because I’m working with PHAB jeje. Is good to know that there is other developers with the same feelings for PhAb :stuck_out_tongue: (and is 6, I have heard that 4 is a really nightmare).

Thanks a lot Guys Its a great Forum.

BR.