Hello,
is it possible to use a object (eg. Lable for time, lable for battery voltage or button for homescreen,...) on the same possition on multiple screens, or do i have to use separate objects on each screen?
Regards,
Markus
using the same object on multiple screens?
- dejan.odabasic
- mikroElektronika team
- Posts: 2649
- Joined: 30 Apr 2012 14:20
Re: using the same object on multiple screens?
Hello,
Currently it's not possible to define the object with multiple screen membership.
You could try to solve this problem with using multiple layers instead of multiple screens.
With layers, you can have main layer which will be constantly visible and other which you can hide or show according to your needs.
Best regards.
Currently it's not possible to define the object with multiple screen membership.
You could try to solve this problem with using multiple layers instead of multiple screens.
With layers, you can have main layer which will be constantly visible and other which you can hide or show according to your needs.
Best regards.
Re: using the same object on multiple screens?
Is there a way to make all objects in a layer visible/invisible etc. at runtime without doing that for every single object in the layer, in other words a command that applies to the whole layer?
(As I have seen the right click visible check mark only applies at edit time).
Please also see my report of a possible bug with grouping of objects in the TFT beta forum.
It is not clear to me if grouping has any function other than for editing. The changelog has the following remark for ver. 3.7.0: "Grouping of objects on different layers improved." I see some improvement in edit copy between layers, but it is not clear to me if the remark also applies to the grouping concept.
As to the OP's question I have noticed that it is possible to draw a dynamic object on a different screen than it belongs, but it will not invoke events on that screen, and I am not sure this is a healthy way to do things...
(As I have seen the right click visible check mark only applies at edit time).
Please also see my report of a possible bug with grouping of objects in the TFT beta forum.
It is not clear to me if grouping has any function other than for editing. The changelog has the following remark for ver. 3.7.0: "Grouping of objects on different layers improved." I see some improvement in edit copy between layers, but it is not clear to me if the remark also applies to the grouping concept.
As to the OP's question I have noticed that it is possible to draw a dynamic object on a different screen than it belongs, but it will not invoke events on that screen, and I am not sure this is a healthy way to do things...
mikropascal dsPIC, Visual TFT, MMBdsPIC v.105, 1.10_9A, mikroProg, "Big"(P30F6012A)EasydsPIC2
- dejan.odabasic
- mikroElektronika team
- Posts: 2649
- Joined: 30 Apr 2012 14:20
Re: using the same object on multiple screens?
Hello,
You'll need to hide/show every object separately, because layers are not defined in code.
Layers only provides an visual aid for organizing your screen and using layers you can easily see which object should have their Visible property changed.
Best regards.
You'll need to hide/show every object separately, because layers are not defined in code.
Layers only provides an visual aid for organizing your screen and using layers you can easily see which object should have their Visible property changed.
Best regards.
Re: using the same object on multiple screens?
Hi OT,
Grouping of objects allows you to create a virtual single object that you can then easily move around on your screen for changing their placement
without the need to go thru selecting the multiple objects that are related to each other by your designing.
If you need to edit a property of one of the objects in a group, you will have to ungroup them all to do any editing though.
I also agree there needs to be added in future version of V-TFT that there be a way to use objects on multiple screens so memory resources
can be conserved.
Any object used in a project should be only be taking up memory once, not copied every time you want to use the exact same object on a different screen.
A scratch built program by almost any programmer would have been done this way in their usage of repeating graphics in a program,
but V-TFT uses a different approach to organizing everything.
HTH, Robert.
Grouping of objects, like Layers, are only functions of the V-TFT's editing environment and there to assist users with managing objects while editing.It is not clear to me if grouping has any function other than for editing. The changelog has the following remark for ver. 3.7.0: "Grouping of objects on different layers improved." I see some improvement in edit copy between layers, but it is not clear to me if the remark also applies to the grouping concept.
Grouping of objects allows you to create a virtual single object that you can then easily move around on your screen for changing their placement
without the need to go thru selecting the multiple objects that are related to each other by your designing.
If you need to edit a property of one of the objects in a group, you will have to ungroup them all to do any editing though.
I also agree there needs to be added in future version of V-TFT that there be a way to use objects on multiple screens so memory resources
can be conserved.
Any object used in a project should be only be taking up memory once, not copied every time you want to use the exact same object on a different screen.
A scratch built program by almost any programmer would have been done this way in their usage of repeating graphics in a program,
but V-TFT uses a different approach to organizing everything.
HTH, Robert.
HW: easyPIC5|PICFlash2|easyBT|smartGSM|easyGSM|PICPLC16|mmWorkStation|FT800 Eve|PIC Clicker/2|
MMBs:PIC18F,PIC33EP,PIC32|CLICKs:DAC,ADC,GPS L10,Thermo,8x8B LED,Stepper,W/B OLED,9DOF,GPS3,tRF,Hall I|
SW: mP for PIC|mB for PIC-dsPIC-PIC32|Visual-TFT|
MMBs:PIC18F,PIC33EP,PIC32|CLICKs:DAC,ADC,GPS L10,Thermo,8x8B LED,Stepper,W/B OLED,9DOF,GPS3,tRF,Hall I|
SW: mP for PIC|mB for PIC-dsPIC-PIC32|Visual-TFT|
Re: using the same object on multiple screens?
Well, there is a way to reuse existing objects but it has some limitations which could be circumvented with some code. Main problem is to prevent the code from being overwritten by Visual TFT so that means you cannot edit *_driver.c, *_objects.h and *_resources.h files. Every control has "Order" property which, as the name suggests, is used to determine the order in which the controls are drawn on the screen. You can manipulate this property graphically in Visual TFT by right clicking the controls and choosing "Bring to Front" or "Send to Back".
"Bring to front" will set the Order property to n-1, where n is total number of controls on the screen (meaning it will be drawn last). "Send to back" will set the Order property to 0.
Here's an example: Here we have 3 screens. Screen1 has 4 controls: Label1, Button1, Button2 and Button3. Screen2 and Screen3 have 1 control each - Label2 and Label3 respectively. The goal is to reuse buttons from the first screen on Screen2 and Screen3.
If you check the way the controls are drawn, you will see that this is done iteratively (which I don't think is the best solution but I will try to explain this in another topic). That is why the Screen type has properties like: Buttons, ButtonsCount, Labels, LabelsCount, ObjectsCount etc. If you mess around with them without knowing what you are doing, you are probably going to end up in an infinite loop in DrawScreen function of the driver file.
The idea is to make sure that the order of the buttons is the lowest (0, 1 and 2) and to increase the order of other objects on other screens by 3. First, select all three buttons, right-click and choose "Send to Back". Now you have to remap some members of the Screen structure:In your main file just call the above function:And define events as usual:Now you can see and use the buttons on Screen2 and Screen3.
Regards
"Bring to front" will set the Order property to n-1, where n is total number of controls on the screen (meaning it will be drawn last). "Send to back" will set the Order property to 0.
Here's an example: Here we have 3 screens. Screen1 has 4 controls: Label1, Button1, Button2 and Button3. Screen2 and Screen3 have 1 control each - Label2 and Label3 respectively. The goal is to reuse buttons from the first screen on Screen2 and Screen3.
If you check the way the controls are drawn, you will see that this is done iteratively (which I don't think is the best solution but I will try to explain this in another topic). That is why the Screen type has properties like: Buttons, ButtonsCount, Labels, LabelsCount, ObjectsCount etc. If you mess around with them without knowing what you are doing, you are probably going to end up in an infinite loop in DrawScreen function of the driver file.
The idea is to make sure that the order of the buttons is the lowest (0, 1 and 2) and to increase the order of other objects on other screens by 3. First, select all three buttons, right-click and choose "Send to Back". Now you have to remap some members of the Screen structure:
Code: Select all
void Reconfigure_Screens() {
Label2.Order = 3;
Label3.Order = 3;
Screen2.Buttons = Screen1.Buttons;
Screen2.ButtonsCount = 3;
Screen2.ObjectsCount = 4;
Screen3.Buttons = Screen1.Buttons;
Screen3.ButtonsCount = 3;
Screen3.ObjectsCount = 4;
}
Code: Select all
void main() {
Start_TP();
Reconfigure_Screens();
while (1) {
Check_TP();
}
}
Code: Select all
void btnScreen1() {
DrawScreen(&Screen1);
}
void btnScreen2() {
DrawScreen(&Screen2);
}
void btnScreen3() {
DrawScreen(&Screen3);
}
Regards