Sign in to follow this  
Followers 0
crystalburner

Guictrlcreateinput and tabs

7 posts in this topic

Hi :)

I've got a gui thats 640x480 and needs to hold a few hundred guictrlcreateinputs. To get around the problem i've designed the gui to use tabs.

This all works fine and I can put say 10 guictrlcreateinput boxes on each tab and have 15 - 20 tabs no problem.

What I have noticed when I start to write code to do actions based on the input selected is that odd things are happening when I use more than 1 tab.

Using AutoIT Window info I can see the issue.

The tabs, don't seem to separate the inputboxes and if on each tab I have an input box at co-ords 20,20 size 120,20 called Edit1 and Edit2 (on tab one and tab 2 respectively)

AutoIT windowinfo shows Edit2 as the control name on both tabs.

Its almost like the tabs dont separate the inputboxes into 2 guis - its like the tabs have been created on 1 gui on top of each other.

Visually it all looks fine, its just when you start trying to control it.

Does this make sense?

Share this post


Link to post
Share on other sites



Just an update to this,

I'm creating these inputs like this

$name1=guictrlcreateinput...........
$name2=guictrlcreateinput...........

and to get the name of the current input im using this

Local $aGUICtrls = ControlGetFocus($main)

This gets the "Edit1", "Edit2" name

If I could get the actual control name $name1 or $name2 it wouldnt be an issue, but I can't work that out!

Share this post


Link to post
Share on other sites

Can you not see which tab is active by using

$ActiveTab = GuiCtrlRead($Tab1)

Switch $ActiveTab
        
        Case 0
        ;first tab is active
        Case 1
        ;second tab is active
        Case 2
        ;third tab is active
Endswitch

Why can t you use the $name?

If you had 10 inputs per tab and tab 1 was active you would know that it was $names 1 to 10 you were looking at

Or call them better variable names like $Tab1Name1, $Tab1Name2

Share this post


Link to post
Share on other sites

Dude! Whats up :)

Hope u played the fly song to all the family !

Nah, I create them like this

$totalinputs=iniread(@scriptdir & '\myini.ini','Settings','Totalinputs','')
Dim $q[$totalinputs]

for $i = 1 to $totalinputs
   $q[$i] = guictrlcreateinput('',xxx,xxx,xxx,xxx); The x's come from another iniread
next

I'm using a GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")

In the Gui to detect key presses and then in the func that is called I need to know the controlID of the inputbox I have and then I jump to another input box based on that. I was using the name "Edit1" Edit2 etc but as you see above, something is a bit screwed with AutoIT and tabs and so the only other choice I have is to get the inputbox name (controlID).

Share this post


Link to post
Share on other sites

That is im not looking for the tab index i want the controlID where the cursor is

i.e.

$q[5] for input box 5

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

That is im not looking for the tab index i want the controlID where the cursor is

i.e.

$q[5] for input box 5

Maybe...

GUIGetCursorInfo ( [winhandle] )

Parameters

winhandle [optional] The handle of the window to use. If omitted the "current" window will be used.

Return Value

Success: returns a five-element array that containing the mouse cursor information:

$array[0] = X coord (horizontal)

$array[1] = Y coord (vertical)

$array[2] = Primary down (1 if pressed, 0 if not pressed)

$array[3] = Secondary down (1 if pressed, 0 if not pressed)

$array[4] = ID of the control that the mouse cursor is hovering over (or 0 if none)

Failure: 0 and set @error to 1

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Thanks but tried that

Only any good if the mouse is in or over the box otherwise you get the control ID of soemthing else or an error :)

You would think this would be easy wouldn't you, perhaps i've stumbled across the next AutoIT beta update?

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