Jump to content

LV-Fields are flickering ....


ReFran
 Share

Recommended Posts

Hi,

I want to change a bigger script (at least form me) to $GUI_DROPACCEPTED based on examples for Global $WM_DROPFILES = 0x233.

Perhaps someone can have a look at the following extracted scriptlines with the LV-fields flicker.

If I do the same on one Main_GUI with a LV on a tab it works fine (-without flickering -), but if it is possible I want to keep the structure of the script and not rewrite all.

Is there any know limitation that $GUI_DROPACCEPTED / $WM_DROPFILES works only ont he Main_GUI.

Best regards, Reinhard

Edit: Forgot to remark that without Case $GUI_EVENT_DROPPED the Tabs are working fine.

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

Global $WM_DROPFILES = 0x233
Global $gaDropFiles[1]


Global $main_GUI,$ok_button,$cancel_button,$Scripts_GUI, $Boomarks_GuI,$aTree,$hTree, $Files_GUI, $Info

$main_GUI = GUICreate("PDF Manager",560,520,20,20,BitOr($GUI_SS_DEFAULT_GUI,$WS_CLIPSIBLINGS))
;GUICtrlCreateGroup ( "", 1, 1,550,1); MENU 
;GUISetBkColor(0xB0A0B0)
    $MMenF = GUICtrlCreateMenu ("&File")
        $MMenFO = GUICtrlCreateMenuitem ("Open",$MMenF)
        $MMenFS1 = GUICtrlCreateMenuitem ("",$MMenF,2)
        $MMenFR = GUICtrlCreateMenu ("Recent Files",$MMenF,1)
        $MMenFE = GUICtrlCreateMenuitem ("Exit",$MMenF)
    $MMenE = GuiCtrlCreateMenu("&Edit")
    $MMenT = GuiCtrlCreateMenu("&Tools")
        $MMenTE = GUICtrlCreateMenuitem ("Explorer",$MMenT)
        $MMenTB = GUICtrlCreateMenuitem ("MetaEdit",$MMenT)
    $MMenH = GuiCtrlCreateMenu("&Help")
    $Button_6 = GuiCtrlCreateButton("", 0, 1, 560, 2, -1, $WS_EX_STATICEDGE)
    
    $OutputFileLab = GUICtrlCreateLabel ("Output File:", 10, 455,-1,-1,$SS_NOTIFY)
    GUICtrlSetTip ($OutputFileLab, "Click here to select an Output file")
    $OutputFile = GUICtrlCreateInput ("C:\Test.pdf", 70, 455, 350, 20)
    $Ok_button = GUICtrlCreateButton("OK",428,455,60,20)
    $cancel_button = GUICtrlCreateButton("Cancel",490,455,60,20)
    
    $Info = "LV=No Files  BM=No"
    $Status = GUICtrlCreateLabel($Info,10,440+40,540,15,BitOR($SS_SUNKEN, $SS_Center))
   ;GUISetState()
;;;;;;;;;;; ==> End of Main GUI Definition;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$Files_GUI = GUICreate("",520,400,20,40, $WS_CHILD,$WS_EX_ACCEPTFILES,$main_GUI)
    GUISetBkColor(0xA0A0B0); just for dimensing the child
    $listview = GUICtrlCreateListView ("Filename|SelPg  |Pg|BM|Date |Path          ",10,10,500,205, _ 
            BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
            GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
    GUICtrlSetState(-1,$GUI_DROPACCEPTED)  ; to allow drag and dropping
    GUISetState()
    


; creates the Boomarks child window that is implemented into the main GUI
$Boomarks_GUI   = GUICreate("",520,400,20,40,$WS_CHILD,-1,$main_GUI)
         GUISetBkColor(0xA0D0B0); just for dimensing the child

; creates the Scripts tab window that is implemented into the main GUI
$Scripts_GUI    = GUICreate("",520,400,20,40,$WS_CHILD,-1,$main_GUI);$WS_CHILD,
GUISetBkColor(0x257788); just for dimensing the child

; creates the Settings window that is implemented into the main GUI
$Settings_GUI   = GUICreate("",520,400,20,40,$WS_CHILD,-1,$main_GUI)
GUISetBkColor(0xCFA0B0); just for dimensing the child

GUISwitch($main_GUI)
$main_tab   = GUICtrlCreateTab(10,10,540,440)
    $Files_tab = GUICtrlCreateTabItem("Files")
    $Boomarks_tab  = GUICtrlCreateTabItem("Boomarks")
    $Scripts_tab  = GUICtrlCreateTabItem("Scripts")
    $Settings_tab  = GUICtrlCreateTabItem("Settings")
    GUICtrlCreateTabItem("")

GUISetState()
GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES_FUNC")
    
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MAIN GUI LOOP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancel_button or $msg = $MMenFE
         ExitLoop
    
    Case $GUI_EVENT_DROPPED
;   msgbox(0,"","Dropped")
        _GUICtrlListViewDeleteAllItems($Listview)
        For $i = 0 To UBound($gaDropFiles) - 1
            GUICtrlCreateListViewItem($gaDropFiles[$i], $Listview)
        Next
    Case $msg = $main_tab
         $tab_item = GUICtrlRead($main_tab)
                Select
    Case $tab_item = 0
         GUISetState(@SW_SHOW,$Files_GUI)
         GUISetState(@SW_HIDE,$Boomarks_GUI)
         GUISetState(@SW_HIDE,$Scripts_GUI)
         GUISetState(@SW_HIDE,$Settings_GUI)          
    Case $tab_item  = 1
         GUISetState(@SW_HIDE,$Files_GUI)
         GUISetState(@SW_SHOW,$Boomarks_GUI)
         GUISetState(@SW_HIDE,$Scripts_GUI)
         GUISetState(@SW_HIDE,$Settings_GUI)
        ;GUICtrlSetState($Expand_button, $GUI_HIDE)
    Case $tab_item  = 2
         GUISetState(@SW_HIDE,$Files_GUI)
         GUISetState(@SW_HIDE,$Boomarks_GUI)
         GUISetState(@SW_SHOW,$Scripts_GUI)
         GUISetState(@SW_HIDE,$Settings_GUI)
        ;GUICtrlSetState($Expand_button, $GUI_HIDE)
    Case $tab_item  = 3
         GUISetState(@SW_HIDE,$Files_GUI)
         GUISetState(@SW_HIDE,$Boomarks_GUI)
         GUISetState(@SW_Hide,$Scripts_GUI)
         GUISetState(@SW_Show,$Settings_GUI)
        
    EndSelect
    EndSelect
WEnd  ;;;; <= End GUI Loop





Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam)
    Local $nSize, $pFileName
    Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255)
    For $i = 0 To $nAmt[0] - 1
        $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0)
        $nSize = $nSize[0] + 1
        $pFileName = DllStructCreate("char[" & $nSize & "]")
        DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize)
        ReDim $gaDropFiles[$i + 1]
        $gaDropFiles[$i] = DllStructGetData($pFileName, 1)
        $pFileName = 0
    Next
EndFunc  ;==>WM_DROPFILES_FUNC
Edited by ReFran
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...