Jump to content

Some GUI help


Recommended Posts

Hi here's what I want to do,

when I select windows Operating systems(like Windows Vista) in "Release" combobox, the "Type of Media" combobox should get selected to "Operating System Disk" and should be greyed off.

For all other EPKS Releases (like EPKS R301.1), the type of media combobox should remain enabled and user should select whatever he wants. Also in this case the "Operating System Disk" option should be removed from the "Media Type" combobox.

I have done this much.. But not able to remove the flicker.. Please help

#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)
$R1 = GUICtrlCreateCombo("", 93, 384, 169, 25)
GUICtrlSetData(-1, "Windows Server 2000|Windows Client 2000|Windows XP|Windows Server 2003|Windows Server 2008|Windows 7|Windows Vista|EPKS R200 or Older|EPKS R 301.1|EPKS R 301.2|EPKS R 301.3|EPKS R 310.2|EPKS R 310.3|EPKS R 400")
$T1 = GUICtrlCreateCombo("", 422, 384, 257, 25)
GUICtrlSetData(-1, "Operating System Disk|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
    If GUICtrlRead($R1,1)="Windows Server 2000" Or GUICtrlRead($R1,1)="Windows Client 2000" or GUICtrlRead($R1,1)="Windows XP" or GUICtrlRead($R1,1)="Windows Server 2003" or GUICtrlRead($R1,1)="Windows Server 2008" Or GUICtrlRead($R1,1)="Windows 7" Or GUICtrlRead($R1,1)="Windows Vista" And BitAnd(GUICtrlGetState($T1), $GUI_enable) = $GUI_enable Then 
                            GUICtrlSetData($T1,"Operating System Disk")
                            GUICtrlSetState($T1, $gui_disable)
                        ElseIf BitAnd(GUICtrlGetState($T1), $GUI_disable) = $GUI_disable Then
                            GUICtrlSetState($T1, $gui_enable)
                        EndIf
$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
Link to comment
Share on other sites

Ok.. Care to elaborate?

Where to put the sleep.. Could you make changes in my code and illustrate this?

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

Hi,

at beginning of code add

#include <GUIConstantsEx.au3>

Local $select

Edit: This should be the new While Loop:

While 1
    If GUICtrlRead($R1,1)="Windows Server 2000" Or GUICtrlRead($R1,1)="Windows Client 2000" or GUICtrlRead($R1,1)="Windows XP" or GUICtrlRead($R1,1)="Windows Server 2003" or GUICtrlRead($R1,1)="Windows Server 2008" Or GUICtrlRead($R1,1)="Windows 7" Or GUICtrlRead($R1,1)="Windows Vista" And (BitAnd(GUICtrlGetState($T1), $GUI_ENABLE) = $GUI_ENABLE Or BitAnd(GUICtrlGetState($T1), $GUI_DISABLE) = $GUI_DISABLE) Then 
        If $select <> GUICtrlRead ($R1,1) Then
            GUICtrlSetData($T1,"Operating System Disk")
            GUICtrlSetState($T1, $GUI_DISABLE)
            $select = GUICtrlRead ($R1,1)
        EndIf
    ElseIf BitAnd(GUICtrlGetState($T1), $GUI_DISABLE) = $GUI_DISABLE Then
        If $select <> GUICtrlRead ($R1,1) Then 
            GUICtrlSetState($T1, $GUI_ENABLE)
            $select = GUICtrlRead ($R1,1)
        EndIf
    EndIf
    
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd

;-))

Stefan

Edited by 99ojo
Link to comment
Share on other sites

  • Moderators

Manjish,

Use this code in the loop. It should do the trick.

Switch GUICtrlRead($R1)
    Case "Windows Server 2000", "Windows Client 2000", "Windows XP", "Windows Server 2003", "Windows Server 2008", "Windows 7", "Windows Vista"
        If BitAnd(GUICtrlGetState($T1), $GUI_ENABLE) = $GUI_ENABLE Then
            GUICtrlSetState($T1, $GUI_DISABLE)
            GUICtrlSetData($T1, "Operating System Disk")
        EndIf
    Case Else
        If BitAnd(GUICtrlGetState($T1), $GUI_DISABLE) = $GUI_DISABLE Then
            GUICtrlSetState($T1, $GUI_ENABLE)
            GUICtrlSetData($T1, "Operating System Disk|EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")
        EndIf
EndSwitch

M23

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

@M23,

Whats happening with this is that when at first I select any of the windows OS, the 2nd combobox is greyed off with blank data, instead of showing "Operating System Disk". Then if I select EPKS release and then again go back to selecting any OS, then it goes and shows me "Operating System Disk"Also by "GUICtrlSetData($T1, "Operating System Disk|EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")" statement there are multiple similar entries in the combobox "Media Type", which is a headache..

@Snowmaker

I tried putting a delay of 100 ms.. And it seems to work.. Will test it and let u know if I arrive at a solution..

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

Is there any way in which I can delete an option in the combobox? I wanted to delete the "Operating System Disk" option in "Media Type" combobox, if EPKS releases are selected.. Any ideas for this?

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

@Snowmaker

I tried putting a delay of 100 ms.. And it seems to work.. Will test it and let u know if I arrive at a solution..

Ok, hope you figure it out. I did try to post an example, but the text of it was all screwed up. After I deleted that post, I saw two other posts made while (no pun intended..) I was typing.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

  • Moderators

Manjish,

Fussy, aren't we? :(

Add this to your includes - #Include <GuiComboBox.au3> - and use this code in the loop:

Switch GUICtrlRead($R1)
    Case "Windows Server 2000", "Windows Client 2000", "Windows XP", "Windows Server 2003", "Windows Server 2008", "Windows 7", "Windows Vista"
        If BitAnd(GUICtrlGetState($T1), $GUI_ENABLE) = $GUI_ENABLE And _GUICtrlComboBox_GetDroppedState($R1) = False Then
            GUICtrlSetState($T1, $GUI_DISABLE)
            GUICtrlSetData($T1, "Operating System Disk")
        EndIf
    Case Else
        If BitAnd(GUICtrlGetState($T1), $GUI_DISABLE) = $GUI_DISABLE And _GUICtrlComboBox_GetDroppedState($R1) = False Then
            GUICtrlSetState($T1, $GUI_ENABLE)
            _GUICtrlComboBox_SetEditText($T1, "")
        EndIf
EndSwitch

The problems you mentioned should now be fixed. >_<

M23

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

@M23

Still facing the same problem of blank greyed off combobox.

Just check this code. I put a delay as suggested by Snowmaker. Its working just the way I want it to..

But then there's 1 more thing which I need to do. I don't want the "Operating System Disk" option in "Type of Media" combobox when EPKS Releases are selected. 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)
$R1 = GUICtrlCreateCombo("", 93, 384, 169, 25)
GUICtrlSetData(-1, "Windows Server 2000|Windows Client 2000|Windows XP|Windows Server 2003|Windows Server 2008|Windows 7|Windows Vista|EPKS R200 or Older|EPKS R 301.1|EPKS R 301.2|EPKS R 301.3|EPKS R 310.2|EPKS R 310.3|EPKS R 400")
$T1 = GUICtrlCreateCombo("", 422, 384, 257, 25)
GUICtrlSetData(-1, "Operating System Disk|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
    If GUICtrlRead($R1,1)="Windows Server 2000" Or GUICtrlRead($R1,1)="Windows Client 2000" or GUICtrlRead($R1,1)="Windows XP" or GUICtrlRead($R1,1)="Windows Server 2003" or GUICtrlRead($R1,1)="Windows Server 2008" Or GUICtrlRead($R1,1)="Windows 7" Or GUICtrlRead($R1,1)="Windows Vista" And BitAnd(GUICtrlGetState($T1), $GUI_enable) = $GUI_enable Then 
                            GUICtrlSetData($T1,"Operating System Disk")
                            GUICtrlSetState($T1, $gui_disable)
                            sleep(100)
                        ElseIf BitAnd(GUICtrlGetState($T1), $GUI_disable) = $GUI_disable Then
                            GUICtrlSetState($T1, $gui_enable)
                        EndIf

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

EndSwitch
WEnd
Edited by Manjish
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

  • Moderators

Manjish,

Ok, hit taken, there was a "blank greyed off combobox" if you returned to a Windows OS which I have now fixed (fingers crossed!). I have included the whole code this time.

The removal of the "Operating System Disk" option for non Windows OS selections is easy - just remove it from the data stream and reload the combo data.

Changed lines marked <<<<<<<<<<<<<<<<<<<<:

#include <GUIConstants.au3>
#Include <GuiComboBox.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)
$R1 = GUICtrlCreateCombo("", 93, 384, 169, 25)
GUICtrlSetData(-1, "Windows Server 2000|Windows Client 2000|Windows XP|Windows Server 2003|Windows Server 2008|Windows 7|Windows Vista|EPKS R200 or Older|EPKS R 301.1|EPKS R 301.2|EPKS R 301.3|EPKS R 310.2|EPKS R 310.3|EPKS R 400")
$T1 = GUICtrlCreateCombo("", 422, 384, 257, 25)
GUICtrlSetData(-1, "Operating System Disk|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

    Switch GUICtrlRead($R1)
        Case "Windows Server 2000", "Windows Client 2000", "Windows XP", "Windows Server 2003", "Windows Server 2008", "Windows 7", "Windows Vista"
            If BitAnd(GUICtrlGetState($T1), $GUI_ENABLE) = $GUI_ENABLE And _GUICtrlComboBox_GetDroppedState($R1) = False Then
                GUICtrlSetState($T1, $GUI_DISABLE)
                _GUICtrlComboBox_SetEditText($T1, "Operating System Disk") ; <<<<<<<<<<<<<<
            EndIf
        Case Else
            If _GUICtrlComboBox_GetDroppedState($R1) = True Then _  ; <<<<<<<<<<<
                    GUICtrlSetData($T1, "|EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software"  ; <<<<<<
            If BitAnd(GUICtrlGetState($T1), $GUI_DISABLE) = $GUI_DISABLE And _GUICtrlComboBox_GetDroppedState($R1) = False Then
                GUICtrlSetState($T1, $GUI_ENABLE)
                _GUICtrlComboBox_SetEditText($T1, "")
            EndIf
    EndSwitch

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

EndSwitch
WEnd

I hope this one does the trick.

M23

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

M23,

Hey I really appreciate this effort from your side.. The blank I/P box problem has been fixed.. Thanks..

I hate to point out another problem in the above script.. The script is making multiple similar entires in combobox T1

As I said before. E.G. "EXPPlus" is repeated 4 times. The loop's causing it I guess!!

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

  • Moderators

Manjish,

As always, happy to help an old friend. >_<

Sorry, but unlike the problem with my earlier efforts ( :( ), I cannot reproduce this multiple combobox item problem. The data in the line:

GUICtrlSetData($T1, "|EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")

begins with the GUIDataSeparatorChar. From the Help file: "If the "data" starts with GUIDataSeparatorChar or is an empty string "" the previous list is destroyed". So the list should always be replaced, not repeated.

Could you let me have a list of actions which results in multiple items appearing?

M23

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

M..

Checked the code.. its working great!!

Thanks for your help!! The multiple entries problem is not occurring.. The separator character is doing the trick!!

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
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...