Jump to content

How to deal with TAB ?


friends
 Share

Recommended Posts

well..... this is my very first time to create using TAB.

Some of the things I have no idea how to make it.

Below code (can be executed), there are few tabs,

which are EJournal, Downloadlog, CommAgent & Others.

The input I created in EJournal tab, also shows at other

tabs.... how can I make it only available in EJournal tab ?

Please help me with the code....

sorry cos my code may looks ugly and have many bugs.

Please correct me if there is/are many mistakes !

Big thanks.......

#include <GUIconstants.au3>


GuiCreate(":: PandaTools :: MIS Utilities v1.0", 380, 570)

# --------------------
#  Drop-down Calendar
# --------------------

GUISetControl( "group", "Date", 65, 10, 240, 55)
GUISetControl( "date", "", 84, 31, 200, 22)
;GUISetControlEx(-1,0,0,"",0xff); set text in red


; start creation of a tab control
GUISetControl("tab", "", 20, 80, 340, 460)
GuiSetControlFont(-1,10,700)        ; to display tab names in bold


# --------------
#  EJournal Tab 
# --------------

; define first tab name
GUISetControl("tabitem", "E-Journal", 1, 60)
GUISetControlEx(-1,0,0,"",0xff)

$font = "Arial"
GUISetControl ("Label", ":: EJournal Viewer v1.2 ::", 74, 140, 228, 25, 0x1000)
GUISetControlFont (-1, 14, 800, $font)

$font = "Arial"
GUISetControl("label", "Select one of the options below :", 80, 200, 210, 15)
GUISetControlFont (-1, 10, 800, $font)
GUISetControlEx(-1,0,0,"",0)

$font = "Arial"
GUISetControl( "group", "Options", 70, 230, 240, 130)
GUISetControlFont (-1, 10, 800, $font)
GUISetGroup()


; Create Radio Buttons
$CurrentRadio = GUISetControl ("radio", " &Current Date EJournal", 90, 260, 165, 20)
GUISetControlFont (-1, 10, 800, $font)

; Create Radio Buttons
$PreviousRadio = GUISetControl ("radio", " &Previous Date EJournal", 90, 290, 170, 20)
GUISetControlFont (-1, 10, 800, $font)

; Create Radio Buttons
$PreviousMonthRadio = GUISetControl ("radio", " Previous &Month EJournal", 90, 320, 180, 20)
GUISetControlFont (-1, 10, 800, $font)


# -----------------
#  Downloadlog Tab 
# -----------------

; define second tab name
$test = GUISetControl("tabitem", "Downloadlog", 1, 60)

$font = "Arial"
GUISetControl ("Label", ":: Downloadlog Viewer v1.0 ::", 56, 140, 265, 25, 0x1000)
GUISetControlFont (-1, 14, 800, $font)


# ---------------
#  CommAgent Tab 
# ---------------

; define third tab name
GUISetControl("tabitem", "CommAgent", 1, 60)

$font = "Arial"
GUISetControl ("Label", ":: Commagnt Viewer v1.0 ::", 65, 140, 245, 25, 0x1000)
GUISetControlFont (-1, 14, 800, $font)


# -----------
#  Other Tab 
# -----------

; define fourth tab name
    GUISetControl("tabitem", "Other", 1, 60)

; end tab definition
GUISetControl("tabitem", "",0,0)


# --------------
#  Main Process
# --------------

GuiShow()

WHILE 1
   $msg = GUIMsg()
   
   SELECT
      CASE $msg = -3;dialog box being closed
           TrayTip(":: PandaTools ::", "Closing program...", 3, 1)
           Sleep (1800)
           Exit
  
      CASE $msg = $CurrentRadio
           CurrentEjournal()

      CASE $msg = $PreviousRadio
          ;PreviousEJournal()

      CASE $msg = $PreviousMonthRadio
          ;PreviousMonthEJournal()
   ENDSELECT
WEND

GuiWaitClose()


# ---------------------------
#  User Function Declaration
# ---------------------------


Func CurrentEJournal()
     GUISetControlEx ($PreviousRadio, $GUI_DISABLE)
     GUISetControlEx ($PreviousMonthRadio, $GUI_DISABLE) 
     CurrentDateInput()

EndFunc


Func CurrentDateInput()
     $font = "Arial"
     GUISetControl ("label", "POS Counter", 70, 385, 85, 16)
     GUISetControlFont (-1, 10, 800, $font)

     $font = "Arial"
     $POS = GUISetControl ("input", "", 160, 380, 70, 25)
     GUISetControlFont (-1, 12, 800, $font)
     GuiSetControlEx (-1, 256, "", "Eg. 1001", 4)  ; Get Focus at input box

     $font = "Arial"
     $test = GUISetControl ("input", "", 160, 450, 70, 25)
     GUISetControlFont (-1, 10, 800, $font)

     $test = GUISetControl ("button", "View Now", 70, 450, 85, 16)
     GUISetControlEx ($test, $GUI_DEFBUTTON)


    ;IF (GUIRead($POS) = "") THEN
    ;   MsgBox (4112, "", "You didn't enter POS number")
    ;   GUIDelete()
    ;ENDIF
EndFunc
Edited by friends
Link to comment
Share on other sites

Looks great to me!  Make sure you are using the newest AutoIt3.exe because older versions probably bugs with tab controls....

<{POST_SNAPBACK}>

Hi CyberSlug... I'm using the latest version of v.103 !

Did you test run the program ?

Cos... I tested myself, when you click "Current Date EJournal", the

input will show up. Now, when you click on other tabs, like Downloadlog tab

or CommAgent tab, the input also show up there. This shouldn't be the way

it meant to be.

So... how to make it only show in EJournal Tab ? :ph34r:

Link to comment
Share on other sites

Like this part:

#include <GUIconstants.au3>

GuiCreate(":: PandaTools :: MIS Utilities v1.0", 380, 570)

; start creation of a tab control
GUISetControl("tab", "", 20, 80, 340, 460)
GuiSetControlFont(-1,10,700)       ; to display tab names in bold

# --------------
#  EJournal Tab
# --------------
; define first tab name
GUISetControl("tabitem", "E-Journal", 1, 60)
GUISetControlEx(-1,0,0,"",0xff)

# --------------------
#  Drop-down Calendar
# --------------------
GUISetControl( "group", "Date", 65, 10, 240, 55)
GUISetControl( "date", "", 84, 31, 200, 22)

$font = "Arial"
GUISetControl ("Label", ":: EJournal Viewer v1.2 ::", 74, 140, 228, 25, 0x1000)
GUISetControlFont (-1, 14, 800, $font)

;...
Link to comment
Share on other sites

See attached image..... newest version of AutoIt under Windows XP Pro sp1

Is that how is it supposed to look or not?

17 Oct 04: I thought I'd remove the attachment to free up some server space.

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!
Link to comment
Share on other sites

See attached image..... newest version of AutoIt under Windows XP Pro sp1

Is that how is it supposed to look or not?

<{POST_SNAPBACK}>

Yes... that is how it should look before select "Current Date EJournal".

Here how it shows after you click "Current Date EJournal"... see the

attached image.

I wonder how to fix this "bug".....

Link to comment
Share on other sites

I don't see any POS input when I click that ... maybe I'm missing GUIconstants.au3 ..... Anyway, I understand what you want :ph34r:

It you create the POS input box after the tab control, then it will show on all tabs. What you need to do is create those controls before GUISetControl("tabitem", "Downloadlog", 1, 60)

Create the controls with the $GUI_HIDE style, and then simply unhide the contorol when you need it.

#cs - ### Generated by AutoBuilder 0.4 -- do not modify ###
394 278
0   0   1   0   0   1   0   0   0   1   0   0   0   0   1   0   
tab $tab_1  Tab 1   30  20  320 230 0   0   
tabitem $tabitem_1  Tabitem 1   0   0   0   0   0   0   
checkbox    $checkbox_1 Checkbox 1  70  70  150 40  0   0   
edit    $edit_1 Edit 1  90  150 160 60  0   0   
tabitem $tabitem_2  Tabitem 2   0   0   0   0   0   0   
label   $label_1    Label 1 70  80  230 30  0   0   
tabitem     -99 -99 1   1   
#ce - ### End of Dump ###

;Script generated by AutoBuilder 0.4 -- but modified

Opt("GUINotifyMode", 1)
GuiCreate("Example...", 392,273,(@DesktopWidth-392)/2, (@DesktopHeight-273)/2 , 0x04CF0000)

$tab_1 = GUISetControl("tab", "Tab 1", 30, 20, 320, 230)
$tabitem_1 = GUISetControl("tabitem", "Tabitem 1", 0, 0, 0, 0)
    $checkbox_1 = GUISetControl("checkbox", "Show Edit control...", 70, 70, 150, 40)
    $edit_1 = GUISetControl("edit", "Can you see me?", 90, 150, 160, 60)
   GUISetControlEx($edit_1, 32);GUI_HIDE attrib.
$tabitem_2 = GUISetControl("tabitem", "Tabitem 2", 0, 0, 0, 0)
    $label_1 = GUISetControl("label", "Nothing to see here.  Move along.", 70, 80, 230, 30)
$tab_close = GUISetControl("tabitem","",-99,-99,1,1) ;close tab

GuiShow()
While 1
    sleep(100)
    $msg = GuiMsg(0)
    Select
    Case $msg = -3
      Exit
    Case $msg = $checkbox_1
      If GuiRead($checkbox_1) = 1 Then
         GUISetControlEx($edit_1, 16);GUI_SHOW
      Else
         GUISetControlEx($edit_1, 32);GUI_HIDE
      EndIf
   EndSelect
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!
Link to comment
Share on other sites

Phew.... finally you get what I meant ! :lol:

That is what I want for the example you've shown below ! :(

You've given me a big help..... very appreciated ! :ph34r:

I'll catch you if I have other questions on this !

I don't see any POS input when I click that ... maybe I'm missing GUIconstants.au3 .....  Anyway, I understand what you want :lol:

It you create the POS input box after the tab control, then it will show on all tabs.  What you need to do is create those controls before GUISetControl("tabitem", "Downloadlog", 1, 60)

Create the controls with the $GUI_HIDE style, and then simply unhide the contorol when you need it.

#cs - ### Generated by AutoBuilder 0.4 -- do not modify ###
394    278
0    0    1    0    0    1    0    0    0    1    0    0    0    0    1    0    
tab    $tab_1    Tab 1    30    20    320    230    0    0    
tabitem    $tabitem_1    Tabitem 1    0    0    0    0    0    0    
checkbox    $checkbox_1    Checkbox 1    70    70    150    40    0    0    
edit    $edit_1    Edit 1    90    150    160    60    0    0    
tabitem    $tabitem_2    Tabitem 2    0    0    0    0    0    0    
label    $label_1    Label 1    70    80    230    30    0    0    
tabitem        -99    -99    1    1    
#ce - ### End of Dump ###

;Script generated by AutoBuilder 0.4 -- but modified

Opt("GUINotifyMode", 1)
GuiCreate("Example...", 392,273,(@DesktopWidth-392)/2, (@DesktopHeight-273)/2 , 0x04CF0000)

$tab_1 = GUISetControl("tab", "Tab 1", 30, 20, 320, 230)
$tabitem_1 = GUISetControl("tabitem", "Tabitem 1", 0, 0, 0, 0)
    $checkbox_1 = GUISetControl("checkbox", "Show Edit control...", 70, 70, 150, 40)
    $edit_1 = GUISetControl("edit", "Can you see me?", 90, 150, 160, 60)
   GUISetControlEx($edit_1, 32);GUI_HIDE attrib.
$tabitem_2 = GUISetControl("tabitem", "Tabitem 2", 0, 0, 0, 0)
    $label_1 = GUISetControl("label", "Nothing to see here.  Move along.", 70, 80, 230, 30)
$tab_close = GUISetControl("tabitem","",-99,-99,1,1);close tab

GuiShow()
While 1
    sleep(100)
    $msg = GuiMsg(0)
    Select
    Case $msg = -3
      Exit
    Case $msg = $checkbox_1
      If GuiRead($checkbox_1) = 1 Then
         GUISetControlEx($edit_1, 16);GUI_SHOW
      Else
         GUISetControlEx($edit_1, 32);GUI_HIDE
      EndIf
   EndSelect
WEnd

<{POST_SNAPBACK}>

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