Jump to content

Recommended Posts

Posted

Hi,

I still get crazy with this code:

#include <GUIConstants.au3>

; Mainform
$MainFormHandle = GUICreate("Test", 320, 250, -1, -1, -1, $WS_EX_TOPMOST)
$tab=GUICtrlCreateTab (10,10, 300, 230)
    $tab1=GUICtrlCreateTabitem ( "Historie")
        $ExportButton =         GUICtrlCreateButton("", 247, 180, 42, 42, $BS_ICON)
                                GUICtrlSetImage($ExportButton, "export.ico")
                                GUICtrlSetTip($ExportButton,"exportieren...")
GUICtrlCreateTabitem ("")  ; end tabitem definition


; Export-Listview
$ExportFormHandle = GUICreate("Auswertung",400,250,-1,-1,-1,$WS_EX_ACCEPTFILES)
    $listview =             GUICtrlCreateListView ("Datum      |beginn|ende  |differenz  ",10,35,330,195);,$LVS_REPORT)
                            GUISetFont (7)   ; smaller Text


; Hauptprozedur
GUICtrlCreateListViewItem ("Testitem1|with|multi|columns", $listView)
GUISetState (@SW_SHOW, $MainFormHandle)
GUICtrlCreateListViewItem ("Testitem2|with|multi|columns", $listView)
While 1
    $msg = GUIGetMsg()
   ; ========================================
   ; ========================================   
    If $msg = $ExportButton Then Export()  
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop   
Wend
Exit


Func Export()
    GUICtrlCreateListViewItem ("Testitem3|with|multi|columns", $listView)
    GUISetState (@SW_HIDE, $MainFormHandle)
    GUISetState (@SW_SHOW, $ExportFormHandle)
    While 1
        $msgExport = GUIGetMsg()
    ; ========================================
    ; ========================================   
        If $msgExport = $GUI_EVENT_CLOSE Then ExitLoop   
    Wend
    GUISetState (@SW_HIDE, $ExportFormHandle)
    GUISetState (@SW_SHOW, $MainFormHandle)
    GUICtrlCreateListViewItem ("Testitem4|with|multi|columns", $listView)
EndFunc

As you can see:

  • Two forms (Mainform and Listview-Form)
  • Mainform with button (calls the export-function), Listview-form with ...guess...listview ;)
  • Four lines on different positions in the code where I try to create a ListviewItem
  • Only one (the first) is shown up in the listview
I suppose that the problem is somewhere around "The order of creating and showing different GUIItems", but I did not find any hints to maintain a special order. All searching in this forum and the helpfile did not get me the answer for this crazy behaviour. :lmao:

Do YOU have it?

UTA

(btw: do not wonder about the style of the code, I deleted everything not necessary to point to the problem)

Posted

you were missing a GUISetState()

#include <GUIConstants.au3>

; Mainform
$MainFormHandle = GUICreate("Test", 320, 250, -1, -1, -1, $WS_EX_TOPMOST)
$tab = GUICtrlCreateTab(10, 10, 300, 230)
$tab1 = GUICtrlCreateTabItem("Historie")
$ExportButton = GUICtrlCreateButton("", 247, 180, 42, 42, $BS_ICON)
GUICtrlSetImage($ExportButton, "export.ico")
GUICtrlSetTip($ExportButton, "exportieren...")
GUICtrlCreateTabItem("") ; end tabitem definition


; Export-Listview
$ExportFormHandle = GUICreate("Auswertung", 400, 250, -1, -1, -1, $WS_EX_ACCEPTFILES)
$listview = GUICtrlCreateListView("Datum       |beginn|ende  |differenz  ", 10, 35, 330, 195);,$LVS_REPORT)
GUISetFont(7)  ; smaller Text
GUISetState(@SW_HIDE, $ExportFormHandle)

; Hauptprozedur
GUICtrlCreateListViewItem("Testitem1|with|multi|columns", $listview)
GUISetState(@SW_SHOW, $MainFormHandle)
GUICtrlCreateListViewItem("Testitem2|with|multi|columns", $listview)



While 1
    $msg = GUIGetMsg()
; ========================================
; ========================================
    If $msg = $ExportButton Then Export()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Exit


Func Export()
    GUICtrlCreateListViewItem("Testitem3|with|multi|columns", $listview)
    GUISetState(@SW_HIDE, $MainFormHandle)
    GUISetState(@SW_SHOW, $ExportFormHandle)
    While 1
        $msgExport = GUIGetMsg()
    ; ========================================
    ; ========================================
        If $msgExport = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUISetState(@SW_HIDE, $ExportFormHandle)
    GUISetState(@SW_SHOW, $MainFormHandle)
    GUICtrlCreateListViewItem("Testitem4|with|multi|columns", $listview)
EndFunc  ;==>Export

i noticed it kept making more and more lists

8)

NEWHeader1.png

Posted

Perhaps I'm blind but I recognized only one new GUISetState-Command (right at the end of the Export-Listview-Block).

But first, it did not help really, did I do something wrong?

And second I'm wondering if this is really necessary because the helpfile says that the initial state of every created GUI is @SW_HIDE. So why should I hide anything already hided?

I'm getting more confused than before :lmao:

Posted (edited)

you were missing a GUISetState()

Sorry, I tried to copy and paste your whole code in a new project. It still has the problem that there is only one item in the listview although it must be four items ?!

So this does not help really.

Anyone any other suggestion?

UTA

Edited by UTA
Posted

I found a workaround: IT ONLY WORKS WITH THE BETA.

Thanx anyway (How could I know that all of you are working with the beta!).

UTA

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
  • Recently Browsing   0 members

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