Jump to content

*solved* Child Window not as responsive as I would like.


Brandan
 Share

Recommended Posts

I have a GUI that works with a database. Once in a while I need to look up a rowid and have been dedacating part of the window to do that. My pages are getting too full and I want to move that to a floating toolbar or child window of somesort. I have set up such a window and it works as expected, except the toolbar window is not very responsive to mouse clicks.I have several input boxs on the child window, sometimes it works smoothly, but most of the time I need to click 5+ times before the input that I want becomes active and I can type in what I want. I have been finding it faster to just use the tab button to move the select where I want it, which in this case is not as handy as I would like. While the child window is giving me problems the main window is as responcive as I normally expect from an AutoIT GUI. Any ideas what I am doing wrong or how I can make the child more responsive to my wishes? Below is a sample script riped from my project to display the problem. Just try clicking on the various inputs and you should see what I am talking about.

#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <Misc.au3>
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode
$mainwindow = GUICreate ( "BTCattle---Intro" , IniRead ( "pref.ini", "GUI", "SizeX", "1280" ),IniRead ( "pref.ini", "GUI", "SizeY", "800" )) ;Creat the page
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
  Opt("GUICoordMode", 1) ;1=absolute, 0=relative, 2=cell
  $UIDBtag=GUICtrlCreateInput("",115,1,150,IniRead ( "pref.ini", "GUI", "Fontsize", "10" )+10)
  Opt("GUICoordMode", 2) ;1=absolute, 0=relative, 2=cell
  $UIDCalfN=GUICtrlCreateInput("",-1,0)
  $UIDDOByear=GUICtrlCreateInput("",-1,0)
  $UIDDOB=GUICtrlCreateInput("",-1,0)
  $UIDSortDOB=GUICtrlCreateInput("",-1,0)
  $UIDDamtag=GUICtrlCreateInput("",-1,0)
  $UIDDamUID=GUICtrlCreateInput("",-1,0)
  GUICtrlSetOnEvent(GUICtrlCreateButton("Find Animal", -1, 0,200,$GUI_SS_DEFAULT_BUTTON),"UIDfind") 
 
$selectwindow=GUICreate ( "Select Cow" , 300, 400, 1100, 300, -1, $WS_EX_TOOLWINDOW, $mainwindow ) ;create toolwindow
;First Colum
  Opt("GUICoordMode", 1) ;1=absolute, 0=relative, 2=cell
  GUICtrlCreateLabel ('Select Btag like %a%',1,5,150,IniRead ( "pref.ini", "GUI", "Fontsize", "10" )+10)
  Opt("GUICoordMode", 2) ;1=absolute, 0=relative, 2=cell
  GUICtrlCreateLabel ('CalfN like %a%',-1,0)
  GUICtrlCreateLabel ('Year of birth "2012"',-1,0)
  GUICtrlCreateLabel ('DOB "1/5/2012"',-1,0)
  GUICtrlCreateLabel ('SortDOB ',-1,0)
  GUICtrlCreateLabel ('Dam',-1,0)
  GUICtrlCreateLabel ('DamUID',-1,0)
  GUICtrlSetOnEvent(GUICtrlCreateButton("Find Animal", -1, 0,200,$GUI_SS_DEFAULT_BUTTON),"UIDfind")
  GUICtrlCreateLabel ('UID',-1,0)
  $UIDUIDlist = GUICtrlCreateList("UID", -1, 0,75,200)
  GUICtrlSetOnEvent($UIDUIDlist,'UIDUIDlist')
 
  ;Second Colum
  Opt("GUICoordMode", 1) ;1=absolute, 0=relative, 2=cell
  $UIDBtag=GUICtrlCreateInput("",115,1,150,IniRead ( "pref.ini", "GUI", "Fontsize", "10" )+10)
  Opt("GUICoordMode", 2) ;1=absolute, 0=relative, 2=cell
  $UIDCalfN=GUICtrlCreateInput("",-1,0)
  $UIDDOByear=GUICtrlCreateInput("",-1,0)
  $UIDDOB=GUICtrlCreateInput("",-1,0)
  $UIDSortDOB=GUICtrlCreateInput("",-1,0)
  $UIDDamtag=GUICtrlCreateInput("",-1,0)
  $UIDDamUID=GUICtrlCreateInput("",-1,0)
 
GUISetState(@SW_SHOW)
GUISwitch($mainwindow)
GUISetState(@SW_SHOW)

Func CLOSEClicked()
    Exit
EndFunc
While 1
  Sleep(10000)  ; Idle around
WEnd

Edited by Brandan
Link to comment
Share on other sites

  • Moderators

Brandan,

The problem is that the labels in the child GUI are overlapping the inputs - in that case when you click on the overlapping part AutoIt does not know which control you are trying to action and so it actions neither. You can show this by clicking on the centre or extreme right of the child GUI inputs - this selects them immediately - where as clicking on the extreme left does not. ;)

Just change the width of the first child GUI label to 110 and the inputs then work across their whole width. :)

M23

P.S. You do realise you have the same names for the inputs in the main and child GUIs? That could pose problems when you try to read them. ;)

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

 

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...