[SOLVED] Contents within PanelGadget appear slowly and untidily before panel is drawn around them
Posted: Mon Nov 18, 2024 10:17 am
I'm not sure if my sequence of defining the gadgets is the cause here. As the application commences, the text gadgets within the panel (tab 1) towards the centre-right of the window, are drawn first, then eventually the panel is drawn after all other gadgets are completed. It is not until all other screen gadgets are finished, that the panel then finally appears and tidies up the results. During that delay, the text looks untidy because of its missing background. This effect can be seen in the below example, captured during the drawing process. The calc fields have a white block around them, in anticipation of the white panel still waiting to be drawn.
In the genuine application, from which this test code has been extracted, there are a greater number of screen gadgets and graphics and consequently the delay is so significant that it will make users think there is something wrong with it. Is there a way to improve or resolve this?

In the genuine application, from which this test code has been extracted, there are a greater number of screen gadgets and graphics and consequently the delay is so significant that it will make users think there is something wrong with it. Is there a way to improve or resolve this?

Code: Select all
window1 = OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, 1266, 780, "", #PB_Window_MinimizeGadget | #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
; **
; ** Define text labels
; **
TextGadget(#PB_Any, 30, 75, 160, 25, "Input")
TextGadget(#PB_Any, 30, 106, 160, 25, "Input")
TextGadget(#PB_Any, 30, 137, 160, 25, "Input")
TextGadget(#PB_Any, 30, 168, 160, 25, "Input")
TextGadget(#PB_Any, 30, 199, 30, 25, "Input")
TextGadget(#PB_Any, 330, 421, 110, 25, "Calc")
TextGadget(#PB_Any, 30, 465, 60, 25, "X 1")
TextGadget(#PB_Any, 30, 496, 60, 25, "X 2")
TextGadget(#PB_Any, 30, 527, 60, 25, "X 3")
TextGadget(#PB_Any, 30, 558, 60, 25, "X 4")
TextGadget(#PB_Any, 30, 589, 60, 25, "X 5")
TextGadget(#PB_Any, 30, 620, 60, 25, "X 6")
TextGadget(#PB_Any, 330, 465, 120, 25, "Calc")
TextGadget(#PB_Any, 330, 496, 120, 25, "Calc")
TextGadget(#PB_Any, 330, 527, 120, 25, "Calc")
TextGadget(#PB_Any, 330, 558, 120, 25, "Calc")
TextGadget(#PB_Any, 330, 589, 120, 25, "Calc")
TextGadget(#PB_Any, 330, 620, 120, 25, "Calc")
; **
; ** Define input fields
; **
StringGadget(#PB_Any, 220, 70, 140, 25, "")
StringGadget(#PB_Any, 220, 101, 120, 25, "")
StringGadget(#PB_Any, 220, 132, 180, 25, "")
ComboBoxGadget(#PB_Any, 220, 163, 130, 25)
ComboBoxGadget(#PB_Any, 220, 194, 180, 25)
StringGadget(#PB_Any, 490, 460, 110, 25, "")
StringGadget(#PB_Any, 490, 491, 110, 25, "")
StringGadget(#PB_Any, 490, 522, 110, 25, "")
StringGadget(#PB_Any, 490, 553, 110, 25, "")
StringGadget(#PB_Any, 490, 584, 110, 25, "")
ComboBoxGadget(#PB_Any, 560, 615, 40, 25)
StringGadget(#PB_Any, 30, 250, 440, 25, "")
StringGadget(#PB_Any, 30, 281, 440, 25, "")
StringGadget(#PB_Any, 30, 312, 440, 25, "")
StringGadget(#PB_Any, 30, 343, 440, 25, "")
StringGadget(#PB_Any, 30, 374, 440, 25, "")
StringGadget(#PB_Any, 490, 416, 110, 25, "")
StringGadget(#PB_Any, 100, 460, 60, 25, "")
StringGadget(#PB_Any, 100, 491, 60, 25, "")
StringGadget(#PB_Any, 100, 522, 60, 25, "")
StringGadget(#PB_Any, 100, 553, 60, 25, "")
StringGadget(#PB_Any, 100, 584, 60, 25, "")
StringGadget(#PB_Any, 100, 615, 60, 25, "")
; **
; ** Set up right-side panel area
; **
Pg = PanelGadget(#PB_Any, 660, 70, 515, 630)
AddGadgetItem(Pg, -1, "Tab 1")
; **
; ** Define text labels
; **
TextGadget(#PB_Any, 30, 40, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 71, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 102, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 133, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 195, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 226, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 257, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 288, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 319, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 350, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 412, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 443, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 474, 100, 25, "Calc")
TextGadget(#PB_Any, 30, 505, 100, 25, "Calc")
; **
; ** Define input fields
; **
StringGadget(#PB_Any, 245, 35, 100, 25, "")
StringGadget(#PB_Any, 175, 97, 30, 25, "")
StringGadget(#PB_Any, 175, 314, 30, 25, "")
StringGadget(#PB_Any, 245, 407, 100, 25, "")
StringGadget(#PB_Any, 175, 438, 30, 25, "")
StringGadget(#PB_Any, 245, 66, 100, 25, "")
StringGadget(#PB_Any, 245, 97, 100, 25, "")
StringGadget(#PB_Any, 245, 128, 100, 25, "")
StringGadget(#PB_Any, 245, 190, 100, 25, "")
StringGadget(#PB_Any, 245, 221, 100, 25, "")
StringGadget(#PB_Any, 245, 252, 100, 25, "")
StringGadget(#PB_Any, 245, 283, 100, 25, "")
StringGadget(#PB_Any, 245, 314, 100, 25, "")
StringGadget(#PB_Any, 245, 345, 100, 25, "")
StringGadget(#PB_Any, 245, 438, 100, 25, "")
StringGadget(#PB_Any, 245, 469, 100, 25, "")
StringGadget(#PB_Any, 245, 500, 100, 25, "")
; **
; ** Tab 2
; **
AddGadgetItem(Pg, -1, "Tab 2")
; **
; ** Define text labels
; **
TextGadget(#PB_Any, 30, 40, 145, 25, "Input")
; **
; ** Define input fields
; **
EditorGadget(#PB_Any, 30, 65, 445, 200, #PB_Editor_WordWrap)
CheckBoxGadget(#PB_Any, 30, 286, 250, 25, "Display")
CheckBoxGadget(#PB_Any, 30, 317, 250, 25, "Display")
CheckBoxGadget(#PB_Any, 30, 348, 250, 25, "Display")
CheckBoxGadget(#PB_Any, 30, 379, 250, 25, "Display")
CheckBoxGadget(#PB_Any, 30, 410, 250, 25, "Display")
; **
; ** Tab 3
; **
AddGadgetItem(Pg, -1, "Tab 3")
; **
; ** Define text labels
; **
TextGadget(#PB_Any, 30, 40, 160, 25, "Input 1")
TextGadget(#PB_Any, 30, 71, 160, 25, "Input 2")
TextGadget(#PB_Any, 30, 101, 160, 25, "Input 3")
TextGadget(#PB_Any, 30, 132, 160, 25, "Input 4")
TextGadget(#PB_Any, 30, 163, 160, 25, "Input 4")
; **
; ** Define input fields
; **
ComboBoxGadget(#PB_Any, 175, 35, 300, 25)
StringGadget(#PB_Any, 175, 66, 300, 25, "")
StringGadget(#PB_Any, 175, 97, 300, 25, "")
StringGadget(#PB_Any, 175, 128, 60, 25, "")
StringGadget(#PB_Any, 175, 159, 60, 25, "")
CloseGadgetList()
; **
; ** Main programme
; **
Repeat
event = WaitWindowEvent()
Select event
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
End