Jump to content
jantograaf

Issues with WS_EX_ACCEPTFILES and GUI_DROPACCEPTED

Recommended Posts

Hi all,

I've been looking around the forum and testing different ways of getting a 'drop zone' to work in my script, but I can't seem to get any response from the event listener. Code compiles perfectly. Chaning the control from a label to an input- or edit-field doesn't change its behaviour, still no response when a file is dropped on there...

It might just be that I am overlooking a simple detail, so I'm hoping for an extra pair of eyes here or there who can spot why this isn't working as it should. 

I have another 3500+ lines script where I have basically the same bit of code, and it seems to work in there without problems.

So, here it goes:

Global $DD_GUI = GUICreate("DicomDrop",200,200,-1,-1,BitOR($WS_SYSMENU,$WS_POPUP),$WS_EX_ACCEPTFILES)
GUISetBkColor(0x030303,$DD_GUI)

$DD_GUI_DRAGLABEL = GUICtrlCreateLabel("",0,0,32,32,-1, $GUI_WS_EX_PARENTDRAG)
$DD_GUI_DRAGIMAGE = GUICtrlCreateIcon(@ScriptFullPath,201,0,0,32,32)

$DD_GUI_TITLELABEL = GUICtrlCreateLabel("DicomDrop",50,10,100,20,$SS_CENTER)
GUICtrlSetFont($DD_GUI_TITLELABEL,8,$FW_SEMIBOLD,$GUI_FONTNORMAL,"Verdana")
GUICtrlSetColor($DD_GUI_TITLELABEL,0xFFFFFF)

$DD_GUI_CLOSE = GUICtrlCreateButton("X",174,4,24,24,$BS_FLAT)
GUICtrlSetBkColor($DD_GUI_CLOSE,0x030303)
GUICtrlSetColor($DD_GUI_CLOSE,0xFFFFFF)

Global $DD_GUI_DROPZONE = GUICtrlCreateLabel("",10,42,180,148)
GUICtrlSetState(-1,8)
GUICtrlSetBkColor($DD_GUI_DROPZONE,0x181818)

GUISetState(@SW_SHOW,$DD_GUI)

Local $DD_MSG = 0
While 1
    $DD_MSG = GUIGetMsg()
    Select
        Case $DD_MSG = $GUI_EVENT_CLOSE
            ConsoleWrite(@CRLF & "Debug -- Closed by GUI_EVENT_CLOSE")
            DD_EXIT()
        Case $DD_MSG = $GUI_EVENT_DROPPED
                If @GUI_DropId = $DD_GUI_DROPZONE Then
                    Local $DroppedFile = @GUI_DragFile
                    GUIDelete()
                    ConsoleWrite(@CRLF & "Debug -- Dropped file : " & $DroppedFile)
                EndIf
        Case $DD_MSG = $DD_GUI_CLOSE
            ConsoleWrite(@CRLF & "Debug -- Closed by DD_GUI_CLOSEIMAGE")
            DD_EXIT()
    EndSelect
WEnd

Func DD_EXIT()
    GUIDelete($DD_GUI)
    Exit
EndFunc

If anyone has any idea whatsoever, please let me know 🙂

Thanks in advance and kind regards,

Jan

Share this post


Link to post
Share on other sites

jantograaf,

Your script as posted runs (when the required includes are added) without problem for me - I get the dropped filename written to the console for every drop.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi @Melba23,

Thanks for the quick reply! 🙂 

This was the scenario I was afraid of (since my code seemed correct). So, just to be 'complete', I have included all the includes I'm using right now. Overkill, I know, but I included all includes from the other script as the drop zone works in that one...

#NoTrayIcon
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=DicomDrop.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_Icon_Add=drag.ico,201
#AutoIt3Wrapper_Res_Icon_Add=close.ico,202
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <MsgBoxConstants.au3>
#include <GuiEdit.au3>
#include <WinAPIProc.au3>
#include <WinAPISys.au3>
#include <Array.au3>
#include <FontConstants.au3>
#include <AutoItConstants.au3>
#include <ColorConstants.au3>
#include <InetConstants.au3>
#include "WinHttp.au3"
#include <Network.au3>
#include <StringConstants.au3>
#include <File.au3>
#include <Misc.au3>
#include <GuiComboBox.au3>
#include <GUIComboBoxEx.au3>
#include <FileConstants.au3>
#include <GUIListView.au3>
#include <GUITab.au3>
#include <GUIListBox.au3>
#include <GuiButton.au3>
#include <XML.au3>
#include <SliderConstants.au3>
#include <json.au3>

Anything obvious missing as far as you can see?

Kind regards,

Jan

Share this post


Link to post
Share on other sites
1 minute ago, Nine said:

Shouldn't you exit after GUIDelete ?

Haha, I missed that line, since it came from the other program (where the drop zone does work). But actually that GuiDelete() should be erased there and will be replaced by the call to the function that will process the dropped file. Thanks anyway 😉 

Share this post


Link to post
Share on other sites

So, seems like I've reached the holy grail of (quite basic) programming on your pc's, but not on mine...

SCRIPT WORKS. DUNNO WHY. OK THEN🤪

 

Share this post


Link to post
Share on other sites

So, meanwhile, I've tested it here on multiple PC's, and it seems to work on some and not work on others. All of them are Windows 10 x64 however, and they should be configured basically in the same way. Could it be that it has something to do with usernames/permissions? I'm completely baffled right now, this should work without a problem and it doesn't. 😪

Share this post


Link to post
Share on other sites

jantograaf,

My machine is also Win10 x64 and as I said earlier, the script ran perfectly for me.

But searching for "Win10 drag and drop problem" shows that this a relatively common event, possibly linked to Explorer becoming corrupted during Windows updates.  Various sites listed propose fixes - none of those I investigated appear to be likely to damage your machine or your data - so it might be worth trying some of them and seeing if you can resolve your problem. Please let us know if you do find a solution.

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

The script works fine

Global $DD_GUI = GUICreate("DicomDrop",200,200,-1,-1,0x00CF0000,0x00000018)
GUISetBkColor(0x030303,$DD_GUI)
$DD_GUI_DRAGLABEL = GUICtrlCreateLabel("",0,0,32,32,-1, 0x00100000)
$DD_GUI_DRAGIMAGE = GUICtrlCreateIcon(@ScriptFullPath,201,0,0,32,32)
$DD_GUI_TITLELABEL = GUICtrlCreateLabel("DicomDrop",50,10,100,20,0x1)
GUICtrlSetFont($DD_GUI_TITLELABEL,8,600,0,"Verdana")
GUICtrlSetColor($DD_GUI_TITLELABEL,0xFFFFFF)
$DD_GUI_CLOSE = GUICtrlCreateButton("X",174,4,24,24,0x8000)
GUICtrlSetBkColor($DD_GUI_CLOSE,0x030303)
GUICtrlSetColor($DD_GUI_CLOSE,0xFFFFFF)
Global $DD_GUI_DROPZONE = GUICtrlCreateLabel("",10,42,180,148)
GUICtrlSetState(-1,8)
GUICtrlSetBkColor($DD_GUI_DROPZONE,0xC8C9D2)
GUISetState(@SW_SHOW)
Local $DD_MSG = 0
While 1
$DD_MSG = GUIGetMsg()
Select
Case $DD_MSG = -3
ConsoleWrite(@CRLF & "Debug -- Closed by GUI_EVENT_CLOSE")
DD_EXIT()
Case $DD_MSG = -13
If @GUI_DropId = $DD_GUI_DROPZONE Then
Local $DroppedFile = @GUI_DragFile
GUICtrlSetData($DD_GUI_DROPZONE,$DroppedFile)
MsgBox(262144, '', $DroppedFile & @CR & '' & @CR & '' & @CR & '')
;GUIDelete()
ConsoleWrite(@CRLF & "Debug -- Dropped file : " & $DroppedFile)
EndIf
Case $DD_MSG = $DD_GUI_CLOSE
ConsoleWrite(@CRLF & "Debug -- Closed by DD_GUI_CLOSEIMAGE")
DD_EXIT()
EndSelect
WEnd
Func DD_EXIT()
GUIDelete($DD_GUI)
Exit
EndFunc

 

Share this post


Link to post
Share on other sites

Every time I had a drag/drop problem it came from elevation issues. 

If the GUI was running as admin and the explorer process was not then it would not have enough permissions to drag a file.

If it is working on some machines and not others I wonder if it may be a UAC setting or some other process creating a difference in the rights.

 

You can go so far as to run the GUI as admin, and manually run a file explorer process as admin and it will work, but when they are mixed it creates issues. 

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Fenzik
      Hello all!
      i'm searching here, cause i do'nt know where else to search..
      I'm developing some projects, mainly intended to help Blind users of computers.
       
      I'm also blind, so my guis are Ok for Screen readers, but i'm not sure, if they are good also for normal users..
       
      So I¨m searching here for somebody, interested in Autoit, which have no problem to help me a bit with designating my apps.
       
      My apps are written in Czech language, so i prefer somebody from Czech republic..
       
      If somebody want to help me, don't hesitate to contact me personaly, contacts and my projects are available on web in my profile.
       
      So thank you for potential help and i'm sorry if i missed some forum etiquette rule here.
       
      I'm not sure how it works here with searching for interested people and then contact them personaly.
       
      Fenzik
    • By GNGNUT
      Hi guys
      what i am trying to do is have My Gui LIve update Out of focus, so i can have this on a 2nd monitor streaming live updates while i continue to work on other screen, 
      i have been googling and looking at other threads about focus and stuff , but they do not seem to match what I'm after, 

      to be clear - i am not wanting to put focus on the GUI for it to auto update values, 
       
      if you have any positive feed back on the script while you read - i would be more then happy to accept - as im still building my Knowledge of this coding, 
      and stream line is always better Garbage code writing, 
       
      Kind regards 
      Gngnut
       
      #include <MemoryConstants.au3> #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $currentTime,$currentTimeValue,$v,$Label_Time,$Form1 Global $Label_C2_1,$Label_C2_2,$Label_C2_3,$Label_C2_4,$Label_C2_5,$Label_C2_6,$Label_C2_7 Global $Label_C3_1,$Label_C3_2,$Label_C3_3,$Label_C3_4,$Label_C3_5,$Label_C3_6,$Label_C3_7 ;~ Default Hight for boxs $Hight = 40 $lenght = 180 ;; As per nines comments moved out side of the While loop, AdlibRegister(UpdateTime,250) AdlibRegister(updateValues,500) AdlibRegister(Warning,250) hotkeyset ("{ESC}",Terminate) ;; <<< Used to Quit the programe $aMemStats = MemGetStats() MyGui() ;; running the GUI #Region ### START Koda GUI section ### Form= func MyGui() $ServerName=@ComputerName ; ### Change to your location of image $Image = "C:\Users\gngnut\OneDrive\Pictures\Computer.jpg" ; Creating the form With the Labels $Form1 = GUICreate("My System Status", 800, 750, 225, 173,BitOR($WS_SYSMENU,$WS_MAXIMIZEBOX,$WS_MINIMIZEBOX));$WS_POPUP)) $Pic1 = GUICtrlCreatePic($Image, 0, 0, 800, 750) ;;; #### Column 1 $Label_C1_1 = GUICtrlCreateLabel("Total load currently on RAM:", 71, 192, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C1_2 = GUICtrlCreateLabel("Total physical RAM:", 71, 248, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C1_3 = GUICtrlCreateLabel("Available physical RAM:", 71, 304, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C1_4 = GUICtrlCreateLabel("Total Page Size:", 71, 360, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C1_5 = GUICtrlCreateLabel("Available Page Size:", 71, 416, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C1_6 = GUICtrlCreateLabel("Total virtual Size:", 71, 472, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C1_7 = GUICtrlCreateLabel("Available virtual RAM:", 71, 528, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") ;;; #### Column 2 $Label_C2_1 = GUICtrlCreateLabel($aMemStats[$MEM_LOAD] & " %", 311, 192, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) $colour=0xFEF200 GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C2_2 = GUICtrlCreateLabel($aMemStats[$MEM_TOTALPHYSRAM] & ' Kb' , 311, 248, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C2_3 = GUICtrlCreateLabel($aMemStats[$MEM_AVAILPHYSRAM] & ' Kb', 311, 304, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C2_4 = GUICtrlCreateLabel($aMemStats[$MEM_TOTALPAGEFILE] & ' Kb', 311, 360, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C2_5 = GUICtrlCreateLabel($aMemStats[$MEM_AVAILPAGEFILE] & ' Kb', 311, 416, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C2_6 = GUICtrlCreateLabel($aMemStats[$MEM_TOTALVIRTUAL] & ' Kb' , 311, 472, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C2_7 = GUICtrlCreateLabel($aMemStats[$MEM_AVAILVIRTUAL] & ' Kb', 311, 528, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") ;;; #### Column 3 $Label_C3_2 = GUICtrlCreateLabel(Round($aMemStats[$MEM_TOTALPHYSRAM]/1024/1024, 2) & ' Gb', 551, 248, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C3_3 = GUICtrlCreateLabel(Round($aMemStats[$MEM_AVAILPHYSRAM]/1024/1024, 2) & ' Gb', 551, 304, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C3_4 = GUICtrlCreateLabel(Round($aMemStats[$MEM_TOTALPAGEFILE]/1024/1024, 2) & ' Gb', 551, 360, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C3_5 = GUICtrlCreateLabel(Round($aMemStats[$MEM_AVAILPAGEFILE]/1024/1024, 2) & ' Gb', 551, 416, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C3_6 = GUICtrlCreateLabel(Round($aMemStats[$MEM_TOTALVIRTUAL]/1024/1024, 2) & ' Gb', 551, 472, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C3_7 = GUICtrlCreateLabel(Round($aMemStats[$MEM_AVAILVIRTUAL]/1024/1024, 2) & ' Gb', 551, 528, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_Server = GUICtrlCreateLabel($ServerName, 551, 600, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_Time = GUICtrlCreateLabel($currentTime , 71, 600, 180, $Hight, bitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") GUISetState(@SW_SHOWNORMAL) #EndRegion ### END Koda GUI section ### EndFunc While 1 Sleep(1000) ; sets a delay of 1 sec per 1000 WEnd ;; close down the Application func Terminate() exit EndFunc ;; Updating Time func UpdateTime() $currentTime = @HOUR&":"& @MIN &":"& @SEC ControlSetText($Form1,"",$Label_Time, $currentTime) EndFunc ;; currently changing the CPU % lable Func Warning() if $aMemStats[$MEM_LOAD] <=40 Then ; Green GUICtrlSetbkColor($Label_C2_1,0x2BFC0B) ElseIf $aMemStats[$MEM_LOAD] >40 and $aMemStats[$MEM_LOAD] <= 80 Then GUICtrlSetbkColor($Label_C2_1,0xFDBE01) Elseif $aMemStats[$MEM_LOAD] > 80 Then GUICtrlSetBkColor($Label_C2_1, 0xEE0C0C) EndIf EndFunc ;; Updating The Lable values of column 2 Only if the values change func updateValues() $aMemStats = MemGetStats() if GUICtrlRead($Label_C2_1) <> $aMemStats[$MEM_LOAD] Then ControlSetText($Form1,"",$Label_C2_1,$aMemStats[$MEM_LOAD]) endif If GUICtrlRead($Label_C2_2) <> $aMemStats[$MEM_TOTALPHYSRAM] & ' Kb' then ControlSetText($Form1,"",$Label_C2_2,$aMemStats[$MEM_TOTALPHYSRAM] & ' Kb') endif If GUICtrlRead($Label_C2_3) <> $aMemStats[$MEM_AVAILPHYSRAM] & ' Kb' then ControlSetText($Form1,"",$Label_C2_3,$aMemStats[$MEM_AVAILPHYSRAM] & ' Kb') endif If GUICtrlRead($Label_C2_4) <> $aMemStats[$MEM_TOTALPAGEFILE] & ' Kb' then ControlSetText($Form1,"",$Label_C2_4,$aMemStats[$MEM_TOTALPAGEFILE] & ' Kb') endif If GUICtrlRead($Label_C2_5) <> $aMemStats[$MEM_AVAILPAGEFILE] & ' Kb' then ControlSetText($Form1,"",$Label_C2_5,$aMemStats[$MEM_AVAILPAGEFILE] & ' Kb') endif If GUICtrlRead($Label_C2_6) <> $aMemStats[$MEM_TOTALVIRTUAL] & ' Kb' then ControlSetText($Form1,"",$Label_C2_6,$aMemStats[$MEM_TOTALVIRTUAL] & ' Kb') endif If GUICtrlRead($Label_C2_7) <> $aMemStats[$MEM_AVAILVIRTUAL] & ' Kb' then ControlSetText($Form1,"",$Label_C2_7,$aMemStats[$MEM_AVAILVIRTUAL] & ' Kb') endif EndFunc  
    • By matwachich
      Hi AutoIters!
      Here is my new UDF about GUIs: it's an enhanced mixture of Advanced InputBox (deprecated) and KODA Parser (deprecated), with additional functions.
      What you can do with it:
      Parse KODA files and directly create GUIs (_GUIUtils_CreateFromKODA) Parse a simple JSON form definition to simply create advanced InputBoxes with any amount/type of input controls (_GUIUtils_CreateFromJSON) Created GUIs are returned as Scripting.Dictionary objects, and you have helper functions to access GUIs controls by their names (_GUIUtils_HWnd, _GUIUtils_CtrlID, _GUIUtils_HCtrl ...) A function that can make a GUI created from KODA/JSON (defined by it's $oForm object) and make it a modal InputDialogBox (just like InputBox, but returns all entered data as Scripting.Dictionary object) Functions are documented, and there are some examples.
      Consider this UDF as beta, but since I'm currently using it in a small commercial project, it should become production ready in near future.
      To always get the latest code version, get it from Github (more up to date than this topic).
      Update 04/02/2020:
      New simple application example Fixed focused control handling in _GUIUtils_InputDialog Reset input values before returning from _GUIUtils_InputDialog Fixed CloseOnEsc in _GUIUtils_InputDialog Fixed Input not reset Fixed all ListBox items are selected Project now on GitHub https://github.com/matwachich/autoit-guiutils/
      Update 05/02/2020:
      Support for nodate for Date and Time input controls (pass null value) New handling of focused control _GUIUtils_InputDialog: Now, you can specify the focused control in $oInitialData by setting "controlName:focus" = True Updated documentation of _GUIUtils_InputDialog Update 07/02/2020:
      Bug corrected when setting Data input control Added: abillity to read a single input control New functions (_GUIUtils_GetInputs, _GUIUtils_WriteInputs), documentation completion. Readme file and screenshots on Github Page  
      GUIUtils.zip
    • By antonioj84
      I am not able to use the $GUI_READ_EXTENDED with the  Metro UDF,  any work around ?
      Local $aPos[2] = [$Radio1, $Radio2] For $Radio In $aPos If GUICtrlRead($Radio) = $GUI_UNCHECKED Then ContinueLoop IniWrite($sGUIstate_IniFile, "Data", "POS", GUICtrlRead($Radio, $GUI_READ_EXTENDED)) ;; return the text of the menu item ExitLoop Next  
    • By _Vlad
      Hello forum,
      I want to create a program with multiple menus and many elements inside. The problem is my way of doing this and below I have an example of how I do these menus.
      I know it's a bad way of doing them as using this method for more elements and menus cause big flickering.
       
      Can someone please help me with some tips of optimizing this or tell me another way of creating that menus with many elements without cause flickering? From a long time ago I still try to solve this but without any results, just small improvements.
      Many thanks for everyone.
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $MENU_HOVER = '' Global $MENU_SELECTED = '' Global $COLOR_STANDARD = 0x94A5E9 Global $COLOR_HOVER = 0x8292d1 Global $COLOR_SELECTED = 0x7584bf $MENU = GUICreate("Menu", 615, 437, -1, -1, -1, -1, 0) GUISetFont(10, 400, 0, "Arial") $MENU_1 = GUICtrlCreateLabel("Menu 1", 8, 24, 106, 28, BitOR($SS_CENTER, $SS_CENTERIMAGE)) $MENU_2 = GUICtrlCreateLabel("Menu 2", 8, 56, 106, 28, BitOR($SS_CENTER, $SS_CENTERIMAGE)) $MENU_3 = GUICtrlCreateLabel("Menu 3", 8, 88, 106, 28, BitOR($SS_CENTER, $SS_CENTERIMAGE)) ;MENU 1 ELEMENTS $MENU_1_ELEMENT_1 = GUICtrlCreateButton("Menu1 Button", 128, 24, 147, 25) ;MENU 2 ELEMENTS $MENU_2_ELEMENT_1 = GUICtrlCreateButton("Menu2 Button", 128, 24, 147, 25) $MENU_2_ELEMENT_2 = GUICtrlCreateLabel("Another element", 128, 64, 99, 20) _Design() _Hide_All() GUISetState(@SW_SHOW, $MENU) While 1 $Cursor = GUIGetCursorInfo($MENU) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MENU_1 _Previous_Selected_Cancel() $MENU_SELECTED = 'Menu1' GUICtrlSetBkColor($MENU_1, $COLOR_SELECTED) _Show('Menu1') Case $MENU_2 _Previous_Selected_Cancel() $MENU_SELECTED = 'Menu2' GUICtrlSetBkColor($MENU_2, $COLOR_SELECTED) _Show('Menu2') Case $MENU_3 _Previous_Selected_Cancel() $MENU_SELECTED = 'Menu3' GUICtrlSetBkColor($MENU_3, $COLOR_SELECTED) _Show('Menu3') EndSwitch If $Cursor[4] = $MENU_1 Then If $MENU_HOVER <> 'Menu1' And $MENU_SELECTED <> 'Menu1' Then _Previous_Hover_Cancel() GUICtrlSetBkColor($MENU_1, $COLOR_HOVER) $MENU_HOVER = 'Menu1' EndIf ElseIf $Cursor[4] = $MENU_2 Then If $MENU_HOVER <> 'Menu2' And $MENU_SELECTED <> 'Menu2' Then _Previous_Hover_Cancel() GUICtrlSetBkColor($MENU_2, $COLOR_HOVER) $MENU_HOVER = 'Menu2' EndIf ElseIf $Cursor[4] = $MENU_3 Then If $MENU_HOVER <> 'Menu3' And $MENU_SELECTED <> 'Menu3' Then _Previous_Hover_Cancel() GUICtrlSetBkColor($MENU_3, $COLOR_HOVER) $MENU_HOVER = 'Menu3' EndIf Else _Previous_Hover_Cancel() $MENU_HOVER = 'Idle' EndIf WEnd Func _Design() GUICtrlSetColor($MENU_1, 0xFFFFFF) GUICtrlSetBkColor($MENU_1, $COLOR_STANDARD) GUICtrlSetCursor($MENU_1, 0) GUICtrlSetColor($MENU_2, 0xFFFFFF) GUICtrlSetBkColor($MENU_2, $COLOR_STANDARD) GUICtrlSetCursor($MENU_2, 0) GUICtrlSetColor($MENU_3, 0xFFFFFF) GUICtrlSetBkColor($MENU_3, $COLOR_STANDARD) GUICtrlSetCursor($MENU_3, 0) EndFunc ;==>_Design Func _Hide_All() GUICtrlSetState($MENU_1_ELEMENT_1, $GUI_HIDE) GUICtrlSetState($MENU_2_ELEMENT_1, $GUI_HIDE) GUICtrlSetState($MENU_2_ELEMENT_2, $GUI_HIDE) EndFunc ;==>_Hide_All Func _Show($MENU_SHOW) _Hide_All() If $MENU_SHOW = 'Menu1' Then GUICtrlSetState($MENU_1_ELEMENT_1, $GUI_SHOW) ElseIf $MENU_SHOW = 'Menu2' Then GUICtrlSetState($MENU_2_ELEMENT_1, $GUI_SHOW) GUICtrlSetState($MENU_2_ELEMENT_2, $GUI_SHOW) ElseIf $MENU_SHOW = 'Menu3' Then EndIf EndFunc ;==>_Show Func _Previous_Hover_Cancel() If $MENU_HOVER = 'Menu1' Then If $MENU_SELECTED <> 'Menu1' Then GUICtrlSetBkColor($MENU_1, $COLOR_STANDARD) ElseIf $MENU_HOVER = 'Menu2' Then If $MENU_SELECTED <> 'Menu2' Then GUICtrlSetBkColor($MENU_2, $COLOR_STANDARD) ElseIf $MENU_HOVER = 'Menu3' Then If $MENU_SELECTED <> 'Menu3' Then GUICtrlSetBkColor($MENU_3, $COLOR_STANDARD) EndIf EndFunc ;==>_Previous_Hover_Cancel Func _Previous_Selected_Cancel() If $MENU_SELECTED = 'Menu1' Then GUICtrlSetBkColor($MENU_1, $COLOR_STANDARD) If $MENU_SELECTED = 'Menu2' Then GUICtrlSetBkColor($MENU_2, $COLOR_STANDARD) If $MENU_SELECTED = 'Menu3' Then GUICtrlSetBkColor($MENU_3, $COLOR_STANDARD) EndFunc ;==>_Previous_Selected_Cancel  
×
×
  • Create New...