Sign in to follow this  
Followers 0
Manjish

how to enable an input box based on combo box selection

5 posts in this topic

Hi, what i wanna do is this.. wanna disable an input box initially. But as soon as user makes selections on two combo-boxes, I want to enable the input box. The reson for this is simple,to fill in the info into i/p box user has to make choices on the combo box!!

Here's what I tried, but the i/p box flickers with this method. I am not happy with this approach. Help me improve it or suggest nething else!! thanks..

#include <GUIConstants.au3>

#include <GUIConstants.au3>
#include <GUIConstants.au3>
procuring()
Func procuring()
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Media Manager", 722, 638, 302, 34)
GUISetBkColor(0xD8E4F8)
$Group1 = GUICtrlCreateGroup("Procurement Form", 5, 0, 713, 633, -1)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Pic1 = GUICtrlCreatePic(@ScriptDir&"\MM_Logo.JPG", 205, 24, 353, 68)
$name = GUICtrlCreateInput("", 117, 121, 185, 23)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$date = GUICtrlCreateInput("", 509, 122, 113, 23)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$BU = GUICtrlCreateInput("", 117, 180, 185, 23)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$EID = GUICtrlCreateInput("", 509, 184, 113, 23)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$mobile = GUICtrlCreateInput("", 117, 242, 185, 23)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$GA = GUICtrlCreateInput("", 509, 244, 193, 23)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label1 = GUICtrlCreateLabel("Procured By", 29, 119, 70, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label2 = GUICtrlCreateLabel("BU/Team", 29, 185, 54, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label3 = GUICtrlCreateLabel("Mobile No.", 29, 240, 64, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label4 = GUICtrlCreateLabel("E.g. Manjish Naik", 309, 123, 98, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label5 = GUICtrlCreateLabel("E.g. EBG-QPS", 309, 183, 77, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label6 = GUICtrlCreateLabel("Date", 453, 122, 29, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label7 = GUICtrlCreateLabel("EID No.", 453, 185, 46, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label8 = GUICtrlCreateLabel("Name of Granting Authority", 341, 245, 153, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label9 = GUICtrlCreateLabel("(dd/mm/yy)", 637, 121, 66, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label10 = GUICtrlCreateLabel("E.g. E437409", 637, 180, 70, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label11 = GUICtrlCreateLabel("Example: R310.3 Application Media (Build 6 Rev 6).", 29, 320, 300, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label12 = GUICtrlCreateLabel("Please Enter the Item to be procured. (Include the Build ID of Media).", 29, 288, 550, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label13 = GUICtrlCreateLabel("Release", 157, 352, 45, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label14 = GUICtrlCreateLabel("Type Of Media", 469, 352, 85, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label15 = GUICtrlCreateLabel("1.", 37, 384, 13, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label16 = GUICtrlCreateLabel("2.", 37, 424, 13, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label17 = GUICtrlCreateLabel("3.", 37, 464, 13, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label18 = GUICtrlCreateLabel("4.", 37, 504, 13, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label19 = GUICtrlCreateLabel("5.", 37, 544, 13, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$R1 = GUICtrlCreateCombo("", 93, 384, 169, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Windows 2003 Server|Windows 2000 Server|Windows 2000 Client|Windows XP|Windows 7|Windows Vista|Windows 2008 Server|R 200 or Older|R 301.1|R 301.2|R 301.3|R 310.2|R 310.3|R 311.2|R 400")
$B1 = GUICtrlCreateInput("", 278, 384, 129, 23)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$T1 = GUICtrlCreateCombo("", 422, 384, 257, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Operating System Disk|EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")
$R2 = GUICtrlCreateCombo("", 93, 424, 169, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Windows 2003 Server|Windows 2000 Server|Windows 2000 Client|Windows XP|Windows 7|Windows Vista|Windows 2008 Server|R 200 or Older|R 301.1|R 301.2|R 301.3|R 310.2|R 310.3|R 311.2|R 400")
$B2 = GUICtrlCreateInput("", 278, 424, 129, 23)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$T2 = GUICtrlCreateCombo("", 422, 424, 257, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Operating System Disk|EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")
$R3 = GUICtrlCreateCombo("", 93, 464, 169, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Windows 2003 Server|Windows 2000 Server|Windows 2000 Client|Windows XP|Windows 7|Windows Vista|Windows 2008 Server|R 200 or Older|R 301.1|R 301.2|R 301.3|R 310.2|R 310.3|R 311.2|R 400")
$B3 = GUICtrlCreateInput("", 278, 464, 129, 23)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$T3 = GUICtrlCreateCombo("", 422, 464, 257, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Operating System Disk|EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")
$R4 = GUICtrlCreateCombo("", 93, 504, 169, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Windows 2003 Server|Windows 2000 Server|Windows 2000 Client|Windows XP|Windows 7|Windows Vista|Windows 2008 Server|R 200 or Older|R 301.1|R 301.2|R 301.3|R 310.2|R 310.3|R 311.2|R 400")
$B4 = GUICtrlCreateInput("", 278, 504, 129, 23)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetState(-1,$gui_disable)
;GUICtrlGetState
$T4 = GUICtrlCreateCombo("", 422, 504, 257, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Operating System Disk|EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")
$R5 = GUICtrlCreateCombo("", 92, 544, 169, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Windows 2003 Server|Windows 2000 Server|Windows 2000 Client|Windows XP|Windows 7|Windows Vista|Windows 2008 Server|R 200 or Older|R 301.1|R 301.2|R 301.3|R 310.2|R 310.3|R 311.2|R 400")
$B5 = GUICtrlCreateInput("", 278, 544, 129, 23)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$T5 = GUICtrlCreateCombo("", 422, 544, 257, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Operating System Disk|EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")
$Enter = GUICtrlCreateButton("Enter", 250, 592, 169, 25, 0)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetState(-1,$gui_defbutton)
GUICtrlSetBkColor(-1, 0x316AC5)
$Label = GUICtrlCreateLabel("Build ID", 312, 352, 48, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

while 1
    $msg=GUIGetMsg()
    If $msg=$gui_event_close then Exit
    if guictrlread($R1,1)<>"" and guictrlread($t1,1)<>"" Then GUICtrlSetState($B1,$gui_enable)
        if guictrlread($R2,1)<>"" and guictrlread($t2,1)<>"" Then GUICtrlSetState($B2,$gui_enable)
            if guictrlread($R3,1)<>"" and guictrlread($t3,1)<>"" Then GUICtrlSetState($B3,$gui_enable)
                if guictrlread($R4,1)<>"" and guictrlread($t4,1)<>"" Then GUICtrlSetState($B4,$gui_enable)
                    if guictrlread($R5,1)<>"" and guictrlread($t5,1)<>"" Then GUICtrlSetState($B5,$gui_enable)
                    WEnd
While 1
$nMsg2 = GUIGetMsg()
Switch $nMsg2
Case $GUI_EVENT_CLOSE
Return
ExitLoop
Case $Enter
    Global $date1=GUICtrlRead($date)
    Global $name1=GUICtrlRead($name)
    Global $EID1=GUICtrlRead($EID)
    Global $BU1=GUICtrlRead($BU)
    
    Global $R11=guictrlread($R1,1)
    Global $B11=guictrlread($B1)
    Global $T11=guictrlread($T1,1)
    
    Global $R21=guictrlread($R2,1)
    Global $B21=guictrlread($B2)
    Global $T21=guictrlread($T2,1)
        
    Global $R31=guictrlread($R3,1)
    Global $B31=guictrlread($B3)
    Global $T31=guictrlread($T3,1)
    
    
    Global $R41=guictrlread($R4,1)
    Global $B41=guictrlread($B4)
    Global $T41=guictrlread($T4,1)
    
    
    Global $R51=guictrlread($R5,1)
    Global $B51=guictrlread($B5)
    Global $T51=guictrlread($T5,1)
    
    Global $mobile1=guictrlread($mobile)
    Global $GA1=GUICtrlRead($GA)
    $check=datacheck()
    if $check=0 Then
        continueloop
    Else    
        dataentry()
        ExitLoop
    EndIf
    ;Return
    
EndSwitch
WEnd
EndFunc

    Func datacheck()
Select 

Case $name1=""
    MsgBox(4096,"Form Validation Error","Blank Name Not Allowed!!")
    return 0
Case $date1=""
    MsgBox(4096,"Form Validation Error","Blank Date Not Allowed!!")
    return 0
Case $BU1=""
    MsgBox(4096,"Form Validation Error","Blank BU/Team Name Not Allowed!!")
    return 0
Case $EID1=""
    MsgBox(4096,"Form Validation Error","Blank EID No. Not Allowed!!")
    return 0
Case $mobile1=""
    MsgBox(4096,"Form Validation Error","Blank Mobile No. Not Allowed!!")
    return 0
Case $GA1=""
    MsgBox(4096,"Form Validation Error",'Blank "Granting Authority Name" Not Allowed!!')
    return 0
Case $R11=""
    MsgBox(4096,"Form Validation Error","Please Make a Selection for Media Release!!")
    return 0
Case $T11=""
    MsgBox(4096,"Form Validation Error","Please Make a Selection for Media Type!!")
    return 0
Case $R21<>"" And $T21=""
    MsgBox(4096,"Form Validation Error","Please Make a Selection for Media Type No.2!!")
    return 0
Case $R31<>"" And $T31=""
    MsgBox(4096,"Form Validation Error","Please Make a Selection for Media Type No.3!!")
    return 0
Case $R41<>"" And $T41=""
    MsgBox(4096,"Form Validation Error","Please Make a Selection for Media Type No.4!!")
    return 0
Case $R51<>"" And $T51=""
    MsgBox(4096,"Form Validation Error","Please Make a Selection for Media Type No.4!!")
    return 0
    
case Else
    Return 1
EndSelect
EndFunc
Func dataentry()
$sFilePath1 = @ScriptDir & "\Media Management System.xls" 
$oExcel = _ExcelBookOpen($sFilePath1)
For $i=2 to 50000
    $sCellValue = _ExcelReadCell($oExcel, $i, 1)
        if $sCellValue="" then ExitLoop
Next
_ExcelWriteCell($oExcel, ($i-2),$i,1)
_ExcelWriteCell($oExcel, $date1,$i,2)
_ExcelWriteCell($oExcel, $name1,$i,3)
_ExcelWriteCell($oExcel, $EID1,$i,4)
_ExcelWriteCell($oExcel, $item1,$i,5)
_ExcelWriteCell($oExcel, $BU1,$i,6)
_ExcelWriteCell($oExcel, $mobile1,$i,7)
_ExcelWriteCell($oExcel, $GA1,$i,8)
_ExcelWriteCell($oExcel,"OPEN",$i,11)
_ExcelBookSave($oExcel)
_ExcelBookClose($oExcel)
EndFunc

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The example you posted gives me 5 errors and 18 warnings, so I can't see exactly what you mean, but I guess the flickering is caused by the inputbox being updated all the time.

One solution would be to check the current data and/or state of the input box before updating and only update if something has changed.

Edited by Tvern

Share this post


Link to post
Share on other sites

ya it might give errors as it is a snippet of code from my entire script(which is huge, and irrelevant to the problem at hand).. I just posted it for ppl get an idea of what I am trying.. Anyways just ignore the script as my idea isn't working..

Please tell me if u have any idea by which I can enable any input box only when combobox selection is made.

Here's just the GUI part of the script. User will have to select the combo boxes "Release No." and "Media type No." to activate the input box "Build ID". What can be done for this?

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Media Manager", 722, 638, 302, 34)
GUISetBkColor(0xD8E4F8)
$Group1 = GUICtrlCreateGroup("Procurement Form", 5, 0, 713, 633, -1)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label13 = GUICtrlCreateLabel("Release", 157, 352, 45, 19)
$Label14 = GUICtrlCreateLabel("Type Of Media", 469, 352, 85, 19)
$Label15 = GUICtrlCreateLabel("1.", 37, 384, 13, 19)
$Combo1 = GUICtrlCreateCombo("", 93, 384, 169, 25)
GUICtrlSetData(-1, "R 200 or Older|R 301.1|R 301.2|R 301.3|R 310.2|R 310.3|R 311.2|R 400 Old|R 400 Latest ")
$Combo2 = GUICtrlCreateCombo("", 422, 384, 257, 25)
GUICtrlSetData(-1, "Windows 2003 Server OS CD|Windows 2000 Server OS CD|Windows 2000 Client OS CD|Windows XP OS CD|Windows 7 OS DVD|Windows Vista OS DVD|Windows 2008 Server OS DVD|EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")
$Button1 = GUICtrlCreateButton("Enter", 154, 592, 169, 25, 0)
GUICtrlSetBkColor(-1, 0x316AC5)
$Label20 = GUICtrlCreateLabel("Build ID", 312, 352, 48, 19)
$Input7 = GUICtrlCreateInput("", 278, 384, 129, 23)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

EndSwitch
WEnd

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

Manjish,

Please do not post in several forums. >_<

I have posted an answer for you in the GUI forum.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Yes, Will delete.. Didnt mean to double post.. just thought this wasnt the right place to post!!

Was about to delete this thread..


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
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
Sign in to follow this  
Followers 0