Sign in to follow this  
Followers 0
Sunaj

Make a GUICtrlCreateList unselect a single item

8 posts in this topic

#1 ·  Posted (edited)

Well, as stated in the Topic what I would really appreciate help on is the following: 2 list are placed side by side, when one list has a selected item the other should deselect all items automatically?! I searched the web, the forum and the help file hi and lo and came out empty handed. :)

Here is the part of my prg code I need help with:

#include <GUIConstants.au3>
#include <Array.au3>
#include <string.au3>
#Include <GuiList.au3>

Opt("GUIOnEventMode", 1); change to onevent mode
Opt("TrayIconHide", 1); hide icon from icontray

GUICreate("Someapp Preferences", 500, 431); open main gui form
GUISetOnEvent($GUI_EVENT_CLOSE, "closeclicked"); allow for standard exit with onevent stuff
GUICtrlCreateTab(0, 0, 500, 431); creates main gui of tabs, values are: left, top, width, height
GUICtrlCreateTabItem("Someapp Search Plugins"); creates tab for data
$label_list_available = GUICtrlCreateLabel("Available Plugins", 20, 35, 200, 20,"",""); centered label for left plugin list
GUICtrlSetStyle ($label_list_available, $SS_CENTER); center text
GUICtrlSetBkColor ($label_list_available, $GUI_BKCOLOR_TRANSPARENT); make form invisible
$label_list_enabled = GUICtrlCreateLabel("Enabled Plugins", 279, 35, 200, 20,"",""); centered label for right plugin list
GUICtrlSetStyle ($label_list_enabled, $SS_CENTER); center text
GUICtrlSetBkColor ($label_list_enabled, $GUI_BKCOLOR_TRANSPARENT); make form invisible

$plugin_list_available = GUICtrlCreateList("", 20, 52, 200, 340, $LBS_DISABLENOSCROLL + $LBS_NOINTEGRALHEIGHT + $WS_VSCROLL); left available plugin list
update_plugin_list_available(); read *.src files from available plugin directory
GUICtrlSetOnEvent ($plugin_list_available, "plugin_list_available")
$plugin_list_enabled = GUICtrlCreateList("", 279, 52, 200, 340, $LBS_DISABLENOSCROLL + $LBS_NOINTEGRALHEIGHT + $WS_VSCROLL); right enabled plugin list
update_plugin_list_enabled(); read *.src files from enabled plugin directory
GUICtrlSetOnEvent ($plugin_list_enabled, "plugin_list_enabled")

$move2right_plugin_button = GUICtrlCreateButton ("--->", 225, 190, 50); move2right_plugin_button
GUICtrlSetState ($move2right_plugin_button, $GUI_DISABLE)
GUICtrlSetOnEvent($move2right_plugin_button, "move2right_plugin_button"); remember = GUICtrlSetOnEvent
$move2left_plugin_button = GUICtrlCreateButton ("<---", 225, 230, 50); move2left_plugin_button
GUICtrlSetState ($move2left_plugin_button, $GUI_DISABLE)
GUICtrlSetOnEvent($move2left_plugin_button, "move2left_plugin_button"); remember = GUICtrlSetOnEvent
$close_plugin_button = GUICtrlCreateButton ("Close", 215, 400, 70); close button
GUICtrlSetOnEvent($close_plugin_button, "close_plugin_button"); remember = GUICtrlSetOnEvent

GUISetState(@SW_SHOW)


While 1
    Sleep(10); Idle around
WEnd

Func plugin_list_available()
    $checkifselected_plugin_list_available = GUICtrlRead($plugin_list_available)
    If ($checkifselected_plugin_list_available <> "") Then; if left, available list, is selected then do..
    GUICtrlSetState ($move2right_plugin_button, $GUI_ENABLE)
    GUICtrlSetState ($move2left_plugin_button, $GUI_DISABLE)
    EndIf
    GUISetState(@SW_SHOW)
;MsgBox(64, "Information", GUICtrlRead($plugin_list_available))
EndFunc

Func plugin_list_enabled()
    $checkifselected_plugin_list_enabled = GUICtrlRead($plugin_list_enabled)
    If ($checkifselected_plugin_list_enabled <> "") Then; if right, available list, is selected then do..
    GUICtrlSetState ($move2right_plugin_button, $GUI_DISABLE)
    GUICtrlSetState ($move2left_plugin_button, $GUI_ENABLE)
    EndIf
    GUISetState(@SW_SHOW)
;MsgBox(64, "Information", GUICtrlRead($plugin_list_available))
EndFunc

Func move2right_plugin_button()
    MsgBox(64, "Information", GUICtrlRead($plugin_list_available))
EndFunc

Func move2left_plugin_button()
    MsgBox(64, "Information", GUICtrlRead($plugin_list_enabled))
EndFunc

Func close_plugin_button()
    Exit
EndFunc

Func closeclicked()
    Exit
EndFunc

Func update_plugin_list_available()
    For $i = 1 to 3 - 1
        GUICtrlSetData($plugin_list_available,"lalaleft"); put all array data into actual display file
    Next
EndFunc

Func update_plugin_list_enabled()
    For $i = 1 to 3 - 1
        GUICtrlSetData($plugin_list_enabled,"lalaright"); put all array data into actual display file
    Next
EndFunc
Edited by Sunaj

Share this post


Link to post
Share on other sites



Func plugin_list_available()
    $checkifselected_plugin_list_available = _GUICtrlListGetText($plugin_list_available,_GUICtrlListSelectedIndex($plugin_list_available))
    If ($checkifselected_plugin_list_available <> "") Then; if left, available list, is selected then do..
        GUICtrlSetState($move2right_plugin_button, $GUI_ENABLE)
        GUICtrlSetState($move2left_plugin_button, $GUI_DISABLE)
    EndIf
EndFunc   ;==>plugin_list_available

Func plugin_list_enabled()
    $checkifselected_plugin_list_enabled = _GUICtrlListGetText($plugin_list_enabled,_GUICtrlListSelectedIndex($plugin_list_enabled))
    If ($checkifselected_plugin_list_enabled <> "") Then; if right, available list, is selected then do..
        GUICtrlSetState($move2right_plugin_button, $GUI_DISABLE)
        GUICtrlSetState($move2left_plugin_button, $GUI_ENABLE)
    EndIf
EndFunc   ;==>plugin_list_enabled


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Hi gafrost, thnx f quick reply :) , unfortunately I'm not seing any change from using ur code example? I'm using AutoIt v3.2.0.1. With the code below both lists still have focus (on one from each of them) at once - if it is possible what I really want to achieve is to only have focus on in one list at any given time!

Func plugin_list_available()
    $checkifselected_plugin_list_available = _GUICtrlListGetText($plugin_list_available,_GUICtrlListSelectedIndex($plugin_list_available))
    If ($checkifselected_plugin_list_available <> "") Then; if left, available list, is selected then do..
        GUICtrlSetState($move2right_plugin_button, $GUI_ENABLE)
        GUICtrlSetState($move2left_plugin_button, $GUI_DISABLE)
    EndIf
EndFunc   ;==>plugin_list_available

Func plugin_list_enabled()
    $checkifselected_plugin_list_enabled = _GUICtrlListGetText($plugin_list_enabled,_GUICtrlListSelectedIndex($plugin_list_enabled))
    If ($checkifselected_plugin_list_enabled <> "") Then; if right, available list, is selected then do..
        GUICtrlSetState($move2right_plugin_button, $GUI_DISABLE)
        GUICtrlSetState($move2left_plugin_button, $GUI_ENABLE)
    EndIf
EndFunc   ;==>plugin_list_enabled

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
#include <Array.au3>
#include <string.au3>
#Include <GuiList.au3>

Opt("GUIOnEventMode", 1); change to onevent mode
Opt("TrayIconHide", 1); hide icon from icontray

GUICreate("Someapp Preferences", 500, 431); open main gui form
GUISetOnEvent($GUI_EVENT_CLOSE, "closeclicked"); allow for standard exit with onevent stuff
GUICtrlCreateTab(0, 0, 500, 431); creates main gui of tabs, values are: left, top, width, height
GUICtrlCreateTabItem("Someapp Search Plugins"); creates tab for data
$label_list_available = GUICtrlCreateLabel("Available Plugins", 20, 35, 200, 20, "", ""); centered label for left plugin list
GUICtrlSetStyle($label_list_available, $SS_CENTER); center text
GUICtrlSetBkColor($label_list_available, $GUI_BKCOLOR_TRANSPARENT); make form invisible
$label_list_enabled = GUICtrlCreateLabel("Enabled Plugins", 279, 35, 200, 20, "", ""); centered label for right plugin list
GUICtrlSetStyle($label_list_enabled, $SS_CENTER); center text
GUICtrlSetBkColor($label_list_enabled, $GUI_BKCOLOR_TRANSPARENT); make form invisible

$plugin_list_available = GUICtrlCreateList("", 20, 52, 200, 340, BitOR($LBS_DISABLENOSCROLL, $LBS_NOINTEGRALHEIGHT, $WS_VSCROLL)); left available plugin list
update_plugin_list_available(); read *.src files from available plugin directory
GUICtrlSetOnEvent($plugin_list_available, "plugin_list_available")
$plugin_list_enabled = GUICtrlCreateList("", 279, 52, 200, 340, BitOR($LBS_DISABLENOSCROLL, $LBS_NOINTEGRALHEIGHT, $WS_VSCROLL)); right enabled plugin list
update_plugin_list_enabled(); read *.src files from enabled plugin directory
GUICtrlSetOnEvent($plugin_list_enabled, "plugin_list_enabled")

$move2right_plugin_button = GUICtrlCreateButton("--->", 225, 190, 50); move2right_plugin_button
GUICtrlSetState($move2right_plugin_button, $GUI_DISABLE)
GUICtrlSetOnEvent($move2right_plugin_button, "move2right_plugin_button"); remember = GUICtrlSetOnEvent
$move2left_plugin_button = GUICtrlCreateButton("<---", 225, 230, 50); move2left_plugin_button
GUICtrlSetState($move2left_plugin_button, $GUI_DISABLE)
GUICtrlSetOnEvent($move2left_plugin_button, "move2left_plugin_button"); remember = GUICtrlSetOnEvent
$close_plugin_button = GUICtrlCreateButton("Close", 215, 400, 70); close button
GUICtrlSetOnEvent($close_plugin_button, "close_plugin_button"); remember = GUICtrlSetOnEvent

GUISetState(@SW_SHOW)


While 1
    Sleep(10); Idle around
WEnd

Func plugin_list_available()
    $checkifselected_plugin_list_available = _GUICtrlListGetText($plugin_list_available, _GUICtrlListSelectedIndex($plugin_list_available))
    If ($checkifselected_plugin_list_available <> "") Then; if left, available list, is selected then do..
        GUICtrlSetState($move2right_plugin_button, $GUI_ENABLE)
        GUICtrlSetState($move2left_plugin_button, $GUI_DISABLE)
    EndIf
EndFunc   ;==>plugin_list_available

Func plugin_list_enabled()
    $checkifselected_plugin_list_enabled = _GUICtrlListGetText($plugin_list_enabled, _GUICtrlListSelectedIndex($plugin_list_enabled))
    If ($checkifselected_plugin_list_enabled <> "") Then; if right, available list, is selected then do..
        GUICtrlSetState($move2right_plugin_button, $GUI_DISABLE)
        GUICtrlSetState($move2left_plugin_button, $GUI_ENABLE)
    EndIf
EndFunc   ;==>plugin_list_enabled

Func move2right_plugin_button()
    MsgBox(64, "Information", _GUICtrlListGetText($plugin_list_available, _GUICtrlListSelectedIndex($plugin_list_available)))
    _GUICtrlListSelectIndex($plugin_list_available, -1)
EndFunc   ;==>move2right_plugin_button

Func move2left_plugin_button()
    MsgBox(64, "Information", _GUICtrlListGetText($plugin_list_enabled, _GUICtrlListSelectedIndex($plugin_list_enabled)))
    _GUICtrlListSelectIndex($plugin_list_enabled, -1)
EndFunc   ;==>move2left_plugin_button

Func close_plugin_button()
    Exit
EndFunc   ;==>close_plugin_button

Func closeclicked()
    Exit
EndFunc   ;==>closeclicked

Func update_plugin_list_available()
    For $i = 1 To 3 - 1
        GUICtrlSetData($plugin_list_available, "lalaleft" & $i); put all array data into actual display file
    Next
EndFunc   ;==>update_plugin_list_available

Func update_plugin_list_enabled()
    For $i = 1 To 3 - 1
        GUICtrlSetData($plugin_list_enabled, "lalaright"); put all array data into actual display file
    Next
EndFunc   ;==>update_plugin_list_enabled

you should be able to figure out the rest.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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