1. ComboBox behaviour in win32Lib
- Posted by Mike777 Aug 08, 2008
- 894 views
1) When win32Lib builds a combobox, it does so with a style flag that limits the text one can type in the control to the width of the control...is there a way to change that behavior so that it functions like a text box (allowing input longer than the size of the box)?
2) Other than inserting an OnChange event which compare s what has been typed into the ComboBox to the item values and rejects any keys which result in a non-match, is there a simpler way to do what us old Access programmers call "Limit to List"?
Thanks
Mike
2. Re: ComboBox behaviour in win32Lib
- Posted by DerekParnell (admin) Aug 08, 2008
- 861 views
Does the DropDownList control suit?
3. Re: ComboBox behaviour in win32Lib
- Posted by Mike777 Aug 08, 2008
- 879 views
Does the DropDownList control suit?
Forgot to mention that I'm using newUIObj so I don't think I can specify that. Can I change an already created control to include that?
4. Re: ComboBox behaviour in win32Lib
- Posted by DerekParnell (admin) Aug 08, 2008
- 884 views
Forgot to mention that I'm using newUIObj so I don't think I can specify that. Can I change an already created control to include that?
I don't see why not. newUIObect supports all control types.
5. Re: ComboBox behaviour in win32Lib
- Posted by Mike777 Aug 08, 2008
- 893 views
Does the DropDownList control suit?
Forgot to mention that I'm using newUIObj so I don't think I can specify that. Can I change an already created control to include that?
I have a feeling I can find the Flag that needs to be set to create that attribute. Thanks.
6. Re: ComboBox behaviour in win32Lib
- Posted by Mike777 Aug 08, 2008
- 882 views
Does the DropDownList control suit?
The newUIObj docs specify that the control is built with the CBS_DROPDOWN attribute. Further, they say: In addition to being able to select a value from the combo's list, the user can enter their own value as well.
I'm trying to eliminate the ability of the user to enter their own value.
Mike
7. Re: ComboBox behaviour in win32Lib
- Posted by Mike777 Aug 08, 2008
- 897 views
Does the DropDownList control suit?
The newUIObj docs specify that the control is built with the CBS_DROPDOWN attribute. Further, they say: In addition to being able to select a value from the combo's list, the user can enter their own value as well.
I'm trying to eliminate the ability of the user to enter their own value.
OK, never mind. There is a separate control type, in addition to Combo, called DropDownList. Got it.
8. Re: ComboBox behaviour in win32Lib
- Posted by Mike777 Aug 08, 2008
- 920 views
Does the DropDownList control suit?
The newUIObj docs specify that the control is built with the CBS_DROPDOWN attribute. Further, they say: In addition to being able to select a value from the combo's list, the user can enter their own value as well.
I'm trying to eliminate the ability of the user to enter their own value.
OK, never mind. There is a separate control type, in addition to Combo, called DropDownList. Got it.
Now, I'm back where I started. My routines are built upon the combo boxes being, well, "combo" controls and not DropDownList controls.
So I renew my original question: is there a way to modify the flags of the combo such that the computer will treat it like a DropDownList control in that it will not allow an entry other than what is in the list?
Thanks
Mike
9. Re: ComboBox behaviour in win32Lib
- Posted by CChris Aug 08, 2008
- 873 views
1) When win32Lib builds a combobox, it does so with a style flag that limits the text one can type in the control to the width of the control...is there a way to change that behavior so that it functions like a text box (allowing input longer than the size of the box)?
2) Other than inserting an OnChange event which compare s what has been typed into the ComboBox to the item values and rejects any keys which result in a non-match, is there a simpler way to do what us old Access programmers call "Limit to List"?
Thanks
Mike
I'll check the flag, but I'm not sure what you are asking for is the expected thing. I'll look.
What could be simpler than checking the contents when change is validated? The only way would be to wrap the COM object that does this, and I don't think it's worth the pain.
CChris
10. Re: ComboBox behaviour in win32Lib
- Posted by Mike777 Aug 08, 2008
- 873 views
- Last edited Aug 09, 2008
Thanks. As fas as the second item, using newUIObj means that I only have the ability to either assign one validate function to all combo's or I need a separate validate function for each combo. Anything in between would require some sort of naming convention which I'm trying to avoid. I guess I could assign a specific name of LTL to any combo that I wanted to Limit To List and then activate the validate (OnChange) event only for those whose names matched.
11. or thRe: ComboBox behaviour in win32Lib
- Posted by CChris Aug 11, 2008
- 861 views
I still don't get why you use a combo where a dropdownlist is what you need. If you want to limit input to list, what is the point of having an edit field with free content you validate afterwards? Just have your user choose from the list by dropping it down.
I must be missing something obvious.
If you need a particular style for the list, there is quite a variety of them. If you use the IDE, then it provides an FList component developed by A. Drummond which is even more flexible than a plain list.
If what you need is a dropdown list with images, then I would go owner drawn. You can implement owner drawn controls using win32lib as it is, but need to deal with raw Windows messages. There are long term plans for that.
Otherwise, I need your explaining what you want to achieve.
CChris
12. Re: or th ComboBox behaviour in win32Lib
- Posted by Mike777 Aug 11, 2008
- 872 views
I still don't get why you use a combo where a dropdownlist is what you need. If you want to limit input to list, what is the point of having an edit field with free content you validate afterwards? Just have your user choose from the list by dropping it down.
... Otherwise, I need your explaining what you want to achieve.
They are two entirely separate requests.
In one case I don't want a limit-to-list at all. In fact, I want to be able to type more in the combo box than what will fit based on the font. Obviously, I could try to expand the combo box to hold the largest possible entry, but that doesn't look good in all cases.
In the other, I want to limit-to-list and I can use the DropDownList concept, but I have a lot of code surrounding the generation of Combo controls and would have to do a bit of surgery to change to DropDownList controls. While doable, if I could find a way to just change a flag and coerce the behavior of a Combo into a DropDownList it would be simpler for me at this point in time for this particular project.
Sorry I didn't make it clear they were not related inquiries.
Mike
13. Re: or th ComboBox behaviour in win32Lib
- Posted by CChris Aug 11, 2008
- 875 views
I still don't get why you use a combo where a dropdownlist is what you need. If you want to limit input to list, what is the point of having an edit field with free content you validate afterwards? Just have your user choose from the list by dropping it down.
... Otherwise, I need your explaining what you want to achieve.
They are two entirely separate requests.
In one case I don't want a limit-to-list at all. In fact, I want to be able to type more in the combo box than what will fit based on the font. Obviously, I could try to expand the combo box to hold the largest possible entry, but that doesn't look good in all cases.
Did you try
w32VOID=sendMessage(getEdit(my_combo), EM_LIMITTET, 0, some_reasonable_max_value)?
Oops, perhaps the last two need being swapped. Try both ways.
In the other, I want to limit-to-list and I can use the DropDownList concept, but I have a lot of code surrounding the generation of Combo controls and would have to do a bit of surgery to change to DropDownList controls. While doable, if I could find a way to just change a flag and coerce the behavior of a Combo into a DropDownList it would be simpler for me at this point in time for this particular project.
Sorry I didn't make it clear they were not related inquiries.
Mike
Now it is clear. If you pore over the internals of Windows notifications, you'll see that combos are completely different from lists internally. So I wouldn't even expect there being a flag, everything else is different under the hood. Lists existed in Windows 3.0, combos are from one or two generations later.
Unless your code actually uses specific features of combo boxes - and it doesn't look so from your descrition -, then I'd try refactoring and use the right control in the right place. If there is a technical issue stemmo,ng from what's in your code, then I can help with the refactoring perhaps.
You may have noticed that dev/doc work on Eu4.0 has gotten priority. My being off the net for 15+ days didn't help. I haven't started doing anything on win32lib 0.70.5.
CChris
14. Re: or th ComboBox behaviour in win32Lib
- Posted by Mike777 Aug 11, 2008
- 868 views
Now it is clear. If you pore over the internals of Windows notifications, you'll see that combos are completely different from lists internally. So I wouldn't even expect there being a flag, everything else is different under the hood. Lists existed in Windows 3.0, combos are from one or two generations later.
Unless your code actually uses specific features of combo boxes - and it doesn't look so from your descrition -, then I'd try refactoring and use the right control in the right place. If there is a technical issue stemmo,ng from what's in your code, then I can help with the refactoring perhaps.
You may have noticed that dev/doc work on Eu4.0 has gotten priority. My being off the net for 15+ days didn't help. I haven't started doing anything on win32lib 0.70.5.
I'll refactor. There is nothing technical standing in the way. I'll let you know on the text length, also.
Thanks
Mike