Jump to content

Can't select my GUI Input for some reason


Recommended Posts

Hello there AutoIT'ers

I've tried to search this problem but can't seem to find any answer to it.

My current "custom" gui seem to be ignoring mouse click or something.

#include <WindowsConstants.au3>
Local $IP, $PORT

Func _InputBox()
   $input = GUICreate("Input Box IP", 200 , 120, -1, -1, BitOR($WS_POPUP, $WS_SYSMENU, $WS_MINIMIZEBOX))
   
   ;#### Black background ####
   GUICtrlCreateGraphic(0,0, 200 , 120)
   GUICtrlSetBkColor(-1, 0x000000)
   
   ;#### Slighly smaller grey background ####
   GUICtrlCreateGraphic(+1,+1, 200 -2, 120-2)
   GUICtrlSetBkColor(-1, 0xe2e2e2)
   
   ;#### Header border ####
   GUICtrlCreateGraphic(1,1, 200 -2, 21)
   GUICtrlSetBkColor(-1, 0x000000)
   ;#### Header ###
   GUICtrlCreateGraphic(1,1, 200 -2, 20)
   GUICtrlSetBkColor(-1,0xededed)
   GUISetFont(8, 550, 0, 'Tahoma')
   GUICtrlCreateLabel("Input Server Info Please - F2 to Exit", 5,4, -1, 15)
   GUICtrlSetColor(-1, 0xff8400)
   GUICtrlSetBkColor(-1, 0xededed)
   
   ;#### IP Label ####
   GUICtrlCreateLabel("IP: ", 5, 25, -1, 15)
   GUICtrlSetFont(-1, Default, 600)
   GUICtrlSetBkColor(-1, 0xe2e2e2)
   ;#### IP Input Box ####
   $IP = GUICtrlCreateInput(@IPAddress1, 5, 40, 150, 20)
   GUICtrlSetBkColor(-1, 0xececec)

   ;#### Port Label ####
   GUICtrlCreateLabel("Port: ", 5, 65, -1, 15)
   GUICtrlSetFont(-1, Default, 600)
   GUICtrlSetBkColor(-1, 0xe2e2e2)
   ;#### Port Input Box ####
   $PORT = GUICtrlCreateInput("1337", 5, 80, 150, 20)
   GUICtrlSetBkColor(-1, 0xececec)
   
   GUISetState()
EndFunc

When ever I want to click and edit any of these input fields nothing happens, and I will have to tab my way through it.

Anyone got an idea on how to fix this rather annoying problem?

 

Edit: A alternative method to fix this is making the input field before creating any Graphic boxes.
If anyone finds another method please let me know 

Edited by Qvintus
Link to comment
Share on other sites

They are overlapping with the first two Graphic controls so they steal the clicks.

As you can see in the remarks for the GUICtrlCreateGraphic in the helpfile:

 

Graphic control can be clicked so they should not overlap with other controls. If overlap is needed it is important to disable the graphic control : GuiCtrlSetState(-1,$GUI_DISABLE).

 

The next time you get this problem, try commenting out overlapping controls and you should quickly find where the problem is. If you're lucky you might even find a note in the helpfile explaning it, like it does here for GUICtrlCreateGraphic.

Edit:

Edit: A alternative method to fix this is making the input field before creating any Graphic boxes.

If anyone finds another method please let me know

Well, that is also a clue that there is something going on with the Graphic controls. Why didn't you move on from there to checking the helpfile and searching the forum? Edited by AdmiralAlkex
Link to comment
Share on other sites

They are overlapping with the first two Graphic controls so they steal the clicks.

As you can see in the remarks for the GUICtrlCreateGraphic in the helpfile:

 

 

The next time you get this problem, try commenting out overlapping controls and you should quickly find where the problem is. If you're lucky you might even find a note in the helpfile explaning it, like it does here for GUICtrlCreateGraphic.

Edit:

Well, that is also a clue that there is something going on with the Graphic controls. Why didn't you move on from there to checking the helpfile and searching the forum?

 

My apologies I hadn't thought of this, I will keep it in mind for later projects. I appreciate you mentioning it so it won't happen again. I will pay better attention to what I read in the help file from now on :sweating:   

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