Jump to content

Recommended Posts

Posted (edited)
 
Hey
I would like to open the tabs only when you click on the sub-item "Endpoint" and this tab should appear once for the menu items ABS, FRET and LUM. Can someone help me?

 

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <MsgBoxConstants.au3>

#Region ### START Koda GUI section ### Form=
$Settings = GUICreate("Settings", 615, 438, 192, 124)
$mFile = GUICtrlCreateMenu("&File")
$mNew = GUICtrlCreateMenuItem("&New", $mFile)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$mOpen = GUICtrlCreateMenuItem("&Open", $mFile)
$mSave = GUICtrlCreateMenuItem("&Save", $mFile)
$mSaveas = GUICtrlCreateMenuItem("&Save as", $mFile, 1)
GUICtrlCreateMenuItem("", $mFile, 4)
$mExit = GUICtrlCreateMenuItem("&Exit", $mFile)
$mABS = GUICtrlCreateMenu("&ABS")
$mEndpoint_ABS = GUICtrlCreateMenuItem("&Endpoint", $mABS)
$mKinetic_ABS = GUICtrlCreateMenu("&Kinetic", $mABS)
$mWellScan_ABS = GUICtrlCreateMenu("&Well Scan", $mABS)
$mSpectrum_ABS = GUICtrlCreateMenu("&Spectrum", $mABS)
$mFRET = GUICtrlCreateMenu("&FRET")
$mEndpoint_FRET = GUICtrlCreateMenuItem("&Endpoint", $mFRET)
$mKinetic_FRET = GUICtrlCreateMenu("&Kinetic", $mFRET)
$mWellScan_FRET = GUICtrlCreateMenu("&Well Scan", $mFRET)
$mLUM = GUICtrlCreateMenu("&LUM")
$mEndpoint_LUM = GUICtrlCreateMenuItem("&Endpoint", $mLUM)
$mKinetic_LUM = GUICtrlCreateMenu("&Kinetic", $mLUM)
$mWellScan_LUM = GUICtrlCreateMenu("&Well Scan", $mLUM)
$mSpectrum_LUM = GUICtrlCreateMenu("&Spectrum", $mLUM)
$mFragezeichen = GUICtrlCreateMenu("&?")
$mHelp_Fragezeichen = GUICtrlCreateMenuItem("Help" & @TAB & "F1", $mFragezeichen)
$Button_Cancel = GUICtrlCreateButton("Cancel", 450, 370, 70, 20)
$Button_OK = GUICtrlCreateButton("OK", 530, 370, 70, 20)
GUICtrlSetState(-1, $GUI_FOCUS)
Local $idTab = GUICtrlCreateTab(0, 10, 620, 355)
                $wave = GUICtrlCreateTabItem("Wavelengths")
                $Label_NumberW = GUICtrlCreateLabel("Number of Wavelenghts:", 10, 40, 170, 20)
                $Input_Wavelenghts = GUICtrlCreateInput("", 150, 37, 70, 20)
                GUICtrlCreateUpdown($Input_Wavelenghts)
                $Label_Lm1 = GUICtrlCreateLabel("Lm1", 120, 70, 20, 20)
                $Input_Lm1 = GUICtrlCreateInput("", 150, 67, 70, 20)
                $Label_nm = GUICtrlCreateLabel("nm", 230, 70, 70, 20)
                Local $Pic_Spektrum = GUICtrlCreatePic("C:\Users\Admin\Pictures\Spektrum.jpg", 10, 100, 500, 150)
                $Button_700nm = GUICtrlCreateButton ("700 nm", 35, 210, 50, 20)
                GUICtrlSetBkColor(-1, 0xFF0000)
                $Button_650nm = GUICtrlCreateButton ("650 nm", 100, 210, 50, 20)
                GUICtrlSetBkColor(-1, 0xFFA500 )
                $Button_600nm = GUICtrlCreateButton ("600 nm", 165, 210, 50, 20)
                GUICtrlSetBkColor(-1, 0xFFFF00)
                $Button_550nm = GUICtrlCreateButton ("550 nm", 230, 210, 50, 20)
                GUICtrlSetBkColor(-1, 0x008000)
                $Button_500nm = GUICtrlCreateButton ("500 nm", 295, 210, 50, 20)
                GUICtrlSetBkColor(-1, 0x0000FF)
                $Button_450nm = GUICtrlCreateButton ("450 nm", 360, 210, 50, 20)
                GUICtrlSetBkColor(-1, 0x191970)
                GUICtrlSetColor(-2, 0xFFFFFF)
                $Button_400nm = GUICtrlCreateButton ("400 nm", 430, 210, 50, 20)
                GUICtrlSetBkColor(-1, 0xEE82EE)
                GUISetState(@SW_SHOW)
                GUICtrlCreateTabItem("Plate Type")
                $Label_NumberP = GUICtrlCreateLabel("Number of Plates:", 10, 40, 109, 20)
                $Input_NumberP = GUICtrlCreateInput("", 120, 37, 70, 20)
                GUICtrlCreateUpdown($Input_NumberP)
                $Group_Plate_Bottom = GUICtrlCreateGroup("", 5, 55, 230, 130)
                $Label_Plate_Bottom = GUICtrlCreateLabel ("Choose Platebottom:", 10, 70, 109, 20)
                $Radio_PlateAuswahl_U = GUICtrlCreateRadio ("96-U", 120, 70, 50, 20)
                $Radio_PlateAuswahl_V = GUICtrlCreateRadio ("96-V", 120, 100, 50, 20)
                $Radio_PlateAuswahl_F = GUICtrlCreateRadio ("96-F", 120, 130, 50, 20)
                $Radio_PlateAuswahl_C = GUICtrlCreateRadio ("96-C", 120, 160, 50, 20)
                $Group_Plate_Bottom = GUICtrlCreateGroup("", 5, 175, 230, 130)
                $Label_PlateMaterial = GUICtrlCreateLabel ("Plate material:", 10, 190, 109, 20)
                $Radio_highbinding = GUICtrlCreateRadio("high-binding", 120, 190, 100, 20)
                $Radio_normalbinding = GUICtrlCreateRadio("normal-binding", 120, 220, 100, 20)
                $Radio_notbinding = GUICtrlCreateRadio("not-binding", 120, 250, 100, 20)
                GUICtrlCreateTabItem("Read Area")
                $Checkbox_allWells = GUICtrlCreateCheckbox("Select All", 545, 45, 97, 17)
                Local $Pic_Wellplate = GUICtrlCreatePic("C:\Users\Admin\Pictures\Wellplatepic.jpg", 70, 60, 467, 300)
                $Button_A = GUICtrlCreateButton ("A->", 35, 110, 40, 20) ; AUSSTEHEND: einzelne Wells/Reihen/Spalten/Alles markieren
                $Button_B = GUICtrlCreateButton ("B->", 35, 155, 40, 20)
                $Button_C = GUICtrlCreateButton ("C->", 35, 200, 40, 20)
                $Button_D = GUICtrlCreateButton ("D->", 35, 245, 40, 20)
                $Button_E = GUICtrlCreateButton ("E->", 35, 290, 40, 20)
                $Button_F = GUICtrlCreateButton ("F->", 35, 335, 40, 20)
                $Button_1 = GUICtrlCreateButton ("1", 125, 45, 40, 20)
                $Button_2 = GUICtrlCreateButton ("2", 175, 45, 40, 20)
                $Button_3 = GUICtrlCreateButton ("3", 225, 45, 40, 20)
                $Button_4 = GUICtrlCreateButton ("4", 275, 45, 40, 20)
                $Button_5 = GUICtrlCreateButton ("5", 325, 45, 40, 20)
                $Button_6 = GUICtrlCreateButton ("6", 375, 45, 40, 20)
                $Button_7 = GUICtrlCreateButton ("7", 425, 45, 40, 20)
                $Button_8 = GUICtrlCreateButton ("8", 475, 45, 40, 20)
                GUICtrlCreateTabItem("PTM and Optics")
                GUICtrlCreateTabItem("Shake")
                $Label_Shake_Question = GUICtrlCreateLabel("Should the plate be shaken?", 10, 40, 145, 20)
                Local $Radio_Shake_Yes = GUICtrlCreateRadio("Yes", 170, 37, 70, 20)
                Local $Radio_Shake_No = GUICtrlCreateRadio("No", 250, 37, 70, 20)
                GUICtrlSetState($Radio_Shake_Yes, $GUI_CHECKED)
                $Label_Shakespeed = GUICtrlCreateLabel("Shaking speed:", 10, 70, 100, 20)
                $Input_Shakespeed = GUICtrlCreateInput("", 100, 65, 70, 20)
                GUICtrlCreateTabItem("More Settings")
                GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

 While 1
         global $nMsg = GUIGetMsg()
         Select
             Case $nMsg = $GUI_EVENT_CLOSE
                    Exit
             Case $nMsg = $Button_Cancel
                 Exit
             Case $nMsg = $mExit
                 Exit
            Case $nMsg = $mOpen
            FileOpenDialog(" Open some File...", @WindowsDir, "All(*.*)")
            Case $nMsg =  $Radio_Shake_No And BitAND(GUICtrlRead($Radio_Shake_No), $GUI_CHECKED) = $GUI_CHECKED
                GUICtrlSetState($Input_Shakespeed,$GUI_Disable)

            Case $nMsg = $Radio_Shake_Yes And BitAND(GUICtrlRead($Radio_Shake_Yes), $GUI_CHECKED) = $GUI_CHECKED
                GUICtrlSetState($Input_Shakespeed,$GUI_enable)

            Case $nMsg =  $mHelp_Fragezeichen
            Local $iMsgBoxAnswer
            $iMsgBoxAnswer = MsgBox(289, "Help", "Just ask Annika.")
         EndSelect
    WEnd

 

Edited by Jos
added codebox... please use <> next time.
  • AUTOLAB changed the title to Tabs in Menu
Posted
  On 8/23/2021 at 9:28 AM, AUTOLAB said:
Hey Jos, can you explain your comment in more detail?
Expand  

https://www.autoitscript.com/wiki/Forum_FAQ#How_can_I_post_.22code.22_on_the_forum_.3F

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

A few comments on your While Loop :

1- You should not declare variables inside a loop, declare it before (best practices)

2- Use Switch instead of Select, will easily allow you to have multiple ids in a single case

3- GUICtrlRead on radio and check boxes can only return 2 values (see help file).  No need to bitAnd the result.

Local $sFile

While True
  Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE, $Button_Cancel, $mExit
      Exit
    Case $mOpen
      $sFile = FileOpenDialog(" Open some File...", @WindowsDir, "All(*.*)")
    Case $Radio_Shake_No
      If GUICtrlRead($Radio_Shake_No) = $GUI_CHECKED Then GUICtrlSetState($Input_Shakespeed, $GUI_DISABLE)
    Case $Radio_Shake_Yes
      If GUICtrlRead($Radio_Shake_Yes) = $GUI_CHECKED Then GUICtrlSetState($Input_Shakespeed, $GUI_ENABLE)
    Case $mHelp_Fragezeichen
      MsgBox(289, "Help", "Just ask Annika.")
    Case $mEndpoint_ABS
      GUICtrlSetState($wave, $GUI_SHOW)
  EndSwitch
WEnd

 

Edited by Nine

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