I just want to make sure my understanding is right on templates.
Say, I have a template with top bar (header) and body.
Now I insert a template (So.. I go to Insert -> template -> top_bar)
The template contains a window which is the body.
I have data updating in real time that is updated in the top bar using the calls gx_prompt_text_set(&top_bar.top_bar_prompt_1, result_buffer);
It seems like the above call does not update the text, but (referencing &window_1.base.top_bar_prompt_1) gx_prompt_text_set(&window_1.base.top_bar_prompt_1, result_buffer); works fine and updates the top bar prompts, but the problem is that if I create another screen say window_2 that requires the same top bar and I need to show the same data, then I will have to do gx_prompt_text_set(&window_2.base.top_bar_prompt_1, result_buffer); which seems like for every window that uses that template I will have to update the top bar icons manually in each of their event handlers.
To overcome this repeated manual update of top bar elements in each window handlers, I deleted the template and now have a top bar window, body window as two different fragments in screen which works perfect with just referencing the top bar elements as for e.g. &top_bar.top_bar_prompt_1
Is there a similar way to achieve this functionality of using template with just one place to reference the top bar elements and not inside all window handlers?
My understanding is that GUIX Templates are just place holders for icons, prompts, text boxes but not one place reference for all windows that inherit that template.
I might be completely wrong on this, So any clarification/inputs on this is much appreciated.
I have created a simple project with a template window defined and run some tests. I agree with you - the solution is to create two separate windows: the top bar and the body, without using a template.
In my opinion the template functionality is supposed to be used to design elements in the GUIX Studio, which are going to be added to the project multiple times and which should have the same look. Think about a template same as about any predefined GUIX Studio widget, such as: "Text Button", "Prompt", "Circular Gauge" etc. When you add one to the project, it becomes an individual instance (derived instance of the template).
A big advantage of templates is that you can change (in GUIX Studio) the properties of all these instances at once - by changing the properties of the template only. Please refer to the GUIX Studio documentation for the details:GUIX Studio User Guide > Chapter 5 GUIX Studio Screen Designer > Using templates
You may also find useful the following forum threads:
I tried to use a similar reference as you did ("top_bar.top_bar_prompt_1"), however I get the "undefined reference to `top_bar'" error message during the compilation. Do you also experience such error message? Which SSP version do you use?
In reply to anper:
In reply to Sam:
thank you for your feedback.
I used SSP 1.3.3 and GUIX Studio 184.108.40.206 with GUIX library 5.4.0 to create my project.
After a short investigation I established that the <project_name>_specifications.c file generated by newer GUIX Studio versions (220.127.116.11+) does not include the template window control block definition. Whereas in case of older GUIX Studio versions (18.104.22.168-) this file does include such definition. This is why you were able to refer to the template window structure, while I was getting an error message.
In reply to Imanol: