Sign in to follow this  
Followers 0
fps

GUICtrlDelete Problem

3 posts in this topic

Hi!

I think there may be a bug in the latest beta Version of AutoIt:

I've got two windows. The first window is the Main GUI, which consists of some buttons and controls.

The second window is created after i click the Select Episodes Button of the Main window.

The second window consists of two ListViews. But if i delete a Listview with the GUICtrlDelete Function, some parts of the Main GUI get deleted, as well.

Here is my Code:

#include <GUIConstants.au3>
#include <GuiListView.au3>

Opt("GUIOnEventMode", 1) 

$mainwindow = GUICreate("dvd2mkv GUI", 317, 422)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE")

Global $listview_1, $listview_2, $selected_list, $list

GUICtrlCreateLabel("mkvmerge.exe", 12, 20)
GUICtrlCreateLabel("Input", 12, 53)
GUICtrlCreateLabel("Output", 12, 91)

Global $script_path   = @ScriptDir & "\"; 
Global $mkvmerge_path = IniRead(($script_path & "settings.ini"), "Paths", "mkvmerge.exe", "Not Selected")

Global $in[5]
For $i = 0 to 4 Step +1
    $in[$i] = IniRead(($script_path & "settings.ini"), "Paths", "in_" & $i, "")
Next

Global $out[5]
For $i = 0 to 4 Step +1
    $out[$i] = IniRead(($script_path & "settings.ini"), "Paths", "out_" & $i, "")
Next

$CI_mkv = GUICtrlCreateEdit($mkvmerge_path, 12, 35, 261, 16, $ES_READONLY, $WS_EX_STATICEDGE)

$edit_mkv = GUICtrlCreateButton("...", 278, 34, 26, 18)
$edit_in  = GUICtrlCreateButton("...", 278, 70, 26, 18)
$edit_out = GUICtrlCreateButton("...", 278, 108, 26, 18)

$Combo_input = GuiCtrlCreateCombo($in[0], 12, 68, 260, 16)
$Combo_output = GuiCtrlCreateCombo($out[0], 12, 106, 260, 16)
GUICtrlCreateGroup("Pfade", 6, 4, 305, 128)

Global $Offset_X, $Offset_Y

$Offset_X = 17
$Offset_Y = 155

GUICtrlCreateGroup("Audio 1", 6, 140, 87, 108)
$radio_audio_1_ac3  = GUICtrlCreateRadio("ac3", $Offset_X, $Offset_Y)
$radio_audio_1_ogg  = GUICtrlCreateRadio("ogg", $Offset_X, $Offset_Y + 20)
$radio_audio_1_none = GUICtrlCreateRadio("None", $Offset_X, $Offset_Y +40)
$Combo_audio_1    = GuiCtrlCreateCombo("English", $Offset_X, 220, 65, 16)
GUICtrlSetState($radio_audio_1_ac3, $GUI_CHECKED)
GUICtrlSetData(-1, "German") 
GUICtrlCreateGroup ("", -99, -99, 1, 1) ;close group

GUICtrlCreateGroup("Audio 2", 101, 140, 87, 108)
$radio_audio_2_ac3  = GUICtrlCreateRadio("ac3", $Offset_X + 95, $Offset_Y)
$radio_audio_2_ogg  = GUICtrlCreateRadio("ogg", $Offset_X + 95, $Offset_Y + 20)
$radio_audio_2_none = GUICtrlCreateRadio("None", $Offset_X + 95, $Offset_Y +40)
$Combo_audio_2    = GuiCtrlCreateCombo("English", $Offset_X + 95, 220, 65, 16)
GUICtrlSetState($radio_audio_2_ogg, $GUI_CHECKED)
GUICtrlSetData(-1, "German","German") 
GUICtrlCreateGroup ("", -99, -99, 1, 1) ;close group

GUICtrlCreateGroup("Director's Comments", 196, 140, 115, 108)
$radio_audio_3_ac3  = GUICtrlCreateRadio("ac3", $Offset_X + 190, $Offset_Y)
$radio_audio_3_ogg  = GUICtrlCreateRadio("ogg", $Offset_X + 190, $Offset_Y + 20)
$radio_audio_3_none = GUICtrlCreateRadio("None", $Offset_X + 190, $Offset_Y +40)
GUICtrlSetState($radio_audio_3_none, $GUI_CHECKED) 
$comments = GUICtrlCreateButton ("Select Episodes", $Offset_X + 195, $Offset_Y +65, 87, 22)
GUICtrlSetOnEvent($comments, "Write_Comments")
GUICtrlCreateGroup ("", -99, -99, 1, 1) ;close group

GUICtrlCreateGroup("Subtitle 1", 6, 255, 87, 88)
$radio_sub_1_eng  = GUICtrlCreateRadio("English", $Offset_X, $Offset_Y + 120)
$radio_sub_1_ger  = GUICtrlCreateRadio("German", $Offset_X, $Offset_Y + 140)
$radio_sub_1_none = GUICtrlCreateRadio("None", $Offset_X, $Offset_Y +160)
GUICtrlSetState($radio_sub_1_eng, $GUI_CHECKED)
GUICtrlCreateGroup ("", -99, -99, 1, 1) ;close group

GUICtrlCreateGroup("Subtitle 2", 101, 255, 87, 88)
$radio_sub_2_eng  = GUICtrlCreateRadio("English", $Offset_X + 95, $Offset_Y + 120)
$radio_sub_2_ger  = GUICtrlCreateRadio("German", $Offset_X + 95, $Offset_Y + 140)
$radio_sub_2_none = GUICtrlCreateRadio("None", $Offset_X + 95, $Offset_Y +160)
GUICtrlSetState($radio_sub_2_none, $GUI_CHECKED)
GUICtrlCreateGroup ("", -99, -99, 1, 1) ;close group

GUICtrlCreateGroup("Aspect Ratio", 196, 255, 115, 88)
$radio_resized   = GUICtrlCreateRadio("Resized", $Offset_X + 190, $Offset_Y + 120)
$radio_anamorph  = GUICtrlCreateRadio("Anamorph", $Offset_X + 190, $Offset_Y + 140)
GUICtrlSetState($radio_anamorph, $GUI_CHECKED)
GUICtrlCreateGroup ("", -99, -99, 1, 1) ;close group

$anamorph_A  = GUICtrlCreateInput("", 223, 318, 35, 20, $ES_NUMBER)
$anamorph_B  = GUICtrlCreateInput("", 273, 318, 28, 20, $ES_NUMBER)
GUICtrlCreateLabel("x", 262, 321, 10)

GUICtrlCreateGroup("Options", 6, 350, 305, 67)
GUICtrlCreateLabel("Episodes", 14, 372)
GUICtrlCreateLabel("Muxing Begin", 13, 395)
$episodes  = GUICtrlCreateInput("", 100, 369, 25, 20, $ES_NUMBER)
$mux_begin = GUICtrlCreateInput("", 100, 392, 25, 20, $ES_NUMBER)

$chapters = GuiCtrlCreateCheckbox("Chapters", 142, 370, 60, 20)
GuiCtrlSetState($chapters, $GUI_CHECKED)

$auto_delete_logs = GuiCtrlCreateCheckbox("Delete logs", 142, 393, 71, 20)
GuiCtrlSetState($auto_delete_logs, $GUI_CHECKED)

$start = GUICtrlCreateButton ("Start Muxing", 228, 391, 70, 22)

GUISetState(@SW_SHOW, $mainwindow)

While 1
  Sleep(1000)
WEnd

Func CLOSE()
    Exit
EndFunc

Func Write_Comments()
    $list      = GUICreate("Select Director's Comments", 305, 223, 100, 200)
    $listview_1 = GUICtrlCreateListView("Episode    ", 10, 10, 103, 179, $LVS_SHOWSELALWAYS + $LVS_NOSORTHEADER)
    $listview_2 = GUICtrlCreateListView("Episode    ", 190, 10, 103, 179, $LVS_SHOWSELALWAYS + $LVS_NOSORTHEADER)
    $select_button = GUICtrlCreateButton("Select", 119, 95, 65, 22)
    $OK_button   = GUICtrlCreateButton("OK", 10, 195, 65, 22)
    $Cancel_button = GUICtrlCreateButton("Cancel", 115, 195, 74, 22)
    $Clear_button  = GUICtrlCreateButton("Clear List", 220, 195, 74, 22)
    
    GUICtrlSetOnEvent($select_button, "Select_button_clicked")
    GUICtrlSetOnEvent($Clear_button, "Clear_button_clicked")
    
    Local $i
    For $i = GUICtrlRead($mux_begin) to (GUICtrlRead($mux_begin) + GUICtrlRead($episodes) - 1) Step +1
        GUICtrlCreateListViewItem("Episode " & $i, $listview_1)
    Next
    
    GUISetState(@SW_SHOW)
    WinActivate("Select Director's Comments", "")
EndFunc 

Func Select_button_clicked()
    
    Local $a_indices = _GUICtrlListViewGetSelectedIndices($listview_1,1)
    If( IsArray($a_indices) ) Then
        Local $i
        For $i = 1 To $a_indices[0]
            GUICtrlCreateListViewItem("Episode " & $a_indices[$i] + GUICtrlRead($mux_begin), $listview_2)
        Next
    Else
        MsgBox(16, "Error", "No Items selected")
    EndIf
EndFunc 

Func Clear_button_clicked()
    GUICtrlDelete($listview_2)
EndFunc

The recreate the problem please do the following:

1) Type in a number for episodes, for example 9.

2) Type in a number for muxing begin, for example 1.

3) Hit Select Episodes

4) Select some episodes of the new window that has been created

5) Hit Select

6) Hit Clear List

After that the ListView is created, but unfortunately some parts of the Main GUI, too.

Thanks for your help! :o

Share this post


Link to post
Share on other sites



not sure what it's doing, but why delete the control? just delete the items in the control

Func Clear_button_clicked()
 _GUICtrlListViewDeleteAllItems($listview_2)
EndFunc  ;==>Clear_button_clicked

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

I know, to delete the items is the better way. :o

But I wanted to post that, because I think this is a bug.

Share this post


Link to post
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
Sign in to follow this  
Followers 0