Jump to content

GUI rendering issue after a while of use


Recommended Posts

Func __main()
    ;========== FUNCTION START
    Global $iMAIN_BUTTON_TRIGGER = -1
    Local $hWIN
    Local $oCLOSE
    Local $oMINIMIZE
    Local $iWIDTH = 1000
    Local $iHEIGHT = 600
    Local $aMAIN_BUTTON[18]
    Local $hRGN
    Local $cBORDER = 0x2C4EB6
    Local $eMSG
    ;==========
    $hWIN = GUICreate('Unitt - v1.3.8', $iWIDTH, $iHEIGHT, -1, -1, BitOR($WS_POPUP,$WS_SYSMENU,$WS_MINIMIZEBOX))
    GUISetFont(8, 400, 0, 'Tahoma', $hWIN)
    GUISetBkColor(0xD4E7FE, $hWIN)
    $oCLOSE = GUICtrlCreateGraphic(985, 6, 9, 9)
    _GUICtrl_SetOnHover(-1, '__main_close_over', '__main_close_out')
    $oMINIMIZE = GUICtrlCreateGraphic(970, 6, 9, 9)
    _GUICtrl_SetOnHover(-1, '__main_minimize_over', '__main_minimize_out')
    GUICtrlCreateLabel('  Universal ticket tool', 0, 0, $iWIDTH, 20, BitOR($SS_LEFT,$SS_CENTERIMAGE), $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, $cBORDER)
    GUICtrlCreatePic('', 985, 6, 9, 9)
    _ResourceSetImageToCtrl(-1, 'EXIT_1')
    GUICtrlCreatePic('', 970, 6, 9, 9)
    _ResourceSetImageToCtrl(-1, 'MINIMIZE_1')
    GUICtrlCreateGraphic(0, 0, 1, $iHEIGHT)
    GUICtrlSetColor(-1, $cBORDER)
    GUICtrlCreateGraphic($iWIDTH - 1, 0, 1, $iHEIGHT)
    GUICtrlSetColor(-1, $cBORDER)
    GUICtrlCreateGraphic(0, $iHEIGHT - 1, $iWIDTH, 1)
    GUICtrlSetColor(-1, $cBORDER)
    ;==========
    $aMAIN_BUTTON[1] = __main_button(10, 30, 'Nieuw ticket')
    $aMAIN_BUTTON[2] = __main_button(10, 60, 'Monteur inplannen')
    $aMAIN_BUTTON[3] = __main_button(10, 90, 'Klantafspraken')
    $aMAIN_BUTTON[4] = __main_button_disabled(10, 120, 'Ticket sluiten')
    $aMAIN_BUTTON[5] = __main_button_disabled(10, 150, 'Quick tools')
    $aMAIN_BUTTON[6] = __main_button_disabled(10, 180, 'Technische analyse')
    $aMAIN_BUTTON[7] = __main_button_disabled(10, 210, 'Administratieve analyse')
    $aMAIN_BUTTON[8] = __main_button(10, 240, 'Processleider')
    $aMAIN_BUTTON[9] = __main_button(10, 270, 'Mailchecker')
    $aMAIN_BUTTON[10] = __main_button_disabled(10, 300, 'Snelheid wijzigen')
    $aMAIN_BUTTON[11] = __main_button_disabled(10, 330, 'Customer selfcare')
;~  $aMAIN_BUTTON[12] = __main_button_disabled(10, 360, '12')
;~  $aMAIN_BUTTON[13] = __main_button_disabled(10, 390, '13')
;~  $aMAIN_BUTTON[14] = __main_button_disabled(10, 420, '14')
    $aMAIN_BUTTON[17] = __create_line(9, 450, 128)
    $aMAIN_BUTTON[15] = __main_button(10, 460, 'Instellingen')
    $aMAIN_BUTTON[16] = __main_button(10, 490, 'Informatie')
    ;==========
    GUICtrlCreatePic('', 1, 20, 150, 579, BitOR($WS_CLIPSIBLINGS,$WS_DISABLED))
    _ResourceSetImageToCtrl(-1, 'SIDE')
    GUICtrlCreateGraphic(151, 20, 1, 579)
    GUICtrlSetColor(-1, $cBORDER)
    GUICtrlCreateGraphic(152, 20, 1, 579)
    GUICtrlSetColor(-1, 0x86bbfc)
    GUICtrlCreateLabel('versie 1.3.8 ontworpen door NULL', 439, 558, 274, 34, BitOR($SS_CENTER,$SS_CENTERIMAGE))
    GUICtrlSetColor(-1, 0xa3a4a4)
    $hRGN = _WinAPI_CreateRoundRectRgn(0, 0, 1001, 601, 2, 1)
    _WinAPI_SetWindowRgn($hWIN, $hRGN)
    ;==========
    GUISetState()
    ;==========
    While 1
        $eMSG = GUIGetMsg()
        Select
            Case $eMSG = $GUI_EVENT_CLOSE Or $eMSG = $oCLOSE
                Exit
            Case $eMSG = $oMINIMIZE
                GUISetState(@SW_MINIMIZE, $hWIN)
            Case $eMSG = $aMAIN_BUTTON[1] Or $iMAIN_BUTTON_TRIGGER = 1
                __panel_nieuw_ticket_1($hWIN, $oCLOSE, $oMINIMIZE, $aMAIN_BUTTON)
            Case $eMSG = $aMAIN_BUTTON[2] Or $iMAIN_BUTTON_TRIGGER = 2
                __panel_monteur_inplannen_1($hWIN, $oCLOSE, $oMINIMIZE, $aMAIN_BUTTON)
            Case $eMSG = $aMAIN_BUTTON[3] Or $iMAIN_BUTTON_TRIGGER = 3
                __panel_klantafspraken_1($hWIN, $oCLOSE, $oMINIMIZE, $aMAIN_BUTTON)
            Case $eMSG = $aMAIN_BUTTON[8] Or $iMAIN_BUTTON_TRIGGER = 8
                __panel_processleider_1($hWIN, $oCLOSE, $oMINIMIZE, $aMAIN_BUTTON)
            Case $eMSG = $aMAIN_BUTTON[9] Or $iMAIN_BUTTON_TRIGGER = 9
                __panel_mailchecker_1($hWIN, $oCLOSE, $oMINIMIZE, $aMAIN_BUTTON)
            Case $eMSG = $aMAIN_BUTTON[15] Or $iMAIN_BUTTON_TRIGGER = 15
                __panel_instellingen_1($hWIN, $oCLOSE, $oMINIMIZE, $aMAIN_BUTTON)
            Case $eMSG = $aMAIN_BUTTON[16] Or $iMAIN_BUTTON_TRIGGER = 16
                __panel_informatie_1($hWIN, $oCLOSE, $oMINIMIZE, $aMAIN_BUTTON)
        EndSelect
        __panel_start_1($hWIN, $oCLOSE, $oMINIMIZE, $aMAIN_BUTTON)
    WEnd
    ;========== FUNCTION END
    SetError(0, 0, 1)
EndFunc

This is how it looks, and works fine for a most of the time.

0rm8vs77a7znn79xsn9n_thumb.jpg

But sometimes it will happen that after accessing the program after a while of using (like alt-tabbing or focusing the window) it goes haywire!

And its even affecting other programs and windows.

It looks like this, as you can see controls and kinda disappeared and the way to solve this problem is to close the program and reopen it again.

23idgqa4jubqf7g4djp5_thumb.jpg

If anyone has simmulair problems and know of any solutions please respond.

Edited by Dreamfire
Link to comment
Share on other sites

Func __panel_start_1($hWIN, $oCLOSE, $oMINIMIZE, $aMAIN_BUTTON)
    ;========== FUNCTION START
    Dim $iMAIN_BUTTON_TRIGGER
    Local $aHEADER
    Local $aCONTROL_1
    Local $eMSG
    ;==========
    If $iMAIN_BUTTON_TRIGGER <> -1 Then Return 0
    $aHEADER = __create_header('Storingen en mededelingen')
    ;==========
    $aCONTROL_1 = __control_start_1()
    ;==========
    __ladida_get($aCONTROL_1)
    __mededelingen_get($aCONTROL_1)
;~  __aantal_tickets($aCONTROL_1, $hWIN)
    ;==========
    While 1
        $eMSG = GUIGetMsg()
        Select
            ;========== MAIN
            Case $eMSG = $GUI_EVENT_CLOSE Or $eMSG = $oCLOSE
                Exit
            Case $eMSG = $oMINIMIZE
                GUISetState(@SW_MINIMIZE, $hWIN)
            Case $iMAIN_BUTTON_TRIGGER <> -1
                ExitLoop
            ;========== TRIGGER
            Case $eMSG = $aMAIN_BUTTON[1]
                $iMAIN_BUTTON_TRIGGER = 1
            Case $eMSG = $aMAIN_BUTTON[2]
                $iMAIN_BUTTON_TRIGGER = 2
            Case $eMSG = $aMAIN_BUTTON[3]
                $iMAIN_BUTTON_TRIGGER = 3
            Case $eMSG = $aMAIN_BUTTON[8]
                $iMAIN_BUTTON_TRIGGER = 8
            Case $eMSG = $aMAIN_BUTTON[9]
                $iMAIN_BUTTON_TRIGGER = 9
            Case $eMSG = $aMAIN_BUTTON[15]
                $iMAIN_BUTTON_TRIGGER = 15
            Case $eMSG = $aMAIN_BUTTON[16]
                $iMAIN_BUTTON_TRIGGER = 16
            ;========== PANEL
            Case $eMSG = $aCONTROL_1[1]
                If _GUICtrlListView_GetSelectionMark(GUICtrlGetHandle($aCONTROL_1[0])) <> -1 Then _IECreate('http://ladida.agora.kpn.org/Incident/IncidentOverzicht.aspx?iid=' & _GUICtrlListView_GetItemText(GUICtrlGetHandle($aCONTROL_1[0]), _GUICtrlListView_GetSelectionMark(GUICtrlGetHandle($aCONTROL_1[0])), 7), 0, 4, 0, 1)
            Case $eMSG = $aCONTROL_1[5]
                If GUICtrlRead($aCONTROL_1[4]) <> '' Then __mededelingen_add($aCONTROL_1)
            Case $eMSG = $aCONTROL_1[6]
                If _GUICtrlListView_GetSelectionMark(GUICtrlGetHandle($aCONTROL_1[3])) <> -1 Then __mededelingen_remove($aCONTROL_1, _GUICtrlListView_GetItemText(GUICtrlGetHandle($aCONTROL_1[3]), _GUICtrlListView_GetSelectionMark(GUICtrlGetHandle($aCONTROL_1[3])), 3))
            Case $eMSG = $aCONTROL_1[7]
                __mededelingen_get($aCONTROL_1)
        EndSelect
    WEnd
    ;==========
    __control_delete_array($aHEADER)
    __control_delete_array($aCONTROL_1)
    __check_version($iVERSION, $hWIN)
    ;========== FUNCTION END
EndFunc

#cs ---------------------------------------------------------------------------
===============================================================================
CONTROLS
===============================================================================
#ce ---------------------------------------------------------------------------

Func __control_start_1($iHIDE = 0)
    ;========== FUNCTION START
    Local $aCONTROL[50]
    ;==========
    $aCONTROL[0] = __create_listview(160, 60, 'netwerk|omschrijving|actie door|melder|starttijd|verwachte eindtijd|eindtijd|id', '', 826, 150)
    _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($aCONTROL[0]), 0, 70)
    _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($aCONTROL[0]), 1, 230)
    _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($aCONTROL[0]), 2, 100)
    _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($aCONTROL[0]), 3, 70)
    _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($aCONTROL[0]), 4, 70)
    _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($aCONTROL[0]), 5, 110)
    _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($aCONTROL[0]), 6, 70)
    _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($aCONTROL[0]), 7, 40)
    $aCONTROL[1] = __create_button(160, 220, 'storing details')
    $aCONTROL[2] = __create_line(160, 250)
    ;==========
    $aCONTROL[3] = __create_listview(160, 260, 'melder|mededeling|log tijd|id', '', 826, 100)
    _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($aCONTROL[3]), 0, 70)
    _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($aCONTROL[3]), 1, 590)
    _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($aCONTROL[3]), 2, 110)
    _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($aCONTROL[3]), 3, 40)
    $aCONTROL[4] = __create_input(160, 370, '', 'hier kun je text invullen voor een mededeling', 430)
    $aCONTROL[5] = __create_button(600, 370, 'toevoegen')
    $aCONTROL[6] = __create_button(730, 370, 'verwijderen')
    $aCONTROL[7] = __create_button(860, 370, 'refresh')
    $aCONTROL[8] = __create_line(160, 400)
;~  $aCONTROL[9] = __create_label(160, 410, 'aantal tickets')
;~  GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
;~  $aCONTROL[10] = __create_label_left(290, 410)
;~  GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma')
    ;==========
    If $iHIDE = 1 Then __control_hide_array($aCONTROL)
    ;========== FUNCTION END
    Return $aCONTROL
EndFunc

This is the panel start function, its the main panel thats being drawn at startup, it in itself has a loop.

I sadly cannot show you all the functions because of work related information.

The program has multiple functions that are used by employees for creating/editing incident tickets and does various tasks to make things easier.

Edited by Dreamfire
Link to comment
Share on other sites

It has more signs of a memory/graphic bug, that might be caused by to much _controlsetstate functions being executed when a user switches panel or triggers an actions.

I am unable to pin-point the exact location in the multiple loops that might cause the problem, bear in mind that there are right now 8 panels that in itself has its own loop with triggers to functions and control states.

Link to comment
Share on other sites

At least he succeeded in bumping the topic.

I think you are right about it being something graphic related, but it's very hard for me to locate it as the only way to run your code is by removing all the references to functions that don't exist and I havn't been able to reproduce the error that way.

I have two suggestions:

1: Create a version without any skinning and see if that's more stable. Then add the graphic stuf back in slowly and see when the problem reappears.

2: Create a dummy version with just the graphical part of all the functions, try to reproduce the error on that and post it here if you succeed.

I understand it might be allot of work, but currently I doubt you'll get your answer.

Link to comment
Share on other sites

do not pay attention to this post, this actually a college of my who was trying to be funny, he did not succeed ;)

I suggest you inform your colleague that if he continues these sort of posts on the forum he (and you by proxy) are no longer going to have access to this forum.
Link to comment
Share on other sites

OK, I think I know the issue. I hate to say this, but Juvigy is correct in guessing the issue is bad programming practices. One thing that leaped out at me is your function you call in the main loop - it has it's own GUI controls that you are creating again and again each time you loop. That is bad coding. If anything look at some of the suggestions that may help you:

  • Create a GUI ONCE and then hide it until it is needed
  • OR - Only make a GUI when you need it and use GUIDelete when you are done with it.
  • Use DIM to declare your variables at the beginning of your script.
  • Use one loop to control all your GUI screens. You can use a sub loop to control a child GUI, but have an exitloop to move back to the parent loop.
  • Learn to use an array when creating controls. I say this for in the first script you posted, you did this:

    $aMAIN_BUTTON[1] = __main_button(10, 30, 'Nieuw ticket')
        $aMAIN_BUTTON[2] = __main_button(10, 60, 'Monteur inplannen')
        $aMAIN_BUTTON[3] = __main_button(10, 90, 'Klantafspraken')
        $aMAIN_BUTTON[4] = __main_button_disabled(10, 120, 'Ticket sluiten')
        $aMAIN_BUTTON[5] = __main_button_disabled(10, 150, 'Quick tools')
        $aMAIN_BUTTON[6] = __main_button_disabled(10, 180, 'Technische analyse')
        $aMAIN_BUTTON[7] = __main_button_disabled(10, 210, 'Administratieve analyse')
        $aMAIN_BUTTON[8] = __main_button(10, 240, 'Processleider')
        $aMAIN_BUTTON[9] = __main_button(10, 270, 'Mailchecker')
        $aMAIN_BUTTON[10] = __main_button_disabled(10, 300, 'Snelheid wijzigen')
        $aMAIN_BUTTON[11] = __main_button_disabled(10, 330, 'Customer selfcare')
    ;~  $aMAIN_BUTTON[12] = __main_button_disabled(10, 360, '12')
    ;~  $aMAIN_BUTTON[13] = __main_button_disabled(10, 390, '13')
    ;~  $aMAIN_BUTTON[14] = __main_button_disabled(10, 420, '14')
        $aMAIN_BUTTON[17] = __create_line(9, 450, 128)
        $aMAIN_BUTTON[15] = __main_button(10, 460, 'Instellingen')
        $aMAIN_BUTTON[16] = __main_button(10, 490, 'Informatie')

    That can easily be put into an array.

Without seeing the entire script, I can't help you much more than I already have. If you wish to PM me, I would be glad to help you more privately.

Edited by MPH
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...