Jump to content

RadioBox and TabSheets do not copy properly.


Marecz
 Share

Recommended Posts

 

Hello, i'm writing a little project for Automation Tests. The program have to choose radiobutton from tabs and add id to listview, after click RUN depending on list he making steps.

Program works almost fully but i have one obsticle that i can't reach.

After adding any choosen RadioBox (Text) to List View from TabSheet1, The choosen RadioBox from TabSheet2 adding to Listview with name of last from TabSheet1.

Any Idea ?

Local $Total = "[NAME:_cmdFunctionKey_10]"
Local $ProductID = "[NAME:TextBox]"
Local $Product02 = "102100"

Local $Bnote_100 = "[NAME:tbl_denoms@1@13]"

$idTSList = GUICtrlCreateListView ("ListView Steps                     ", 15, 30, 177, 323)

$idAdd = GUICtrlCreateButton("<", 200, 40, 33, 41)

$Tablica1 = GUICtrlCreateTab(240, 8, 401, 409)

;1s Tabs-------------------------------------------
$TabSheet1 = GUICtrlCreateTabItem("Common")
   ;1.1s Works in Tab 1-----------------------
      $idManAuth = GUICtrlCreateRadio("Manager Authorization", 264, 50, 145, 25)
               GUICtrlSetFont(-1, 8, 400, 0, "Arial")

      $idScanEAN = GUICtrlCreateRadio("Scan EAN", 264, 75, 145, 25)
               GUICtrlSetFont(-1, 8, 400, 0, "Arial")

      $idLogIn = GUICtrlCreateRadio("Log In", 264, 100, 145, 25)
               GUICtrlSetFont(-1, 8, 400, 0, "Arial")

      $idRazem = GUICtrlCreateRadio("Sum", 264,125, 145, 25)
               GUICtrlSetFont(-1, 8, 400, 0, "Arial")

      $idProduct_1 = GUICtrlCreateRadio("Scan Product 1", 264,150, 145, 25)
               GUICtrlSetFont(-1, 8, 400, 0, "Arial")

   ;1.1e -------------------------------------

$TabSheet2 = GUICtrlCreateTabItem("Nomination")

   ;1.2s Works in Tab 2-----------------------
        $idBNote_100 = GUICtrlCreateRadio("Money 100", 264, 50, 145, 25)
               GUICtrlSetFont(-1, 8, 400, 0, "Arial")
   ;1.2e -------------------------------------

$TabSheet3 = GUICtrlCreateTabItem("Special 2")

   ;1.3s Works in Tab 3-----------------------

   ;1.3e -------------------------------------

GUICtrlCreateTabItem("")
;1e-------------------------------------------------------

GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idAdd
                  ChoosenRadio()
        EndSwitch
    WEnd
    
;3s Choosen RadioBox option + adding to list -----------------------------
Func ChoosenRadio()

   If GUICtrlRead($idManAuth) = 1 Then
   $idCaption = ControlGetText("","",$idManAuth)
   GUICtrlCreateListViewItem($idCaption, $idTSList)

   ElseIf GUICtrlRead($idScanPLU) = 1 Then
   $idCaption = ControlGetText("","",$idScanPLU)
   GUICtrlCreateListViewItem($idCaption, $idTSList)

   ElseIf GUICtrlRead($idLogIn) = 1 Then
   $idCaption = ControlGetText("","",$idLogIN)
   GUICtrlCreateListViewItem($idCaption, $idTSList)

   ElseIf GUICtrlRead($idRazem) = 1 Then
   $idCaption = ControlGetText("","",$idRazem)
   GUICtrlCreateListViewItem($idCaption, $idTSList)

   ElseIf GUICtrlRead($idProduct_1) = 1 Then
   $idCaption = ControlGetText("","",$idProduct_1)
   GUICtrlCreateListViewItem($idCaption, $idTSList)

   ElseIf GUICtrlRead($idBNote_100) = 1 Then
   $idCaption = ControlGetText("","",$idBNote_100)
   GUICtrlCreateListViewItem($idCaption, $idTSList)

   EndIf
EndFunc
;3e -----------------------------------------------------------------------

Please feel thanks from me for any respond :) 

Link to comment
Share on other sites

  • Moderators

Marecz,

You need to clear the radio after creating the ListViewItem - at present, you are leaving it checked and as the code fires on the first tab radios before even examining the second.

M23

Edit: I see you found that yourself - bravo!

Edited by Melba23

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

Func ChoosenRadio()

   If GUICtrlRead($idManAuth) = 1 Then
   $idCaption = ControlGetText("","",$idManAuth)
   GUICtrlCreateListViewItem($idCaption, $idTSList)
   GUICtrlSetState ( $idManAuth, $GUI_UNCHECKED )       ; ADDED

You have found the solution yourself like Melba said. You could write a Func  / Loop to uncheck all radio buttons or just add the GuiCtrlSetState ( see my code, last line.) after every ( if ) / ( elseIf () )

Edited by pluto41
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...