Recent

Author Topic: Combobox with Checkboxes Control Lazarus Package  (Read 21648 times)

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Combobox with Checkboxes Control Lazarus Package
« on: September 07, 2014, 05:30:13 pm »
I wasn't able to find an appropriate place for this
In response to this post
 [ http://forum.lazarus.freepascal.org/index.php/topic,25630.msg155836.html#msg155836 ]
i finished a combosite control that mimic's the behavior of a Combobox with Checkboxes
and thought it would be nice to share it
Curren Version : v00.19
Last Updated: 4/11/2014 23:54:45
Added:
AllowGrayed
ArrowKeysTraverseList
AutoComplete (Append-Suggest-AppendSuggest + External Lists Supported + Custom Search)
CharCase
Default text when the style is sccDropDownList [ DefTextDDList]
DropButtonStyle
ExtendedSelect
HotTrack
IntegralHeight
MultiSelect
ShowCheckBoxes
Styles
Separated List Events And Properties
-----------------------------------------
Github Lazarus Package
packageComboCheckBox


« Last Edit: November 04, 2014, 11:39:39 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Composite Control Comobox with Checkboxes
« Reply #1 on: September 07, 2014, 05:40:16 pm »
I'm working on it too, together with port of Delphi's TComboBoxEx (see http://bugs.freepascal.org/view.php?id=26515).
So we can compare code.

I took inspiration in TCheckListBox so each item of combo can be unchecked/grayed/checked and also disabled/enabled.

EDIT: Hmm, you did it as a frame.
« Last Edit: September 07, 2014, 05:46:16 pm by Blaazen »
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Composite Control Combobox with Checkboxes
« Reply #2 on: September 07, 2014, 05:46:38 pm »
i was sure about you  ::)
you would figure it out no matter what
i just started with lazarus and free pascal and this is the solution i came up with the knowledge i own until know
Is just a frame with edit/bitbutton and checkboxlist
« Last Edit: September 11, 2014, 09:24:58 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Composite Control Comobox with Checkboxes
« Reply #3 on: September 07, 2014, 05:49:09 pm »
yes as frame but gets the job done  :)
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re:UPD-Composite Control Combobox with Checkboxes
« Reply #4 on: September 07, 2014, 09:58:37 pm »
A modification to open upwards when the position is at the bottom of a form
and small demo project
« Last Edit: September 26, 2014, 01:19:58 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Composite Control Comobox with Checkboxes
« Reply #5 on: September 08, 2014, 12:18:27 am »
A modification to open upwards when the position is at the bottom of a form
I think it should open upwards when there is not enough space outside the form, not inside the form. Like when the form is close to the bottom of the screen.

When I open the list, the edit loses focus, shouldn't the caret stay active in the edit?

I can not open the list with the keys, like Alt+Down Arrow on Windows.

When the list is open, I can not move up and down using the keyboard.

Thank you.

1st Edit:
The list was open when I switched to the browser to write this post, when I switched back to the sample application the list was still open. I expected it to be closed.

2nd Edit:
I just noticed that the list shows up in a random location first before it moves to where it should be, or am I imagining that?
« Last Edit: September 08, 2014, 12:24:35 am by engkin »

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re:UPD- Composite Control Combobox with Checkboxes
« Reply #6 on: September 08, 2014, 05:34:50 am »
Thank you very much @engkin for your response and your time to test it
Quote
I think it should open upwards when there is not enough space outside the form, not inside the form. Like when the form is close to the bottom of the screen.
Yes thats correct but i do not know how to do this so for now works only inside the form
Quote
When I open the list, the edit loses focus, shouldn't the caret stay active in the edit?
Had in mind a read only control if you notice the TEdit property ReadOnly is set to True
Quote
I can not open the list with the keys, like Alt+Down Arrow on Windows.
Added support for keys
 [on Edit_KeyDown][on BitBtn_KeyDown]                                 Alt+Down Arrow -> open Alt+Up Arrow-> close
 [on BitBtn_KeyDown]                                                             space and enter toggle  open/close
Quote
When the list is open, I can not move up and down using the keyboard.
Fixed Forced Focus on Tab when the list is open you can press tab to go on the list / arrow keys to move up and down and space to check uncheck items.
Quote
The list was open when I switched to the browser to write this post, when I switched back to the sample application the list was still open. I expected it to be closed
Solved partially  not the best solution but it will work fine most of the time
Quote
I just noticed that the list shows up in a random location first before it moves to where it should be, or am I imagining that?
Fixed.... your imagination is just fine
                           
« Last Edit: September 26, 2014, 01:20:11 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re:UPD- Composite Control Combobox with Checkboxes
« Reply #7 on: September 08, 2014, 01:05:56 pm »
List open upwards  when there is not enough space between form and screen
« Last Edit: September 26, 2014, 01:20:22 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re:UPD- Composite Control Combobox with Checkboxes
« Reply #8 on: September 08, 2014, 02:43:15 pm »
Hide the list on form deactivate
-------------------------------------------
I think all @engkin spots are done !
hope it will be useful
« Last Edit: September 26, 2014, 01:22:41 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

zeljko

  • Hero Member
  • *****
  • Posts: 1768
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Composite Control Comobox with Checkboxes
« Reply #9 on: September 08, 2014, 03:38:43 pm »
I'm working on it too, together with port of Delphi's TComboBoxEx (see http://bugs.freepascal.org/view.php?id=26515).
So we can compare code.

I took inspiration in TCheckListBox so each item of combo can be unchecked/grayed/checked and also disabled/enabled.

With Qt widgetset it's possible without extra coding (comboBox with checkboxes) , but of course general, LCL drawn solution is better in this case.

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Composite Control Comobox with Checkboxes
« Reply #10 on: September 08, 2014, 04:10:48 pm »
The form loses focus when I open a list.

If I press and hold the left button of the mouse on the form title after I open a list, it closes up after like a quarter of a second. If I try to open that same list again, it does not show the first time, but it does the second time.

I opened the list of one of the lower boxes then moved the form away, the list stayed open in its location. I expected the list to disappear. Maybe this explains the previous one.

Now I can open the list with Alt+Down, but I can't close it with, say, Escape or Alt+Up.

I can't move up and down right away using the keyboard, I have to click on the list first.

The list shows partial item, I expect it to show whole items only.

1st Edit:
Pressing Tab does not move the focus to the next control.

2nd
Now it does show the list outside the form. When it is close to the bottom of the screen, the list goes behind the Task Bar instead of in front of it.
« Last Edit: September 08, 2014, 04:29:32 pm by engkin »

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re:UPD- Composite Control Combobox with Checkboxes
« Reply #11 on: September 08, 2014, 08:13:44 pm »
Quote
If I try to open that same list again, it does not show the first time, but it does the second time.
Fixed
Quote
Now I can open the list with Alt+Down, but I can't close it with, say, Escape or Alt+Up.
Fixed
Quote
I can't move up and down right away using the keyboard, I have to click on the list first.
Fixed
Quote
Pressing Tab does not move the focus to the next control.
Fixed
Quote
When it is close to the bottom of the screen, the list goes behind the Task Bar instead of in front of it.
Always will show upwards if it is near the bottom of the screen

Quote
The form loses focus when I open a list.
v 0.05 and v 0.06 uses a tform to display the list in my case this is not a problem but if it is for you then go for v 0.04
Quote
The list shows partial item, I expect it to show whole items only.
i dont anderstand this
i set the thing to show full max 6 items
 you can modify this to suit your needs
« Last Edit: September 26, 2014, 01:20:46 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Composite Control Comobox with Checkboxes
« Reply #12 on: September 09, 2014, 12:54:11 am »
Quote
The list shows partial item, I expect it to show whole items only.
i dont anderstand this
Check the attached image. I opened the top list. As you can see, six items and a part of the seventh item are visible. I also noticed that the bottom list shows a bigger section of the seventh item.

1st Edit:
I opened a list, hit F10, and moved the form away with the mouse, I found the list waiting for me behind the form. I tried again, got an application error.

2nd Edit:
Quote
Always will show upwards if it is near the bottom of the screen
Now it opens upwards even when there is enough space for the visible items below the edit.

3rd Edit:
Your last sample application has three controls. To move between these controls using Tab, I have to press Tab six times. I expected three times to be enough.

4th Edit:
The list has multi-select enabled. If you press and hold on one item and move the mouse, for instance, toward the last item, all the items in between get selected. Is that intentional?
If you move to another list and then back to the previous one, you see the same items that were selected are still selected.

Open a list and press Windows Key+R (shortcut for Run Window), the list stays open. Now you can switch back and forth using Alt+Tab and the list stays open and the form does not become active.
« Last Edit: September 09, 2014, 02:08:35 am by engkin »

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Composite Control Comobox with Checkboxes
« Reply #13 on: September 09, 2014, 02:47:37 am »
Check the attached image. There is a dark line on the right side of the drop down button.

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Composite Control Combobox with Checkboxes
« Reply #14 on: September 09, 2014, 12:41:55 pm »
hello engkin
Quote
Now it opens upwards even when there is enough space for the visible items below the edit.
if you have an app tha needs to show the list so low on the screen you can modify this line to suit your needs
Code: [Select]
Edit_.ControlToScreen(Point(0,0)).y+CheckListBox_.Height)
Quote
Your last sample application has three controls. To move between these controls using Tab, I have to press Tab six times. I expected three times to be enough.
yes because the button gets the focus also
Quote
The list has multi-select enabled. If you press and hold on one item and move the mouse, for instance, toward the last item, all the items in between get selected. Is that intentional?
If you move to another list and then back to the previous one, you see the same items that were selected are still selected.
yes the list is a tchecklistbox you can change the property from the property editor
Quote
Open a list and press Windows Key+R (shortcut for Run Window), the list stays open. Now you can switch back and forth using Alt+Tab and the list stays open and the form does not become active.
As long as the list is open the form cant become active
i will review the control later in the day
thank you very much engkin
« Last Edit: September 11, 2014, 09:26:18 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

 

TinyPortal © 2005-2018