Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need increase Listbox size
#1
I am using Listboxes to let users choose items that later make up a string.

Anyway, when I have 8 or more "cases", the lower ones, cases 9, 10, 11, etc, are out of view.

You can select the wrong one, hold down the selection and drag down until the lower ones come in to view.

But how to resize to make all visible at the same time?

thanks
#2
No vertical scrollbar - QM bug.
Listbox height currently cannot be changed.
You can use PopupMenu instead. Or custom dialog.
#3
No toolbar wizard for making popupmenu's so I went to help
and I find that confusing

this is how my list box looks:

sel(list("Look for Email[]Send/Write Email[]Phone[]Create Report" "Action" "Assign an Action"))
case 1
Action = "LOOK FOR EMAIL"
case 2
Action = "SEND/WRITE EMAIL"
case 3
Action = "PHONE"
case 4
Action = "CREATE REPORT"

Can you tell me how to make this into a popupmenu?

Thanks
#4
Replace word list to PopupMenu. Delete "Action" "Assign an Action".
#5
I made the changes and it doesn't error out but it doesn't fire either.

The entire macro runs (other list boxes) but the step involving the PopupMenu just doesn't fire.

Here's what I changed it to:

Macro
Code:
Copy      Help
sel(PopupMenu("Look for Email[]Send/Write Email[]Phone[]Create Report"))
,case 1
,,Action = "LOOK FOR EMAIL"
,case 2
,,Action = "SEND/WRITE EMAIL"
,case 3
,,Action = "PHONE"
,case 4
,,Action = "CREATE REPORT"
#6
Your code is correct. It shows popup menu. Maybe your macro skips the code. Try how it will work in empty macro.
Macro
Code:
Copy      Help
str Action
sel(PopupMenu("Look for Email[]Send/Write Email[]Phone[]Create Report"))
,case 1
,,Action = "LOOK FOR EMAIL"
,case 2
,,Action = "SEND/WRITE EMAIL"
,case 3
,,Action = "PHONE"
,case 4
,,Action = "CREATE REPORT"

out Action
#7
It has something to do with speed.
Isolated it works in its own macro
in debug mode it also works fine.

then I noticed it does flash for a second as if something is chosen but nothing is assigned to the Action string.

here is the code b/f and after in case you see anything - do I need that "ret" at the end of these lists?

Thanks
Macro
Code:
Copy      Help
;get Category
sel(list("UDF[]WOH[]Replen[]None" "Category" "Assign a Project"))
,case 1
,,Category = "UDF"
,case 2
,,Category = "WOH"
,case 3
,,Category = "Replen"
,case 4
,,Category = ""
,case else
,,Category = ""
,,ret

;get Action

sel(PopupMenu("Look for Email[]Send/Write Email[]Phone[]Create Report[]Run Report[]Edit Report[]Create Report[]Create Order[]Adjust Order[]Review[]Present"))
,case 1
,,Action = "LOOK FOR EMAIL"
,case 2
,,Action = "SEND/WRITE EMAIL"
,case 3
,,Action = "PHONE"
,case 4
,,Action = "CREATE REPORT"
,case 5
,,Action = "RUN REPORT"
,case 6
,,Action = "EDIT REPORT"
,case 7
,,Action = "CREATE REPORT"
,case 8
,,Action = "CREATE ORDER"
,case 9
,,Action = "ADJUST ORDER"
,case 10
,,Action = "REVIEW"
,case 10
,,Action = "PRESENT"

;get Task
if(!inp(Task "Task Description" "Task Description")) ret
#8
Maybe because after the first list, activating window goes slowly, and when it is activated, it closes the menu. Insert some delay, 1 or 2 seconds.

Macro
Code:
Copy      Help
2
sel(PopupMenu("Look for Email[]Send/Write Email[]Phone[]Create Report[]Run Report[]Edit Report[]Create Report[]Create Order[]Adjust Order[]Review[]Present"))
#9
that did it
thanks

any way to position these things?
#10
list and PopupMenu have x y arguments. inp doesn't.

Better create custom dialog with 2 listboxes and edit control.

------------------------

This is list replacement function where you can set width and height.
Function list3
Code:
Copy      Help
;/Dialog_Editor
function# $items [$text] [$caption] [hwndowner] [x] [y] [lbwidth] [lbheight]

;Shows dialog with list box, similar to the list() function.
;Returns 1-based index of selected item, or 0 on Cancel.

;items - list of items.
;text - text above the list.
;caption - dialog title bar text.
;x y - dialog coordinates. If 0 - screen center. If negative, relative to the right or bottom of the work area.
;lbwidth lbheight - listbox control width in dialog box units.
;;;Dialog box units depend on system font that is used for dialogs, and usually are about 2 times bigger than pixels. Different horizontally and vertically.
;;;Default (if omitted or 0): 150 75.

;EXAMPLE
;sel list3("one[]two[]three")
,;case 1
,;out 1
,;case 2
,;out 2
,;case 3
,;out 3
,;case else
,;ret


str f=
;BEGIN DIALOG
;0 "" 0x90C80A44 0x108 0 0 %i %i ""
;3 ListBox 0x54230101 0x200 0 24 %i %i ""
;2 Button 0x54030000 0x4 0 %i %i 14 "Cancel"
;4 Edit 0x54030844 0x0 4 4 122 21 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030007 "" "" ""

if(!lbwidth) lbwidth=150
if(!lbheight) lbheight=75
str dd.format(f lbwidth lbheight+24+14 lbwidth lbheight lbheight+24 lbwidth)

str controls = "0 3 4"
str dlg lb3 e4
lb3=items
e4=text
dlg=iif(empty(caption) "QM - Select" caption)
ret ShowDialog(dd &list3_dlg &controls hwndowner 0 0 0 0 x y)

Function list3_dlg
Code:
Copy      Help
;/
function# hDlg message wParam lParam

;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case LBN_SELCHANGE<<16|3
,_i=LB_SelectedItem(lParam)
,DT_Ok hDlg _i+1
,case IDOK
,case IDCANCEL
ret 1
#11
Can listboxes be resizable in the future? Can a verticle scrollbar be added?
#12
yes
scrollbar will be added in QM 2.3.0.7, tomorrow


Forum Jump:


Users browsing this thread: 1 Guest(s)