Adding Items to ComboBox

Started by Sean Roe, June 18, 2004, 01:19:36 AM

Previous topic - Next topic

Sean Roe

I am using the following code to populate a combobox. When I dropdown the combobox I can see my items but the area in the list portion is black until I move the mouse up and down the list. I must be doing something wrong or forgetting something. Any suggestions?

FUNCTION FRMTABLES_WM_CREATE (hWndForm AS DWORD) AS LONG
DIM i AS LONG

FOR i = 0 TO UBOUND(aTableNames)
   FF_COMBOBOX_ADDSTRING HWND_FRMTABLES_CBOTABLE, aTableNames(i)
NEXT

END FUNCTION


Thanks,
Sean

Sean Roe

Turning off Enable WinXP Theme Support in the Environment Options seemed to fix this problem.

So maybe add it to things to look at for FireFly?

Thanks again,
Sean

TechSupport

WinXP Themes has been a big pain in the ...... :)  I will need to do more indepth analysis of WinXP integration to ensure side effects like you describe disappear.

David Martin

FYI ... I noticed something similar, except the  drop down in my combo was only a border ... other than where there were actual words you could still see the items behind it.

Roger Garstang

Don't know how many of you have XP, but it looks funky on XP too.  I filled mine with numbers 0-50 and some numbers were even drawn over too far to the left and over the border???

This is very weird.  Listboxes haven't given me any problems...maybe there needs to be some special processing when the list pops up in a combo?

Roger Garstang

Also, what is the reason behind all of the ghWinXP_Lib stuff and loading the UxTheme.dll?  I can take out all of those lines and still have the XP look.  PBforms as far as I know doesn't even do this.  I used to just add my XP XML to my resource and that alone told the OS what version to display the form with and show the XP look.

It looks like to make use of the dll you need to process each control and use things like SetWindowTheme and OpenThemeData to setup the look of the control, but I'm not finding much on these in the inc files.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/cookbook.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xptheming.asp

may help...it shows imagelist stuff too which might fix the tab control problem.

Roger Garstang

Found the site below with the declares needed in VB, maybe we need to have a inc file added to FF with these declares so the controls can be drawn using themes if they are on or regular if not.  Looks like even if the OS is XP and themes are on you can call SetWindowTheme with null strings and have controls with themes off!  :D Maybe we need to just do away with the manifest since it doesn't work right anyway and just use the function calls.  Then our app can use either and not have the extra added size of the manifest.  Download his example, he displays everything the themes can and has tab control pieces with icons and text and no problems!  Probably need to make wrappers to draw on them after the control is created, and for WM_PAINT and the ThemeChange that is sent when the Themes Change.

http://www.vbaccelerator.com/home/VB/Code/Libraries/XP_Visual_Styles/Drawing_with_XP_Visual_Styles/article.asp

TechSupport

Thanks Roger, I will definately check out the links. I have used Steve's stuff from vbAccelerator a lot back in my VB programming days.

WinXP is not my main operating system. I have a laptop set up with XP installed, however I do all my development on a Win2K machine.

Roger Garstang

Yeah, I had used 2K back when it first came out, it was buggy and wouldn't work with my hardware, so I went to ME and then XP.  I used 2K at work a few months back and it was pretty stable now though.  My PC had a menu problem though and all menus were centered until highlighted and it needed reinstalled.

Doing away with the manifests would be a good way to test it too then they won't draw with XP by default and only with the functions.  Maybe make the XP option in the properties just set a value that tells it to try to draw with XP.  And turning off XP support then wouldn't have the manifest or extra theme code, so smaller exe's.  It looks like for the basic controls you can give it the class and it will handle all states of it.  Some of the advanced ones you may need to handle more, but I'd try to keep it simple first and let the dll handle what it can.  Might need to have the tab control as a special case and create the imagelist different if XP (32 bit), and for the rest just reload the themes when they change.

Anonymous

Hello,

I just encountered this problem today, and was checking the forums to see if it had been addressed before.  While this isn't too technical, the following solution has solved most of the problem for me (pending a better fix).

FF_COMBOBOX_ADDSTRING HWND_FORM_COMBO, "TEXT" & SPACE(50)

Of course, change '50' to whatever you need.

This does leave a very small line of black to the left of the combobox text, but it does keep the text and everything to the right of it white.

Hope this is helpful to someone,

John

TechSupport

The XP problem has been fixed in the latest beta (1.07).
John, I will send you a private mail on the matter.