Jump to content

Tab control problem


Recommended Posts

Hi Experts,

I really need you help on this one. I could not do a magic with tab control and having hard time figuring it out how to come up with the exact interface. I am currently working on an tab control that needs checkboxes, editboxes and entries inside each tab. I also check this tab wiki and still could not make a step.

My problems are:

1. Need to have an Array for checkboxes and editboxes inside in tab control. So that I will not add one by one in every entry that will be inputted in tab control.

2. Need to get the entries from excel and add in first column of each tab control. Same here, so that each entry will be saved at the excel and just extract them to a tab control.

3. Need to have line in each entry "vertical" and "horizontal" lines to divide entry in the tab control.

3. Need to have a scrollbar to fit all this information in a small interface.

I have my code below. Not really a code but a starting code rather.:>...

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("Form1", 1037, 719, 204, 117)
GUISetBkColor(0x38A7D2)
$dEmployeInfo = GUICtrlCreateGroup("Data Information", 16, 8, 281, 121)
$dEmpNbr = GUICtrlCreateLabel("Emp#:", 33, 35, 35, 17)
$dEmpNme = GUICtrlCreateLabel("Name:", 33, 59, 35, 17)
$dEmpPrs = GUICtrlCreateLabel("Process:", 24, 83, 45, 17)
$EmpNbrInput = GUICtrlCreateInput("111111", 72, 32, 217, 21)
GUICtrlSetState($EmpNbrInput, $GUI_Disable)
$EmpNmeInput = GUICtrlCreateInput(GetFullName(@UserName), 72, 56, 217, 21)
GUICtrlSetState($EmpNmeInput, $GUI_Disable)
$EmpPrsInput = GUICtrlCreateInput("First Stage", 72, 80, 217, 21)
GUICtrlSetState($EmpPrsInput, $GUI_Disable)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$AID = GUICtrlCreateLabel("AID:", 24, 136, 25, 17)
$Submit = GUICtrlCreateButton("Submit Report",  840, 672, 177, 33)
$Checkbox1 = GUICtrlCreateCheckbox("", 16, 659, 12, 17)
$Checkbox2 = GUICtrlCreateCheckbox("", 16, 677, 12, 17)
$LabelPrek = GUICtrlCreateLabel("I agree that I have checked all entries listed above.", 37, 660, 265, 17)
$LabelTS = GUICtrlCreateLabel("Accept with no issue.", 37, 679, 265, 17)
;~ Start tab here
$tFront = GUICtrlCreateTab(8, 190, 1010, 460)
GUICtrlCreateTabItem("Part I")
;~ Heading
$GroupElement = GUICtrlCreateGroup("", 16, 215, 73, 30)
$LabelElement = GUICtrlCreateLabel("ENTRY/s", 24, 225, 62, 17)
$GroupCheck = GUICtrlCreateGroup("", 200, 215, 73, 30)
$LabelCheck = GUICtrlCreateLabel("CHECK", 215, 225, 40, 17)
$GroupNA = GUICtrlCreateGroup("", 300, 215, 53, 30)
$LabelNA = GUICtrlCreateLabel("N/A", 315, 225, 20, 17)
$GroupNError = GUICtrlCreateGroup("", 375, 215, 80, 30)
$LabelNError = GUICtrlCreateLabel("NO ERROR", 385, 225, 60, 17)
$GroupWError = GUICtrlCreateGroup("", 475, 215, 95, 30)
$LabelWError = GUICtrlCreateLabel("WITH ERROR", 488, 225, 75, 17)
$GroupRemark = GUICtrlCreateGroup("", 775, 215, 95, 30)
$LabelRemark = GUICtrlCreateLabel("REMARKS", 788, 225, 75, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlCreateGroup("", -99, -99, 1, 1)
;~ Tab1 checkboxes
$CboxCheck = GUICtrlCreateCheckbox("", 230, 250, 15, 20)
$CboxNA = GUICtrlCreateCheckbox("", 320, 250, 15, 20)
$CboxNerror = GUICtrlCreateCheckbox("", 410, 250, 15, 20)
$CboxWerror = GUICtrlCreateCheckbox("", 515, 250, 15, 20)
$Edit = GUICtrlCreateEdit("", 736, 250, 235, 25, $ES_AUTOVSCROLL + $WS_VSCROLL)
$CboxCheck1 = GUICtrlCreateCheckbox("", 230, 275, 15, 20)
$CboxNA1 = GUICtrlCreateCheckbox("", 320, 275, 15, 20)
$CboxNerror1 = GUICtrlCreateCheckbox("", 410, 275, 15, 20)
$CboxWerror1 = GUICtrlCreateCheckbox("", 515, 275, 15, 20)
$Edit1 = GUICtrlCreateEdit("", 736, 276, 235, 25, $ES_AUTOVSCROLL + $WS_VSCROLL)

;~ Tab1 elements
$LabelAC = GUICtrlCreateLabel("CATEGORY", 16, 256, 110, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelCsCX = GUICtrlCreateLabel("Casing", 60, 280, 100, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelHD = GUICtrlCreateLabel("HISTORY DATES", 16, 310, 110, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelCX = GUICtrlCreateLabel("Check XML", 60, 330, 100, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelAS = GUICtrlCreateLabel("SUBTITLE", 16, 355, 140, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelCX = GUICtrlCreateLabel("Completeness", 60, 375, 100, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelCX = GUICtrlCreateLabel("Casing", 60, 390, 100, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelRH = GUICtrlCreateLabel("HEADERS", 16, 420, 140, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelST = GUICtrlCreateLabel("Short Head", 60, 435, 100, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelSA = GUICtrlCreateLabel("Short Title", 60, 450, 100, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelRH = GUICtrlCreateLabel("CREATORS", 16, 420, 140, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelST = GUICtrlCreateLabel("Completeness", 60, 435, 100, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelSA = GUICtrlCreateLabel("Style", 60, 480, 100, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)

$tBody = GUICtrlCreateTab(8, 190, 1010, 460)
GUICtrlCreateTabItem("Part II")
$GroupElement = GUICtrlCreateGroup("", 16, 215, 73, 30)
$LabelElement = GUICtrlCreateLabel("ENTRY/s", 24, 225, 62, 17)
$GroupCheck = GUICtrlCreateGroup("", 200, 215, 73, 30)
$LabelCheck = GUICtrlCreateLabel("CHECK", 215, 225, 40, 17)
$GroupNA = GUICtrlCreateGroup("", 300, 215, 53, 30)
$LabelNA = GUICtrlCreateLabel("N/A", 315, 225, 20, 17)
$GroupNError = GUICtrlCreateGroup("", 375, 215, 80, 30)
$LabelNError = GUICtrlCreateLabel("NO ERROR", 385, 225, 60, 17)
$GroupWError = GUICtrlCreateGroup("", 475, 215, 95, 30)
$LabelWError = GUICtrlCreateLabel("WITH ERROR", 488, 225, 75, 17)
$GroupRemark = GUICtrlCreateGroup("", 775, 215, 95, 30)
$LabelRemark = GUICtrlCreateLabel("REMARKS", 788, 225, 75, 17)

;~ Tab2 Elements
$CboxCheck = GUICtrlCreateCheckbox("", 230, 250, 15, 20)
$CboxNA = GUICtrlCreateCheckbox("", 320, 250, 15, 20)
$CboxNerror = GUICtrlCreateCheckbox("", 410, 250, 15, 20)
$CboxWerror = GUICtrlCreateCheckbox("", 515, 250, 15, 20)
$Edit = GUICtrlCreateEdit("", 736, 250, 235, 25, $ES_AUTOVSCROLL + $WS_VSCROLL)

$tBack = GUICtrlCreateTab(8, 190, 1010, 460)
GUICtrlCreateTabItem("Part III")
$GroupElement = GUICtrlCreateGroup("", 16, 215, 73, 30)
$LabelElement = GUICtrlCreateLabel("ENTRY/s", 24, 225, 62, 17)
$GroupCheck = GUICtrlCreateGroup("", 200, 215, 73, 30)
$LabelCheck = GUICtrlCreateLabel("CHECK", 215, 225, 40, 17)
$GroupNA = GUICtrlCreateGroup("", 300, 215, 53, 30)
$LabelNA = GUICtrlCreateLabel("N/A", 315, 225, 20, 17)
$GroupNError = GUICtrlCreateGroup("", 375, 215, 80, 30)
$LabelNError = GUICtrlCreateLabel("NO ERROR", 385, 225, 60, 17)
$GroupWError = GUICtrlCreateGroup("", 475, 215, 95, 30)
$LabelWError = GUICtrlCreateLabel("WITH ERROR", 488, 225, 75, 17)
$GroupRemark = GUICtrlCreateGroup("", 775, 215, 95, 30)
$LabelRemark = GUICtrlCreateLabel("REMARKS", 788, 225, 75, 17)

;~ Tab3 Elements
$CboxCheck = GUICtrlCreateCheckbox("", 230, 250, 15, 20)
$CboxNA = GUICtrlCreateCheckbox("", 320, 250, 15, 20)
$CboxNerror = GUICtrlCreateCheckbox("", 410, 250, 15, 20)
$CboxWerror = GUICtrlCreateCheckbox("", 515, 250, 15, 20)
$Edit = GUICtrlCreateEdit("", 736, 250, 235, 25, $ES_AUTOVSCROLL + $WS_VSCROLL)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


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

Func GetFullName($sUserName)
    $colItems = ""
    $strComputer = "localhost"

    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount WHERE Name = '" & $sUserName &  "'", "WQL", 0x10 + 0x20)

    If IsObj($colItems) then
       For $objItem In $colItems
          Return $objItem.FullName
       Next
    Else
       Return SetError(1,0,"")
    Endif
 EndFunc

Not that really good at all.:sweating:

Experts, I really need your help with this one. I have my sample screengrab of what I wanted to do. Tried searching lots of help site and engine but could not compile a real code for this one.:(

 

TabControl.png

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

Link to comment
Share on other sites

Hello. My suggestions are:

Way 1. use a Listview. You will need knowledge about Window  owner-drawn. To Draw Checkboxes and  Create editable items.

Way 2. Use Multiples Listview for the checkboxs. This will allow you to avoid a lot of owner-drawn rutines. (You still need to use owner-drawn for editable items.)

Way 3. Use Melba32's Scrallbars UDF It. 

 

If you will load too much data from the excel I think better way is 1.

 

Saludos

 

Edited by Danyfirex
Link to comment
Share on other sites

Hi @Danyfirex,

Yup, already in my head about using ListView, however, I could not add below code in my Listview.

Local $Number = 10, $iRows = 10, $iSpacing = 205
    Local $Error[$Number]
    Local $nError[$Number]
    Local $NA[$Number]
    Local $Edit[$Number]

   For $i = 0 To $Number - 1
        $Error[$i] = GUICtrlCreateCheckbox("", $iSpacing + -40 + (Int($i / $iRows)), ((27.7 * Mod($i, $iRows)) + $iSpacing), 15, 20)
    Next
    For $j = 0 To $Number - 1
        $nError[$j] = GUICtrlCreateCheckbox("", $iSpacing + 70 + (Int($j / $iRows)), ((27.7 * Mod($j, $iRows)) + $iSpacing), 15, 20)
    Next
    For $x = 0 To $Number - 1
        $NA[$x] = GUICtrlCreateCheckbox("", $iSpacing + 172 + (Int($x / $iRows)), ((27.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
    Next
    For $i = 0 To $Number - 1
        $Edit[$i] = GUICtrlCreateEdit("", $iSpacing + 250 + (Int($i / $iRows)), ((27.7 * Mod($i, $iRows)) + $iSpacing), 240, 24, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) ;
        GUICtrlSetState($Edit[$i], $GUI_Disable)
     Next

Also, I tried reading this link but could not compile one.

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

Link to comment
Share on other sites

Experts,

I've made it this way to perform what I need. I added each tab item with individual code for checkboxes and It goes fine however.

Local $Number = 10, $iRows = 10, $iSpacing = 250
    Local $CboxCheck[$Number]
    Local $CboxNA[$Number]
    Local $CboxNerror[$Number]
    Local $CboxWerror[$Number]
    Local $Edit[$Number]

; Part I tab item
$tFront = GUICtrlCreateTab(8, 190, 1010, 460)
GUICtrlCreateTabItem("Part I")
   For $i = 0 To $Number - 1
        $CboxCheck[$i] = GUICtrlCreateCheckbox("", $iSpacing + -22 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 15, 20)
    Next
    For $j = 0 To $Number - 1
        $CboxNA[$j] = GUICtrlCreateCheckbox("", $iSpacing + 72 + (Int($j / $iRows)), ((30.7 * Mod($j, $iRows)) + $iSpacing), 15, 20)
    Next
    For $x = 0 To $Number - 1
        $CboxNerror[$x] = GUICtrlCreateCheckbox("", $iSpacing + 160 + (Int($x / $iRows)), ((30.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
    Next
    For $x = 0 To $Number - 1
        $CboxWerror[$x] = GUICtrlCreateCheckbox("", $iSpacing + 265 + (Int($x / $iRows)), ((30.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
    Next
    For $i = 0 To $Number - 1
        $Edit[$i] = GUICtrlCreateEdit("", $iSpacing + 455 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 240, 24, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) ;
        GUICtrlSetState($Edit[$i], $GUI_Enable)
    Next
 
; Part II tab item
$tBody = GUICtrlCreateTab(8, 190, 1010, 460)
GUICtrlCreateTabItem("Part II")
   For $i = 0 To $Number - 1
        $CboxCheck[$i] = GUICtrlCreateCheckbox("", $iSpacing + -22 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 15, 20)
    Next
    For $j = 0 To $Number - 1
        $CboxNA[$j] = GUICtrlCreateCheckbox("", $iSpacing + 72 + (Int($j / $iRows)), ((30.7 * Mod($j, $iRows)) + $iSpacing), 15, 20)
    Next
    For $x = 0 To $Number - 1
        $CboxNerror[$x] = GUICtrlCreateCheckbox("", $iSpacing + 160 + (Int($x / $iRows)), ((30.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
    Next
    For $x = 0 To $Number - 1
        $CboxWerror[$x] = GUICtrlCreateCheckbox("", $iSpacing + 265 + (Int($x / $iRows)), ((30.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
    Next
    For $i = 0 To $Number - 1
        $Edit[$i] = GUICtrlCreateEdit("", $iSpacing + 455 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 240, 24, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) ;
        GUICtrlSetState($Edit[$i], $GUI_Enable)

;Part III tab item
$tBack = GUICtrlCreateTab(8, 190, 1010, 460)
GUICtrlCreateTabItem("Part III")
   For $i = 0 To $Number - 1
        $CboxCheck[$i] = GUICtrlCreateCheckbox("", $iSpacing + -22 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 15, 20)
    Next
    For $j = 0 To $Number - 1
        $CboxNA[$j] = GUICtrlCreateCheckbox("", $iSpacing + 72 + (Int($j / $iRows)), ((30.7 * Mod($j, $iRows)) + $iSpacing), 15, 20)
    Next
    For $x = 0 To $Number - 1
        $CboxNerror[$x] = GUICtrlCreateCheckbox("", $iSpacing + 160 + (Int($x / $iRows)), ((30.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
    Next
    For $x = 0 To $Number - 1
        $CboxWerror[$x] = GUICtrlCreateCheckbox("", $iSpacing + 265 + (Int($x / $iRows)), ((30.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
    Next
    For $i = 0 To $Number - 1
        $Edit[$i] = GUICtrlCreateEdit("", $iSpacing + 455 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 240, 24, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) ;
        GUICtrlSetState($Edit[$i], $GUI_Enable)
    Next

Is there a way that I can shorten the code or any suggestion that can be used?^_^ I know this is not easy to made and it's impossible to achieve the interface that I need, so, I made it this way.

Meanwhile for other issues that I have right now are still hanging. Hope someone here in this forum can help me.:'(

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

Link to comment
Share on other sites

Hi Experts,

This is my compiled code so far for this problem.

#include <ColorConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
#Include <Array.au3>
#include <File.au3>
#include <GuiScrollBars.au3>
;~ #include "GUIScrollbars_Ex.au3"

#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("Test Form", 820, 740, 265, 50)
GUISetBkColor(0x38A7D2)
$Label10 = GUICtrlCreateLabel("Welcome: "&GetFullName(@UserName), 17, 130, 500, 16)
;~ GUICtrlSetFont(-1, 10, 400, 0, "Arial Rounded MT Bold")
GUICtrlSetColor($Label10, 0xFFFFFF2)
GUICtrlSetFont($Label10, 9, 700)
$File = GUICtrlCreateMenu("File")
GUICtrlCreateMenuItem("Close", $File)
GUICtrlCreateMenuItem("Export", $File)
$Edit = GUICtrlCreateMenu("Edit")
GUICtrlSetState($Edit, $GUI_Disable)
$Option = GUICtrlCreateMenu("Option")
GUICtrlSetState($Option, $GUI_Disable)
$Menu = GUICtrlCreateMenu("View")
GUICtrlCreateMenuItem("Exit", $Menu)
GUICtrlSetState($Menu, $GUI_Disable)
$Help = GUICtrlCreateMenu("Help")
GUICtrlCreateMenuItem("About", $Help)
$dEmployeInfo = GUICtrlCreateGroup("Employee Information", 16, 8, 281, 121)
$dEmpNbr = GUICtrlCreateLabel("Emp#:", 33, 35, 35, 17)
$dEmpNme = GUICtrlCreateLabel("Name:", 33, 59, 35, 17)
$dEmpPrs = GUICtrlCreateLabel("Process:", 24, 83, 45, 17)
$EmpNbrInput = GUICtrlCreateInput("11111", 72, 32, 217, 21)
GUICtrlSetState($EmpNbrInput, $GUI_Disable)
$EmpNmeInput = GUICtrlCreateInput(GetFullName(@UserName), 72, 56, 217, 21)
GUICtrlSetState($EmpNmeInput, $GUI_Disable)
$EmpPrsInput = GUICtrlCreateInput("First Proof", 72, 80, 217, 21)
GUICtrlSetState($EmpPrsInput, $GUI_Disable)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$AID = GUICtrlCreateLabel("AID:", 10, 170, 25, 17)
GUICtrlSetFont($AID, 10, 700)
$AIDLabel = GUICtrlCreateLabel("ABZ123456", 40, 170, 90, 17)
GUICtrlSetColor($AIDLabel, 0xFFFFFF)
GUICtrlSetFont($AIDLabel, 10, 700)
$Submit = GUICtrlCreateButton("Submit Report",  635, 672, 177, 33)
$Checkbox1 = GUICtrlCreateCheckbox("", 16, 659, 12, 17)
$Checkbox2 = GUICtrlCreateCheckbox("", 16, 677, 12, 17)
$Checkbox3 = GUICtrlCreateCheckbox("", 16, 695, 12, 17)
$LabelPrek = GUICtrlCreateLabel("I agree that I have checked the entry/s above.", 37, 660, 265, 17)
$LabelTS = GUICtrlCreateLabel("Accept", 37, 679, 265, 17)
$LabelASTR = GUICtrlCreateLabel("*", 72, 680, 40, 17)
GUICtrlSetColor($LabelASTR, 0xFF0000)
GUICtrlSetFont($LabelASTR, 10, 700)
$LabelReject = GUICtrlCreateLabel("Reject", 37, 695, 265, 17)
$LabelASTR1 = GUICtrlCreateLabel("*", 70, 695, 40, 17)
GUICtrlSetColor($LabelASTR1, 0xFF0000)
GUICtrlSetFont($LabelASTR1, 10, 700)
Local $Number = 13, $iRows = 13, $iSpacing = 250
Local $CboxCheck[$Number]
Local $CboxNA[$Number]
Local $CboxNerror[$Number]
Local $CboxWerror[$Number]
Local $Edit[$Number]
Local $eElement[$Number]

;~ Start tab here
$tab1 = GUICtrlCreateTab(8, 190, 801, 460)
GUICtrlCreateTabItem("Part One")
;~ _GUIScrollBars_EnableScrollBar($Form1, $SB_VERT)
;~ _GUIScrollBars_ShowScrollBar($Form1, $SB_VERT, True)
;~ _GUIScrollBars_GetScrollPos($tFront, $SB_VERT)
;~ Heading
$GroupElement = GUICtrlCreateGroup("", 55, 215, 73, 30)
$LabelElement = GUICtrlCreateLabel("ENTRY/s", 65, 225, 62, 17)
$GroupNA = GUICtrlCreateGroup("", 200, 215, 73, 30)
$LabelNA = GUICtrlCreateLabel("N/A", 225, 225, 40, 17)
$GroupNerror = GUICtrlCreateGroup("", 292, 215, 70, 30)
$LabelNerror = GUICtrlCreateLabel("NO ERROR", 299, 225, 60, 17)
$GroupWError = GUICtrlCreateGroup("", 380, 215, 80, 30)
$LabelWError = GUICtrlCreateLabel("WITH ERROR", 385, 225, 75, 17)
$GroupRemark = GUICtrlCreateGroup("", 615, 215, 95, 30)
$LabelRemark = GUICtrlCreateLabel("REMARKS", 635, 225, 65, 17)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlCreateGroup("", -99, -99, 1, 1)
   For $i = 0 To $Number - 1
        $eElement[$i] = GUICtrlCreateInput("", $iSpacing + -230 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 155, 20)
        GUICtrlSetState($eElement[$i], $GUI_Disable)
   Next
   For $i = 0 To $Number - 1
        $CboxNA[$i] = GUICtrlCreateCheckbox("", $iSpacing + -22 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 15, 20)
    Next
    For $j = 0 To $Number - 1
        $CboxNerror[$j] = GUICtrlCreateCheckbox("", $iSpacing + 72 + (Int($j / $iRows)), ((30.7 * Mod($j, $iRows)) + $iSpacing), 15, 20)
    Next
    For $x = 0 To $Number - 1
        $CboxWerror[$x] = GUICtrlCreateCheckbox("", $iSpacing + 160 + (Int($x / $iRows)), ((30.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
    Next
    For $i = 0 To $Number - 1
        $Edit[$i] = GUICtrlCreateEdit("", $iSpacing + 290 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 240, 24, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) ;
        GUICtrlSetState($Edit[$i], $GUI_Enable)
    Next

$tab2 = GUICtrlCreateTab(8, 190, 801, 460)
GUICtrlCreateTabItem("Part Two")
$GroupElement = GUICtrlCreateGroup("", 55, 215, 73, 30)
$LabelElement = GUICtrlCreateLabel("ENTRY/s", 65, 225, 62, 17)
$GroupNA = GUICtrlCreateGroup("", 200, 215, 73, 30)
$LabelNA = GUICtrlCreateLabel("N/A", 225, 225, 40, 17)
$GroupNerror = GUICtrlCreateGroup("", 292, 215, 70, 30)
$LabelNerror = GUICtrlCreateLabel("NO ERROR", 299, 225, 60, 17)
$GroupWError = GUICtrlCreateGroup("", 380, 215, 80, 30)
$LabelWError = GUICtrlCreateLabel("WITH ERROR", 385, 225, 75, 17)
$GroupRemark = GUICtrlCreateGroup("", 615, 215, 95, 30)
$LabelRemark = GUICtrlCreateLabel("REMARKS", 635, 225, 65, 17)
   For $i = 0 To $Number - 1
        $eElement[$i] = GUICtrlCreateInput("", $iSpacing + -230 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 155, 20)
        GUICtrlSetState($eElement[$i], $GUI_Disable)
   Next
   For $i = 0 To $Number - 1
        $CboxNA[$i] = GUICtrlCreateCheckbox("", $iSpacing + -22 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 15, 20)
    Next
    For $j = 0 To $Number - 1
        $CboxNerror[$j] = GUICtrlCreateCheckbox("", $iSpacing + 72 + (Int($j / $iRows)), ((30.7 * Mod($j, $iRows)) + $iSpacing), 15, 20)
    Next
    For $x = 0 To $Number - 1
        $CboxWerror[$x] = GUICtrlCreateCheckbox("", $iSpacing + 160 + (Int($x / $iRows)), ((30.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
    Next
    For $i = 0 To $Number - 1
        $Edit[$i] = GUICtrlCreateEdit("", $iSpacing + 290 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 240, 24, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) ;
        GUICtrlSetState($Edit[$i], $GUI_Enable)
    Next

;~ Tab2 Elements

$tab3 = GUICtrlCreateTab(8, 190, 801, 460)
GUICtrlCreateTabItem("Part Three")
$GroupElement = GUICtrlCreateGroup("", 55, 215, 73, 30)
$LabelElement = GUICtrlCreateLabel("ENTRY/s", 65, 225, 62, 17)
$GroupNA = GUICtrlCreateGroup("", 200, 215, 73, 30)
$LabelNA = GUICtrlCreateLabel("N/A", 225, 225, 40, 17)
$GroupNerror = GUICtrlCreateGroup("", 292, 215, 70, 30)
$LabelNerror = GUICtrlCreateLabel("NO ERROR", 299, 225, 60, 17)
$GroupWError = GUICtrlCreateGroup("", 380, 215, 80, 30)
$LabelWError = GUICtrlCreateLabel("WITH ERROR", 385, 225, 75, 17)
$GroupRemark = GUICtrlCreateGroup("", 615, 215, 95, 30)
$LabelRemark = GUICtrlCreateLabel("REMARKS", 635, 225, 65, 17)
   For $i = 0 To $Number - 1
        $eElement[$i] = GUICtrlCreateInput("", $iSpacing + -230 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 155, 20)
        GUICtrlSetState($eElement[$i], $GUI_Disable)
   Next
   For $i = 0 To $Number - 1
        $CboxNA[$i] = GUICtrlCreateCheckbox("", $iSpacing + -22 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 15, 20)
    Next
    For $j = 0 To $Number - 1
        $CboxNerror[$j] = GUICtrlCreateCheckbox("", $iSpacing + 72 + (Int($j / $iRows)), ((30.7 * Mod($j, $iRows)) + $iSpacing), 15, 20)
    Next
    For $x = 0 To $Number - 1
        $CboxWerror[$x] = GUICtrlCreateCheckbox("", $iSpacing + 160 + (Int($x / $iRows)), ((30.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
    Next
    For $i = 0 To $Number - 1
        $Edit[$i] = GUICtrlCreateEdit("", $iSpacing + 290 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 240, 24, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) ;
        GUICtrlSetState($Edit[$i], $GUI_Enable)
    Next
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Submit
         MsgBox(16, "Error!", "This is still on-going")
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Func GetFullName($sUserName)
    $colItems = ""
    $strComputer = "localhost"

    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount WHERE Name = '" & $sUserName &  "'", "WQL", 0x10 + 0x20)

    If IsObj($colItems) then
       For $objItem In $colItems
          Return $objItem.FullName
       Next
    Else
       Return SetError(1,0,"")
    Endif
 EndFunc

I made it in other way around just to have an interface as this but I have these below inquiries on how to perform.

1. In my "$eElement[$i] = GUICtrlCreateInput()", how can I populate this from my excel file (attached sample).:>

2. My scrollbar from @Melba23 is not working and I don't know how to handle it.:sweating:

3. Can anyone shorten this code? Like I need only one coding for each tab part and not that I should declare all "For...To...Next" function in every tab. It's killing me if they'll be adding new tab in the future. Please anyone!:(

This is my first week trying to solve this problem and still could not be solved.:'(

 

Thanks in advance Experts.

 

KS15

Sample.xlsx

Edited by KickStarter15

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

Link to comment
Share on other sites

Experts,

I used "_Excel_RangeRead()" to read my workbook from excel file and it is now working but again, I declared it in every tab control (like tab1, tab2 and tab3) all of them has the same function used. Now, how can minimized these workaround guys.

Here's my code:

$sPath = @ScriptDir & "\Sample.xlsx"
$oExcel = ObjCreate("Excel.Application")
$oWorkbook = _Excel_BookOpen($oExcel, $sPath)
If @error Then Exit
$aResult = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("A:A"), 2)
_Excel_Close($oExcel, False, True)
   For $i = 0 To $Number - 1
        $eElement[$i] = GUICtrlCreateInput("", $iSpacing + -230 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 155, 20, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
        GUICtrlSetState($eElement[$i], $GUI_Enable)
        GUICtrlSetData($eElement[$i], $aResult[$i])
        _Excel_Close($oExcel, False, True)
   Next

Please need your advise on this one.:'( I repeatedly used this code from tab1, tab2 and tab3. Also, need your help with the scrollbar thing. Please?

 

Thanks!

KS15

Edited by KickStarter15
Ooops! missed something.

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

Link to comment
Share on other sites

Hi Experts,

So far so bad:D. I could not even completed my code. Well, luckily I've made it this way:

#include <Excel.au3>
#include <GUIConstants.au3>
#include <TabConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include "GUIScrollbars_Ex.au3"
#include <ColorConstants.au3>
#include <WindowsConstants.au3>
#Include <Array.au3>
#include <File.au3>

#Region ### START Koda GUI section ### Form=
Opt("GUIOnEventMode", 1) ; Need to check how to handle this without affecting my code.
HotKeySet("{ESC}", "_Exit")
Global $Form1 = GUICreate("Test Form", 820, 740, 265, 50)
GUISetBkColor(0x38A7D2)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$Pic1 = GUICtrlCreatePic(@ScriptDir & "\Image1.jpg", 690, 15, 120, 120)
$Label10 = GUICtrlCreateLabel("Welcome: "&GetFullName(@UserName), 17, 130, 500, 16)
;~ GUICtrlSetFont(-1, 10, 400, 0, "Arial Rounded MT Bold")
GUICtrlSetColor($Label10, 0xFFFFFF2)
GUICtrlSetFont($Label10, 9, 700)
$File = GUICtrlCreateMenu("File")
GUICtrlCreateMenuItem("Close", $File)
GUICtrlCreateMenuItem("Export", $File)
$Edit = GUICtrlCreateMenu("Edit")
GUICtrlSetState($Edit, $GUI_Disable)
$Option = GUICtrlCreateMenu("Option")
GUICtrlSetState($Option, $GUI_Disable)
$Menu = GUICtrlCreateMenu("View")
GUICtrlCreateMenuItem("Exit", $Menu)
GUICtrlSetState($Menu, $GUI_Disable)
$Help = GUICtrlCreateMenu("Help")
GUICtrlCreateMenuItem("About", $Help)
$dEmployeInfo = GUICtrlCreateGroup("Employee Information", 16, 8, 281, 121)
$dEmpNbr = GUICtrlCreateLabel("Emp#:", 33, 35, 35, 17)
$dEmpNme = GUICtrlCreateLabel("Name:", 33, 59, 35, 17)
$dEmpPrs = GUICtrlCreateLabel("Process:", 24, 83, 45, 17)
$EmpNbrInput = GUICtrlCreateInput("11111", 72, 32, 217, 21)
GUICtrlSetState($EmpNbrInput, $GUI_Disable)
$EmpNmeInput = GUICtrlCreateInput(GetFullName(@UserName), 72, 56, 217, 21)
GUICtrlSetState($EmpNmeInput, $GUI_Disable)
$EmpPrsInput = GUICtrlCreateInput("First Proof", 72, 80, 217, 21)
GUICtrlSetState($EmpPrsInput, $GUI_Disable)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$AID = GUICtrlCreateLabel("AID:", 10, 170, 25, 17)
GUICtrlSetFont($AID, 10, 700)
$AIDLabel = GUICtrlCreateLabel("ABZ123456", 40, 170, 90, 17)
GUICtrlSetColor($AIDLabel, 0xFFFFFF)
GUICtrlSetFont($AIDLabel, 10, 700)
$Submit = GUICtrlCreateButton("Submit Report",  635, 672, 177, 33)
$Checkbox1 = GUICtrlCreateCheckbox("", 16, 659, 12, 17)
$Checkbox2 = GUICtrlCreateCheckbox("", 16, 677, 12, 17)
$Checkbox3 = GUICtrlCreateCheckbox("", 16, 695, 12, 17)
$LabelPrek = GUICtrlCreateLabel("I agree that I have checked the entry/s above.", 37, 660, 265, 17)
$LabelTS = GUICtrlCreateLabel("Accept", 37, 679, 265, 17)
$LabelASTR = GUICtrlCreateLabel("*", 72, 680, 40, 17)
GUICtrlSetColor($LabelASTR, 0xFF0000)
GUICtrlSetFont($LabelASTR, 10, 700)
$LabelReject = GUICtrlCreateLabel("Reject", 37, 695, 265, 17)
$LabelASTR1 = GUICtrlCreateLabel("*", 70, 695, 40, 17)
GUICtrlSetColor($LabelASTR1, 0xFF0000)
GUICtrlSetFont($LabelASTR1, 10, 700)

; Array declared for each inputbox, checkboxes and editboxes. need help for single declaration only and not repeating it per tab item.
Local $Number = 60, $iRows = 60, $iSpacing = 60
Local $CboxCheck[$Number]
Local $CboxNA[$Number]
Local $CboxNerror[$Number]
Local $CboxWerror[$Number]
Local $Edit[$Number]
Local $eElement[$Number]

$tab = GUICtrlCreateTab(10, 200, 780, 455, $TCS_BUTTONS)
GUICtrlSetOnEvent(-1, "_Tab")

$tab1 = GUICtrlCreateTabItem("Part I")
GUICtrlSetState(-1, $GUI_SHOW); will be display first

; Reading column B for tab 2 "Part II"
$tab2 = GUICtrlCreateTabItem("Part II")
      $hTab_Win0 = GUICreate("", 780, 425, 10, 230, $WS_POPUP, $WS_EX_MDICHILD, $Form1)
      GUISetBkColor(0xFFFFFF) ; Just to show the GUI clearly
      $sPath = @ScriptDir & "\Sample.xlsx"
      $oExcel = ObjCreate("Excel.Application")
      $oWorkbook = _Excel_BookOpen($oExcel, $sPath)
      If @error Then Exit
      $aResult = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("B:B"), 2)
      _Excel_Close($oExcel, False, True)
      For $i = 0 To $Number - 1
         $eElement[$i] = GUICtrlCreateInput("", $iSpacing + -50 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 155, 20, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
         GUICtrlSetState($eElement[$i], $GUI_Enable)
         GUICtrlSetData($eElement[$i], $aResult[$i])
         _Excel_Close($oExcel, False, True)
      Next
      For $i = 0 To $Number - 1
         $CboxNA[$i] = GUICtrlCreateCheckbox("", $iSpacing + 165 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 15, 20)
      Next
      For $j = 0 To $Number - 1
         $CboxNerror[$j] = GUICtrlCreateCheckbox("", $iSpacing + 260 + (Int($j / $iRows)), ((30.7 * Mod($j, $iRows)) + $iSpacing), 15, 20)
      Next
      For $x = 0 To $Number - 1
         $CboxWerror[$x] = GUICtrlCreateCheckbox("", $iSpacing + 355 + (Int($x / $iRows)), ((30.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
      Next
      For $i = 0 To $Number - 1
         $Edit[$i] = GUICtrlCreateEdit("", $iSpacing + 440 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 240, 24, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) ;
         GUICtrlSetState($Edit[$i], $GUI_Enable)
      Next
      GUISetState(@SW_SHOW, $Form1)
      GUISetState(@SW_SHOW, $hTab_Win0)

; Part III is not viewing in GUI tab. Help
$tab3 = GUICtrlCreateTabItem("Part III")
      GUICtrlCreateTabItem("")
      $hTab_Win0 = GUICreate("", 780, 425, 10, 230, $WS_POPUP, $WS_EX_MDICHILD, $Form1)
      GUISetBkColor(0xFFFFFF) ; Just to show the GUI clearly
      $GroupElement = GUICtrlCreateGroup("", 40, 10, 73, 30)
      $LabelElement = GUICtrlCreateLabel("ENTRY/s", 50, 20, 62, 17)
      $GroupNA = GUICtrlCreateGroup("", 200, 10, 73, 30)
      $LabelNA = GUICtrlCreateLabel("N/A", 225, 20, 40, 17)
      $GroupNerror = GUICtrlCreateGroup("", 292, 10, 70, 30)
      $LabelNerror = GUICtrlCreateLabel("NO ERROR", 299, 20, 60, 17)
      $GroupWError = GUICtrlCreateGroup("", 380, 10, 80, 30)
      $LabelWError = GUICtrlCreateLabel("WITH ERROR", 385, 20, 73, 15)
      $GroupRemark = GUICtrlCreateGroup("", 580, 10, 95, 30)
      $LabelRemark = GUICtrlCreateLabel("REMARKS", 600, 20, 65, 17)
      GUICtrlCreateGroup("", -99, -99, 1, 1)
      $sPath = @ScriptDir & "\Sample.xlsx"
      $oExcel = ObjCreate("Excel.Application")
      $oWorkbook = _Excel_BookOpen($oExcel, $sPath)
      If @error Then Exit
      $aResult = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("C:C"), 2)
      _Excel_Close($oExcel, False, True)
      For $i = 0 To $Number - 1
         $eElement[$i] = GUICtrlCreateInput("", $iSpacing + -50 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 155, 20, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
         GUICtrlSetState($eElement[$i], $GUI_Enable)
         GUICtrlSetData($eElement[$i], $aResult[$i])
         _Excel_Close($oExcel, False, True)
      Next
      For $i = 0 To $Number - 1
         $CboxNA[$i] = GUICtrlCreateCheckbox("", $iSpacing + 165 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 15, 20)
      Next
      For $j = 0 To $Number - 1
         $CboxNerror[$j] = GUICtrlCreateCheckbox("", $iSpacing + 260 + (Int($j / $iRows)), ((30.7 * Mod($j, $iRows)) + $iSpacing), 15, 20)
      Next
      For $x = 0 To $Number - 1
         $CboxWerror[$x] = GUICtrlCreateCheckbox("", $iSpacing + 355 + (Int($x / $iRows)), ((30.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
      Next
      For $i = 0 To $Number - 1
         $Edit[$i] = GUICtrlCreateEdit("", $iSpacing + 440 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 240, 24, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) ;
         GUICtrlSetState($Edit[$i], $GUI_Enable)
      Next
      _GUIScrollbars_Generate($hTab_Win1, 0, 2000)

      GUISetState(@SW_SHOW, $Form1)
      GUISetState(@SW_SHOW, $hTab_Win0)

; Close Tab definiton
GUICtrlCreateTabItem("")
$hTab_Win0 = GUICreate("", 780, 425, 10, 230, $WS_POPUP, $WS_EX_MDICHILD, $Form1)
GUISetBkColor(0xFFFFFF)
$GroupElement = GUICtrlCreateGroup("", 40, 10, 73, 30)
$LabelElement = GUICtrlCreateLabel("ENTRY/s", 50, 20, 62, 17)
$GroupNA = GUICtrlCreateGroup("", 200, 10, 73, 30)
$LabelNA = GUICtrlCreateLabel("N/A", 225, 20, 40, 17)
$GroupNerror = GUICtrlCreateGroup("", 292, 10, 70, 30)
$LabelNerror = GUICtrlCreateLabel("NO ERROR", 299, 20, 60, 17)
$GroupWError = GUICtrlCreateGroup("", 380, 10, 80, 30)
$LabelWError = GUICtrlCreateLabel("WITH ERROR", 385, 20, 73, 15)
$GroupRemark = GUICtrlCreateGroup("", 580, 10, 95, 30)
$LabelRemark = GUICtrlCreateLabel("REMARKS", 600, 20, 65, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)

; Reading excel file column A for tab 1 "Part I"
$sPath = @ScriptDir & "\Sample.xlsx"
$oExcel = ObjCreate("Excel.Application")
$oWorkbook = _Excel_BookOpen($oExcel, $sPath)
If @error Then Exit
$aResult = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("A:A"), 2)
_Excel_Close($oExcel, False, True)
   For $i = 0 To $Number - 1
        $eElement[$i] = GUICtrlCreateInput("", $iSpacing + -50 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 155, 20, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
        GUICtrlSetState($eElement[$i], $GUI_Enable)
        GUICtrlSetData($eElement[$i], $aResult[$i])
        _Excel_Close($oExcel, False, True)
   Next
   For $i = 0 To $Number - 1
        $CboxNA[$i] = GUICtrlCreateCheckbox("", $iSpacing + 165 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 15, 20)
    Next
    For $j = 0 To $Number - 1
        $CboxNerror[$j] = GUICtrlCreateCheckbox("", $iSpacing + 260 + (Int($j / $iRows)), ((30.7 * Mod($j, $iRows)) + $iSpacing), 15, 20)
    Next
    For $x = 0 To $Number - 1
        $CboxWerror[$x] = GUICtrlCreateCheckbox("", $iSpacing + 355 + (Int($x / $iRows)), ((30.7 * Mod($x, $iRows)) + $iSpacing), 15, 20)
    Next
    For $i = 0 To $Number - 1
        $Edit[$i] = GUICtrlCreateEdit("", $iSpacing + 440 + (Int($i / $iRows)), ((30.7 * Mod($i, $iRows)) + $iSpacing), 240, 24, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) ;
        GUICtrlSetState($Edit[$i], $GUI_Enable)
    Next
_GUIScrollbars_Generate($hTab_Win0, 0, 2000)

GUISetState(@SW_SHOW, $Form1)
GUISetState(@SW_SHOW, $hTab_Win0)
#EndRegion ### END Koda GUI section ###


Sleep(20)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
      Case $Submit ; When clicking submit button, it will not show below message box. Due to this "Opt("GUIOnEventMode", 1)", how can I handle this?
        MsgBox(16, "Error!", "This is still on-going")
      Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _Tab()

    Switch GUICtrlRead($tab)
        Case 0
            GUISetState(@SW_SHOW, $hTab_Win0)
        Case 1
            GUISetState(@SW_HIDE, $hTab_Win0)
    EndSwitch

EndFunc   ;==>_Tab

Func _Exit()
    Exit
EndFunc   ;==>_Exit
Func GetFullName($sUserName)
    $colItems = ""
    $strComputer = "localhost"

    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount WHERE Name = '" & $sUserName &  "'", "WQL", 0x10 + 0x20)

    If IsObj($colItems) then
       For $objItem In $colItems
          Return $objItem.FullName
       Next
    Else
       Return SetError(1,0,"")
    Endif
EndFunc

These are the items that needs to be fixed:

1. Unable to display $tab3 not sure why and how.

2. Need to shorten the code (means, if possible not to declare this "For...To...Next" in each tab item). I just need one declaration.

3. When clicking submit button, message box won't show due to this "Opt("GUIOnEventMode", 1)", but I need this to show my tab items and their child GUI.

4. The code is so slow to load-up. Maybe it's because of excel validation. Need to adjust it the fastest as possible.

Maybe this is my last post in this thread if above items can be done.^_^ But still having hard time at this moment experts. Please need you help.

 

Thanks!

KS15

 

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

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