Jump to content

_GUICtrlTab_InsertItem


Recommended Posts

Hello, how to add GuictrlcreateInput in tab created with _GUICtrlTab_InsertItem?

I created input bellow InsertItem and its not in tab...

How to fix this?

#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>

$Form1 = GUICreate("Form1", 633, 447, 193, 125)
$Tab1 = GUICtrlCreateTab(16, 32, 585, 385)
GUICtrlCreateTabItem("Default")
$Input1 = GUICtrlCreateInput("", 24, 140, 569, 21)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)

GUICtrlCreateTabItem("Default")
$Input1 = GUICtrlCreateInput("", 24, 120, 569, 21)
GUICtrlCreateTabItem("")
_GUICtrlTab_InsertItem($Tab1,2,"asd")
$Input1 = GUICtrlCreateInput("", 24, 100, 569, 21)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

n3nE

Try this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
#include <GuiEdit.au3>

Global Const $SW_HIDE = 0
Global Const $SW_SHOW = 5

$Form1 = GUICreate("Form1", 633, 447, 193, 125)

$Tab1 = GUICtrlCreateTab(16, 32, 585, 385)

GUICtrlCreateTabItem("Tab1")
$Input1 = GUICtrlCreateInput("Tab input1", 24, 140, 569, 21)

GUICtrlCreateTabItem("Tab2")
$Input2 = GUICtrlCreateInput("Tab input2", 24, 120, 569, 21)
GUICtrlCreateTabItem("")

_GUICtrlTab_InsertItem($Tab1, 2, "Inserted Tab")
$Input3 = _GUICtrlEdit_Create($Form1, "Tab input3", 24, 100, 569, 21, $ES_AUTOHSCROLL)
DllCall("User32.dll", "int", "ShowWindow", "hwnd", $Input3, "int", $SW_HIDE)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    Local $tNMHDR, $IDFrom, $iCode
    
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $IDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    
    Switch $IDFrom
        Case $Tab1
            Switch $iCode
                Case $TCN_SELCHANGE
                    $iCurSel = _GUICtrlTab_GetCurSel(GUICtrlGetHandle($Tab1))
                    If $iCurSel = 2 Then
                        DllCall("User32.dll", "int", "ShowWindow", "hwnd", $Input3, "int", $SW_SHOW)
                    Else
                        DllCall("User32.dll", "int", "ShowWindow", "hwnd", $Input3, "int", $SW_HIDE)
                    EndIf
            EndSwitch
    EndSwitch
    
    Return $GUI_RUNDEFMSG
EndFunc
Link to comment
Share on other sites

Or just to made with this command GUICtrlCreateTabItem but to be in background tab - not focused if is possible;D

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

I just want to add new tab but not focused... for example, if we have tab 1, i want to add tab 2 but tab 1 to be focused, are you understand now? muttley

Sorry for bad english, i don't know how to explain ;/

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

This?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
#include <GuiEdit.au3>
#include <WinAPI.au3>

Global Const $SW_HIDE = 0
Global Const $SW_SHOW = 5

$Form1 = GUICreate("Form1", 633, 447, 193, 125)

$Tab1 = GUICtrlCreateTab(16, 32, 585, 385)

GUICtrlCreateTabItem("Tab1")
$Input1 = GUICtrlCreateInput("Tab input1", 24, 140, 569, 21)

GUICtrlCreateTabItem("Tab2")
$Input2 = GUICtrlCreateInput("Tab input2", 24, 120, 569, 21)
GUICtrlCreateTabItem("")

_GUICtrlTab_InsertItem($Tab1, 2, "Inserted Tab")
$Input3 = _GUICtrlEdit_Create($Form1, "Tab input3", 24, 100, 569, 21, $ES_AUTOHSCROLL)
DllCall("User32.dll", "int", "ShowWindow", "hwnd", $Input3, "int", $SW_HIDE)

$Add_Button = GUICtrlCreateButton("Add", 16, 420, 75, 23)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Add_Button
            $Index = _GUICtrlTab_GetItemCount($Tab1)
            _GUICtrlTab_InsertItem($Tab1, $Index + 1, "Inserted Tab")
            _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_INVALIDATE)
    EndSwitch
WEnd

Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    Local $tNMHDR, $IDFrom, $iCode
    
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $IDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    
    Switch $IDFrom
        Case $Tab1
            Switch $iCode
                Case $TCN_SELCHANGE
                    $iCurSel = _GUICtrlTab_GetCurSel(GUICtrlGetHandle($Tab1))
                    If $iCurSel = 2 Then
                        _WinAPI_ShowWindow($Input3, $SW_SHOW)
                    Else
                        _WinAPI_ShowWindow($Input3, $SW_HIDE)
                    EndIf
            EndSwitch
    EndSwitch
    
    Return $GUI_RUNDEFMSG
EndFunc
Link to comment
Share on other sites

something like this maybe?

#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
$Form1 = GUICreate("Form1", 633, 447, 193, 125)
$Tab1 = GUICtrlCreateTab(16, 32, 585, 385)
$tabA = GUICtrlCreateTabItem("Default")
$Input1 = GUICtrlCreateInput("", 24, 140, 569, 21)
$tab2 = GUICtrlCreateTabItem("Default")
$Input2 = GUICtrlCreateInput("", 24, 120, 569, 21)
$tab3 = GUICtrlCreateTabItem("asd")
$Input3 = GUICtrlCreateInput("", 24, 100, 569, 21)
GUISetState(@SW_SHOW)
_GUICtrlTab_SetCurFocus($Tab1, 2)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

[font="Century Gothic"]quisnam est quantum stultus , balatro vel balatro quisnam insistovolubilis in solum rideo risi risum----------------------------------------------------------------------------------------------------------------------------Portable Command Line Tool[/font]

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