Jump to content

A dropdown list with CheckBoxes


protoid
 Share

Recommended Posts

You can start reading this specific section of how to create an owner-drawn combo-box control. I've made once an owner-drawn combo-box that can show items with different color using modified size of each line and thus allowing to increase font size without truncating the string. I think that the icon example is something closer to a check-box combo-box control.

Good lick.

Link to comment
Share on other sites

You can start reading this specific section of how to create an owner-drawn combo-box control. I've made once an owner-drawn combo-box that can show items with different color using modified size of each line and thus allowing to increase font size without truncating the string. I think that the icon example is something closer to a check-box combo-box control.

Good lick.

From what I understood from your link, the closest possible thing to what I want to do is to draw pictures of checked or unchecked check-boxes in the combo-box

I've never used lists before and I'm looking at them as a possibility- can they contain check-boxes (easily)?

I'm creating a GUI version of a previously paper survey, and there are numerous instances of rows of check-boxes that wouldn't easily fit on the average user's monitor (one question in front of me has 24). Any feasible alternatives anyone could think of would be appreciated :)

EDIT: By the way- thanks for the laugh (your closing line) :)

Edited by protoid
Link to comment
Share on other sites

...

I'm creating a GUI version of a previously paper survey, and there are numerous instances of rows of check-boxes that wouldn't easily fit on the average user's monitor (one question in front of me has 24). Any feasible alternatives anyone could think of would be appreciated :)

...

It is quite easy to have a listview with checkboxes and with a vertical scroll bar to see them all so maybe tat would be easier than an OD Combo.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

It is quite easy to have a listview with checkboxes and with a vertical scroll bar to see them all so maybe tat would be easier than an OD Combo.

I'm writing the program for my boss ( he's a statistician)

he's insistant that all of the choices have to be visible at once.

I'm still thinking of alternatives- maybe a combobox with an add button next to it and a listview to see what's been added

Link to comment
Share on other sites

I'm writing the program for my boss ( he's a statistician)

he's insistant that all of the choices have to be visible at once.

I'm still thinking of alternatives- maybe a combobox with an add button next to it and a listview to see what's been added

Assuming of course that there aren't so many choices that you can't fit them all on the screen. I'm glad I haven't got a boss :) (Whoops, here comes my wife!)

Anyway here's a small example to show that checkboxes in listviews need not be difficult.

; *** Start added by AutoIt3Wrapper ***
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <guilistview.au3>
; *** End added by AutoIt3Wrapper ***
#AutoIt3Wrapper_Add_Constants=n
$gui1 = GUICreate("lv+checkboxes example", 700, 500, 200, 200, BitOR($Ws_SIZEBOX, $GUI_SS_DEFAULT_GUI))

Global $ListView1 = GUICtrlCreateListView("some heading", 1, 0, 200, 476, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS, $WS_VSCROLL), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_FLATSB))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 178)

_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))

GUISetState()
_AddLVItems()
While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then Exit

WEnd


Func _AddLVItems()
    $aText = StringSplit(StringStripWS(StringReplace(FileRead(@ScriptFullPath), @CR, ' '), 4), ' ')

    For $n = 1 To 20
    _GUICtrlListView_AddItem($ListView1, $aText[$n]);, $iIm)
    Next

EndFunc ;==>_AddLVItems
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanks for the example :)

most if the questions with multiple checkboxes have either around 5-10 choices, or close to 25

I may use checkboxes in a list for the smaller ones, but I'm still wondering how I'll display 25 checkboxes at once

a question about the example- how would I add an unknown number of checkboxes to my GUI message loop? I'm planning on having them in an array

what I've tried so far with a test script with 20 checkboxes has either been unsuccessful or incredibly slow

Link to comment
Share on other sites

Thanks for the example :)

most if the questions with multiple checkboxes have either around 5-10 choices, or close to 25

I may use checkboxes in a list for the smaller ones, but I'm still wondering how I'll display 25 checkboxes at once

a question about the example- how would I add an unknown number of checkboxes to my GUI message loop? I'm planning on having them in an array

what I've tried so far with a test script with 20 checkboxes has either been unsuccessful or incredibly slow

To add an unknow number of components to a message loop:

Create them in an array as you said

Dim $aChkBox[10];say 10 to start with

For $n = 0 to $numberToMake
 if $n > UBound($aChkBox) then ReDim $aChkBox[$n+5]
 $aChkBox[$n] = guiCtrlCreate....blah blah, using $n to calculate positions
next


while 1
 $msg = GuiGetMsg()
 switch $msg
 Case $aChkBox[0] to $aChkBox[Ubound($aChkBox) - 1]
    $iChkBox = -1
    for $n = 0 to Ubound($aChkBox) - 1
    if $aChkBox[$n] = $msg then
    $iChecBox = $n
    exitloop
    endif
    Next
    ..
....
..
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...