Sign in to follow this  
Followers 0
kylomas

Problem Creating Resizable GUI

5 posts in this topic

Hi,

Environment - Win7 (64bit) SP1 (current maintenance levels) - AutoIT current Prod release

I cannot get my gui to resize. The Gui accepts drag and drop files to an edit control, or allows browsing files/folders to poplate the edit control. The commented GUICREATE stmt's below show what I've tried.

Also,

When the script is run using the current guicreate stmt, my gui is not shown but a "fileselectfolder" gui is shown. IT is as if an event is being driven for one of my controls, but I don't see how. The gui does not even display.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <array.au3>
local $files   = '',$tt
;local $gui010  =  GUICreate("File Copier", 1100, 800, -1, -1, -1, bitor($WS_SIZEBOX,$WS_EX_ACCEPTFILES))
;local $gui010  =  GUICreate("File Copier", 1100, 800, -1, -1, -1, $WS_SIZEBOX + $WS_EX_ACCEPTFILES)
local $gui010  =  GUICreate("File Copier", 1100, 800, -1, -1, -1, $WS_OVERLAPPEDWINDOW)
     guisetfont(10,800)
     guictrlcreatelabel('List of Files to Copy - [ Drag and Drop or ',10,52,300,50)
local $bttn010   =  guictrlcreatebutton('Browse for files',300,50,150,20)
     guictrlcreatelabel(']',460,52,10,50)
     guictrlsetfont($bttn010,8,800)
     GUICtrlSetBkColor($bttn010,0x00ff00)
local $edit010  =  GUICtrlCreateEdit("", 10, 70, 1080, 650,$ES_AUTOVSCROLL + $WS_VSCROLL + $ws_hscroll + $es_readonly)
     GUICtrlSetState($edit010, $GUI_DROPACCEPTED)
     GUICtrlCreatelabel('Enter path to copy files to or hit [ENTER] to select path',10,730,1080,20)
     guictrlsetfont(-1,10,800)
local $copyto = GUICtrlCreateinput('',10,745,1080,20)
local $err  = GUICtrlCreatelabel('',10,777,1080,20,$ss_sunken)
     guictrlsetcolor($err,0xff0000)
     GUISetState()
local $hDummy  =  GUICtrlCreateDummy()
Dim $aAccelKeys[1][2] = [["{ENTER}", $hDummy]]
GUISetAccelerators($aAccelKeys)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $GUI_EVENT_DROPPED
   Switch @GUI_DropId
    Case $edit010
     _copyfiles(guictrlread($edit010))
   EndSwitch
  case $copyto
   _validate_target_dir()
  case $hdummy
   _validate_target_dir()
    EndSwitch
WEnd
func _copyfiles($str)
local $a_files = stringsplit($str,@crlf,1)
; $a_files contains a crlf delimited list of fully qualified file names
_arraydisplay($a_files)
endfunc
func _validate_target_dir()
if guictrlread($copyto) = '' or not FileExists(guictrlread($copyto))then
  guictrlsetdata($err,'Select a folder to copy to...')
  GUICtrlSetData($copyto,FileSelectFolder("Choose a folder.", ""))
endif
endfunc

Thanks,

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites



kylomas,

$WS_SIZEBOX is a style - $WS_EX_ACCEPTFILES is an extended style. So why are you trying to BitOr or add them together? :D

Just put the correct styles in the correct parameter and all will work as you want: :rip:

Local $gui010 = GUICreate("File Copier", 1100, 800, -1, -1, $WS_SIZEBOX, $WS_EX_ACCEPTFILES)

All clear? :oops:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

#3 ·  Posted (edited)

The reason you can't see the gui is because there isn't one; the guicreate failed because you used an invalid style for an extended style.

The reason you see the fileselectfolder dialog is becuse $hDummy is 0 because it failed to create because there is no gui, $nMsg is 0 and the case section selects case $hDummy.

Change this line

local $gui010 = GUICreate("File Copier", 1100, 800, -1, -1, -1, $WS_OVERLAPPEDWINDOW)

to this

local $gui010 = GUICreate("File Copier", 1100, 800, -1, -1, $WS_OVERLAPPEDWINDOW)

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Melba23, martin,

Thank you and please excuse momentary brain fart !!!

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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