Jump to content

Recommended Posts

Posted

Hi there.

Here's the scenario:

I've created 2 Tab items, where one is "Tab 1" and "Tab 2".

Each of these tabs have their own input fields.

Is it possible that when I click on "Tab 2", the "Tab 1" will become

"Lost Focus" until task in "Tab 2" is completed ?

Hope my explanation is clear. Any idea ?

Please show me a simple example.... TQ

Posted (edited)

I'll work on some Tab control wrapper functions.... Maybe something like this will work in the meantime?

$GUI = GuiCreate("Example")
$tab = GuiCtrlCreateTab(10, 10, 400, 200)
$zero = GuiCtrlCreateTabItem("Zero")
   $input0 = GuiCtrlCreateInput("When you click on Tab One, you must complete it...",50, 50, 300, 20)
$one = GuiCtrlCreateTabItem("One")
   $input1 = GuiCtrlCreateInput("",30, 50, 100, 20)
   $input2 = GuiCtrlCreateInput("",30, 150, 100, 20)
GuiCtrlCreateTabItem("")

GuiSetState()
While 1
   $msg = GuiGetMsg()
   If $msg = -3 Then Exit;GUI_EVENT_CLOSE
      
   If $msg = $tab Then
      $tabitem = GuiRead($tab)
     ;;; if user clicks on tab zero before all inputboxes on tab one are complete, then...
      If $tabitem = 0 And (GuiRead($input1) = "" Or GuiRead($input2) = "") Then
         ControlCommand($GUI,"","SysTabControl321","TabRight")
      EndIf
   EndIf
WEnd
Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

All tabs are active in memory. No information or anything is lost. You can even disable buttons or even the whole gui to keep a current process running without interruption. The computer sees all the tabs, like as if they where one.

Posted

I don't really understand the question.

Today the TCN_SELCHANGE lead to a notification thru the message pump.

so the script can take action on the click

the following code is working

#include "GUIConstants.au3"

; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------

;Test script to try and get a list box information updated
;by clicking on a button
GUICreate("My GUI TAB"); will create a dialog box that when displayed is centered
GuiSetBkColor (0x00E0FFFF)
GUISetFont(9, 300)

$tab=GuiCtrlCreateTab ( 10,10, 200,100)
GuiCtrlSetBkColor (-1,0x20)

$tab0=GuiCtrlCreateTabitem ("tab0")
GuiCtrlCreateLabel ("label0", 30,80,50,20)
$tab0OK=GuiCtrlCreateButton ("OK0", 20,50,50,20)
$tab0input=GuiCtrlCreateInput ("default", 80,50,70,20)

$tab1=GuiCtrlCreateTabitem ("tab----1")
GuiCtrlCreateLabel ("label1", 30,80,50,20)
GuiCtrlSetBkColor (-1,0xff)
$tab1combo=GuiCtrlCreateCombo ("", 20,50,60,40)
GuiCtrlSetData (-1,"Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon
$tab1OK=GuiCtrlCreateButton ("OK1", 80,50,50,20)

$tab2=GuiCtrlCreateTabitem ("tab2")
GuiCtrlSetState (-1,$GUI_SHOW)
GuiCtrlCreateLabel ("label2", 30,80,50,20)
$tab2OK=GuiCtrlCreateButton ("OK2", 140,50,50)
GuiCtrlCreateTabitem ("")

GuiCtrlCreateLabel ("label3", 20,130,50,20)
GuiCtrlSetBkColor (-1,0xff)
GuiSetState()

; Run the GUI until the dialog is closed or timeout
$start=TimerInit()
Do
$msg = GUIGetMsg()
if $msg > 0 then
   $start=TimerInit()
    if $msg= $tab then
        msgbox(0,"Click tab#",GuiRead($tab),2)
    else
        msgbox(0,"Click #",$msg,2)
    endif
endif
Until $msg = -3 OR TimerDiff($start)>=3000

msgbox(0,"exit #",GuiRead($tab1combo),2)
Posted

thanks for the feedback and examples. I'll try it out...

and, some of your discussion about the TAB thingy...

sorry cos I don't really get it. :">

Anyway, thanks....

Posted

I don't really understand the question.

Today the TCN_SELCHANGE  lead to a notification thru the message pump.

I wasn't being clear... sorry.

I mean in an AutoIt script, if I call GuiSendMsg($ref, $TCM_SETCURSEL, $index, 0) then any controls nested on a tab control are not updated because that GuiSendMsg does not lead to a notification (it's a Win32 API feature) .....

So how would I GuiSendMsg the correct notification in an AutoIt script?

GuiCreate("Example")
$send = GuiCtrlCreateButton("GuiSendMsg....", 10, 250, 100, 50)
$tab = GuiCtrlCreateTab(10, 10, 300, 200)
GuiCtrlCreateTabItem("Zero")
   GuiCtrlCreateButton("This button is on tab #zero", 50, 50, 200, 100)
GuiCtrlCreateTabItem("One")
   GuiCtrlCreateButton("This button is on tab #one", 100, 100, 200, 100)
GuiCtrlCreateTabItem("")

GuiSetState()
While 1
   $msg = GuiGetMsg()
   If $msg = -3 Then Exit
   If $msg = $send Then GuiSendMsg($tab, 0x130C, 1, 0);$TCM_SETCURSEL
WEnd
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

If there is code inside AutoIt v3 that depends on TCN_SELCHANGE then you will not be able to invoke TCN_SELCHANGE due to "struct" dependability. Perhaps a ControlCommand could be changed to send the WM_NOTIFY +  TCN_SELCHANGE message...

Lar.

<{POST_SNAPBACK}>

I did a one line addition in the actual code to have the following script working.

I Upload it to Jon. I put it in my upload area for testing

GuiCreate("Example")
$send = GuiCtrlCreateButton("GuiSendMsg....", 10, 250, 100, 50)
$tab = GuiCtrlCreateTab(10, 10, 300, 200)
GuiCtrlCreateTabItem("Zero")
  GuiCtrlCreateButton("This button is on tab #zero", 50, 50, 200, 100)
$tab1=GuiCtrlCreateTabItem("One")
GuiCtrlCreateButton("This button is on tab #one", 100, 100, 200, 100)
GuiCtrlCreateTabItem("")

GuiSetState()
While 1
  $msg = GuiGetMsg()
  If $msg = -3 Then Exit
  If $msg = $send Then GuiCtrlSetState($tab1,$GUI_SHOW)
WEnd

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...