Jump to content

Tab Item problems


Recommended Posts

I am having multiple issues with tab items. I have created a form with multi Tabs. Each Tab has several controls but I do not need input from any of the controls. The controls are there for illustration only. What I need to happen is for an action to happen when a user clicks in specific areas not on the controls themselves.

For example on Tab 1 there are several address fields when the user clicks on or near any of the input fields I want it to open another form giving information about the address section.

Some of the other Tabs have groups on them I want it to pull up the other form giving the information when they click anywhere in the group.

I have tried to create buttons on top of the large areas that I want to be clickable. But I have problems with the input fields bleeding through and not allowing clicks.

I have also had buttons on the other tabs bleed through and not allow clicks in all or part of the large buttons. The deeper buttons do not show but you cannot click where they overlap.

I tried Guiswitch to set the buttons but it did not work for me. I found a function and burrowed it, that will allow the buttons to be transparent or semi transparent that I will include with the code that could be adding to the issues.

I thought about creating a "Hot" area that will allow clicks but I am not experienced enough to accomplish and I have not found any examples of.

Please Help Thanks.

CODE
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_outfile=Office Manager.exe

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <StaticConstants.au3>

#include <EditConstants.au3>

#include <ButtonConstants.au3>

#include <GuiToolbar.au3>

#include <ToolbarConstants.au3>

#Include <WinAPI.au3>

#include <ComboConstants.au3>

#include <TabConstants.au3>

;Opt("GuiResizeMode", 802)

Global Const $WM_ENTERSIZEMOVE = 0x0231

Global Const $WM_EXITSIZEMOVE = 0x0232

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Configure", 579, 425,193,125)

$Config = GUICtrlCreateTab(6, 8, 568, 349)

GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$TabSheet1 = GUICtrlCreateTabItem("Address Information")

$Label1 = GUICtrlCreateLabel("Name Line 1:", 19, 46, 66, 18)

$Label2 = GUICtrlCreateLabel("Company Name", 106, 46, 81, 18)

$Label3 = GUICtrlCreateLabel("Name Line 2:", 19, 79, 66, 18)

$Label4 = GUICtrlCreateLabel("Address Line 1:", 19, 112, 81, 18)

$Input1 = GUICtrlCreateInput("", 109, 73, 319, 22,$ES_READONLY)

$Label5 = GUICtrlCreateLabel("Address Line 2:", 19, 145, 81, 18)

$Label6 = GUICtrlCreateLabel("City, State, Zip:", 19, 178, 77, 18)

$Label7 = GUICtrlCreateLabel("ID no.:", 19, 211, 60, 18)

$Label8 = GUICtrlCreateLabel("Phone no.:", 19, 244, 55, 18)

$Label9 = GUICtrlCreateLabel("FAX no.:", 19, 283, 46, 18)

$Input2 = GUICtrlCreateInput("", 109, 109, 253, 22,$ES_READONLY)

$Input3 = GUICtrlCreateInput("", 109, 142, 253, 22,$ES_READONLY)

$Input4 = GUICtrlCreateInput("", 109, 172, 253, 22,$ES_READONLY)

$Input5 = GUICtrlCreateInput("", 109, 205, 118, 22,$ES_READONLY)

$Input6 = GUICtrlCreateInput("", 109, 238, 118, 22,$ES_READONLY)

$Input7 = GUICtrlCreateInput("", 109, 277, 118, 22,$ES_READONLY)

GUISwitch($Form1,$Tabsheet1)

$Button9 = GUICtrlCreateButton("", 94, 64, 348, 238)

_GuiCtrlMakeTrans($Button9,1)

GUICtrlCreateTabItem("")

$TabSheet2 = GUICtrlCreateTabItem("Options")

$Group1 = GUICtrlCreateGroup("Group1 options", 25, 47, 389, 129)

$Label10 = GUICtrlCreateLabel("This option is used .... ", 37, 67, 344, 18)

$Checkbox1 = GUICtrlCreateCheckbox("Require...", 40, 109, 139, 17)

$Radio1 = GUICtrlCreateRadio("Radio 1", 61, 130, 281, 17)

$Radio2 = GUICtrlCreateRadio("Radio 2", 61, 151, 260, 17)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup("Invoice options", 25, 178, 389, 81)

$Checkbox2 = GUICtrlCreateCheckbox("Generate invoice", 40, 196, 205, 17)

$Radio3 = GUICtrlCreateRadio("Append", 58, 217, 311, 17)

$Radio4 = GUICtrlCreateRadio("Override", 58, 238, 299, 17)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group3 = GUICtrlCreateGroup("information", 25, 265, 389, 42)

$Checkbox3 = GUICtrlCreateCheckbox("Automatically display information ", 40, 282, 373, 17)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Button11 = GUICtrlCreateButton("Button10", 13, 43, 420, 133, 0)

_GuiCtrlMakeTrans($Button11,1)

$Button12 = GUICtrlCreateButton("Button12", 14, 180, 351, 79, 0)

_GuiCtrlMakeTrans($Button12,1)

$Button13 = GUICtrlCreateButton("Button12", 17, 264, 408, 52, 0)

_GuiCtrlMakeTrans($Button13,1)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$TabSheet4 = GUICtrlCreateTabItem("Tab 4")

$Group4 = GUICtrlCreateGroup("group4", 37, 61, 446, 258)

$Label12 = GUICtrlCreateLabel("Select name:", 58, 85, 66, 18)

$Combo1 = GUICtrlCreateCombo("", 58, 106, 244, 25)

GUICtrlSetData(-1, "Stuff|Other Stuff|None")

$Button14 = GUICtrlCreateButton("Button14", 38, 61, 342, 79, 0)

_GuiCtrlMakeTrans($Button14,1)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$TabSheet5 = GUICtrlCreateTabItem("Tab5")

$Input8 = GUICtrlCreateInput("First ", 154, 88, 253, 22)

$Input9 = GUICtrlCreateInput("Second ", 154, 127, 253, 22)

$Input10 = GUICtrlCreateInput("Third ", 154, 166, 253, 22)

$Label13 = GUICtrlCreateLabel("Configure ", 169, 58, 224, 18)

$Button15 = GUICtrlCreateButton("Button15", 125, 52, 315, 151, 0)

_GuiCtrlMakeTrans($Button15,1)

$TabSheet6 = GUICtrlCreateTabItem("Tab6")

$Group5 = GUICtrlCreateGroup("Group5", 22, 61, 380, 114)

$Radio5 = GUICtrlCreateRadio("Both", 34, 88, 348, 17)

$Radio6 = GUICtrlCreateRadio("I only", 35, 115, 158, 17)

$Radio7 = GUICtrlCreateRadio("W only", 35, 139, 161, 17)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group6 = GUICtrlCreateGroup("Group6", 23, 202, 377, 87)

$Radio8 = GUICtrlCreateRadio("Radio 8", 36, 229, 305, 17)

$Radio9 = GUICtrlCreateRadio("Radio9", 36, 254, 305, 17)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Button16 = GUICtrlCreateButton("Button16", 20, 52, 393, 133, 0)

;_GuiCtrlMakeTrans($Button16,1)

$Button17 = GUICtrlCreateButton("Button17", 20, 205, 384, 82, 0)

;_GuiCtrlMakeTrans($Button17,1)

GUICtrlCreateTabItem("")

$Button1 = GUICtrlCreateButton("OK", 339, 361, 75, 25)

$Button2 = GUICtrlCreateButton("Cancel", 417, 361, 75, 25)

$Button3 = GUICtrlCreateButton("Help", 495, 361, 75, 25)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button9

MsgBox(0,"Help", "Button9 Clicked!")

Case $Button11

MsgBox(0,"Help", "Button11 Clicked!")

Case $Button12

MsgBox(0,"Help", "Button12 Clicked!")

Case $Button13

MsgBox(0,"Help", "Button13 Clicked!")

Case $Button14

MsgBox(0,"Help", "Button14 Clicked!")

Case $Button15

MsgBox(0,"Help", "Button15 Clicked!")

Case $Button16

MsgBox(0,"Help", "Button16 Clicked!")

Case $Button17

MsgBox(0,"Help", "Button17 Clicked!")

Case $Button1

Exit

EndSwitch

WEnd

Func _GuiCtrlMakeTrans($iCtrlID,$iTrans=255)

Local $pHwnd, $nHwnd, $aPos, $a

$hWnd = GUICtrlGetHandle($iCtrlID);Get the control handle

If $hWnd = 0 then Return SetError(1,1,0)

$pHwnd = DllCall("User32.dll", "hwnd", "GetParent", "hwnd", $hWnd);Get the parent Gui Handle

If $pHwnd[0] = 0 then Return SetError(1,2,0)

$aPos = ControlGetPos($pHwnd[0],"",$hWnd);Get the current pos of the control

If @error then Return SetError(1,3,0)

$nHwnd = GUICreate("", $aPos[2], $aPos[3], $aPos[0], $aPos[1], 0x80000000, 0x00080000 + 0x00000040, $pHwnd[0]);greate a gui in the position of the control

If $nHwnd = 0 then Return SetError(1,4,0)

$a = DllCall("User32.dll", "hwnd", "SetParent", "hwnd", $hWnd, "hwnd", $nHwnd);change the parent of the control to the new gui

If $a[0] = 0 then Return SetError(1,5,0)

If NOT ControlMove($nHwnd,'',$hWnd,0,0) then Return SetError(1,6,-1);Move the control to 0,0 of the newly created child gui

GUISetState(@SW_Show,$nHwnd);show the new child gui

WinSetTrans($nHwnd,"",$iTrans);set the transparency

If @error then Return SetError(1,7,0)

GUISwitch($pHwnd[0]);switch back to the parent Gui

Return $nHwnd;Return the handle for the new Child gui

EndFunc

Link to comment
Share on other sites

  • Moderators

kttenneb,

You might like to look at this thread where Malkey shows how to detect a click within a given area. I have used it successfully - albeit not quite in the way you wish.

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

 

Link to comment
Share on other sites

kttenneb,

You might like to look at this thread where Malkey shows how to detect a click within a given area. I have used it successfully - albeit not quite in the way you wish.

M23

Thanks Melba23 for the reply, I think what I need is when an Input box is clicked that an action happens and I have not figured out how to do that.

I want to click on the input box like a button, but it still needs to look like a input box.

Link to comment
Share on other sites

  • Moderators

kttenneb,

I want to click on the input box like a button, but it still needs to look like a input box.

Ah, now that is a different matter. Take a look at this:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

$hInput = GUICtrlCreateInput("", 10, 10, 200, 20)
$hLabel = GUICtrlCreateLabel("", 10, 50, 200, 20)
$hButton = GUICtrlCreateButton("Press", 10, 80, 80, 30)

GUISetState()

; Catch focus passing to $InputLDescrition
GUIRegisterMsg($WM_COMMAND, "ED_WM_COMMAND")

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

Func ED_WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg
    Local $iCode = BitShift($wParam, 16)
    Switch $lParam
        Case GUICtrlGetHandle($hInput)
            Switch $iCode
                Case $EN_SETFOCUS
                    GUICtrlSetData($hLabel, "Edit has focus")
                Case $EN_KILLFOCUS
                    GUICtrlSetData($hLabel, "Edit does not have focus")
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc  ;==>ED_WM_COMMAND

You can, of course, modify the ED_WM_COMMAND function to do what you want - but remember this (from the Help file for GUIRegisterMsg):

Warning: blocking of running user functions which executes window messages with commands such as "Msgbox()" can lead to unexpected behavior, the return to the system should be as fast as possible !!!

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

 

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