Yes, but that height is too short. You'll see ;)
Attached the latest version with the XP styled edge and button. It uses the vbAccelerator UxTheme class, and I'm not sure how it will behave on pre-XP systems.
Printable View
Yes, but that height is too short. You'll see ;)
Attached the latest version with the XP styled edge and button. It uses the vbAccelerator UxTheme class, and I'm not sure how it will behave on pre-XP systems.
Can't wait to try it out. I've been following the progress closely. :thumb:
Nooooooooooooooooooooooooo ;) :pQuote:
Originally Posted by baja_yu
Here is a small correction, plus I added the DropList procedure (ColapseList is also available).
I am not sure what we can do about the height, as it is set automatically.
Maybe we can replace lstChoice with something else. Or can it be subclassed to change the row height?
Gee... I kept refreshing the second page, and I see now we are on the 3'rd page :D
This is the longest thread I've even been subscribed to :)
There is one more 'bug':
If nothing is selected, and you try to use the SelectedItem property, and error is raised.
Penagate, are you working on implementing the events? (MouseDown, MouseUp, Click etc..)
DropList works nicely :thumb: What was the small correction you made?Quote:
Originally Posted by baja_yu
FYI, apart from adding the styling, I also changed the double DoEvents call in the slideout routine to more efficient GetMessage/TranslateMessage/DispatchMessage calls. This makes the sliding a lot smoother and quicker.
Ammm.... is it supposed to look like this ?
I think there was none. Only the DropList. I am fidling around with the row height thing.
D'oh, your not using XP are you. That means we will have to add an OS check, and if the OS is not XP then we will have to draw the button and edge normally.
Guess XP styles dont work on non XP systems. How 'bout we incorporate windows version detection. That way we can turn on the XP style if the system is XP.Quote:
Originally Posted by CVMichael
Fixed :)Quote:
Originally Posted by baja_yu
I have done ShowDropDown, HideDropDown, MouseDown, MouseMove, MouseUp. What others should we have?Quote:
Originally Posted by baja_yu
Actually I'm using Windows XP Home edition, but the Display Settings are the "Classic Style"
We'll have to incorporate a check for that too :)Quote:
Originally Posted by CVMichael
We could also have KeyPress, KeyDown, KeyUp, LostFocus events.
LostFocus and GotFocus are auto added by VB. I will code the other ones though, and also keyboard support (Alt+Down to drop list, arrow keys to select, etc.)
Great. I'm going to poke around to find a way to detect if XP styles are turned on or off...
I don't have time to look now and see how you do the XP styles, but theoretically, when you call the API functions to do the XP style thing, doesn't it return an error ? That way you know if the XP Syles are enabled or not ?
OK here is my latest version. Now supports keyboard selection and Alt+Down and Alt+Up to drop and collapse the listview.
I'm hitting the sack, so the code is back to you guys ;)
How about ColumnClick and DblClick?Quote:
Originally Posted by penagate
There was a small bug, keyboard selection does not work if you drop down the list using the mouse. The list did not get the focus.
Here is the correction.
I'm still trying to figure out the XP style problem, and the row height problem...
The row height problem can be fixed in the UserControl_Resize()
But then it won't look right on non-xp style (wich I'm using by the way)VB Code:
If UserControl.Height > FntSize + 60 Then UserControl.Height = FntSize + 60 End If
I'm not using the xp stype because I don't really like it, and also I want to same some CPU by not drowing fancy stuff on the screen.
I'm looking for a way to determin if the XP styles are turned on or not so we can draw the controls accordingally.
What if we just make it as a property ? Something like "DrawXPStyle = True" ?
Then if the user want XP Syle, he can have it... (make it default False)
That's not a bad idea. It would be much easier then to mess around with detecting windows version, then the XP style etc.
That does fix the height, but it cuts of a part of the button (in XP style at least). I've been searching around to find a way to increase the height of the row, but I'm begining to think it is not possible without changing the font...Quote:
Originally Posted by CVMichael
Just make the picDrop height smaller, I have it set to: Height = 225, Width = 255Quote:
Originally Posted by baja_yu
I am not sure that the size of the picDrop can be changed. I think it is set by Windows. Looks like we'll have to wait for Penagate to check it out. He knows that code best.
Well, I changed it, and it works...
Just tried out the latest in XP with Classic style.
It doesn't work
Maybe we could use this function to test for themesVB Code:
Option Explicit Private Declare Function GetCurrentThemeName Lib "UxTheme.dll" ( _ ByVal pszThemeFileName As String, _ ByVal dwMaxNameChars As Long, _ ByVal pszColorBuff As String, _ ByVal cchMaxColorChars As Long, _ ByVal pszSizeBuff As String, _ ByVal cchMaxSizeChars As Long _ ) As Long Const S_OK = 0 Function isThemePresent() As Boolean Dim BufferLen As Long BufferLen = 256 Dim lResult As Long Dim ThemeName As String Dim ColorBuffer As String Dim SizeBuffer As String ThemeName = String(BufferLen, 0) ColorBuffer = String(BufferLen, 0) SizeBuffer = String(BufferLen, 0) isThemePresent = False On Error GoTo NotXP lResult = GetCurrentThemeName( _ ThemeName, BufferLen, _ ColorBuffer, BufferLen, _ SizeBuffer, BufferLen _ ) On Error GoTo 0 If lResult = S_OK Then isThemePresent = True NotXP: End Function
I get error code (&H80070490): Element not found: since I don't have a theme
Can someone try it with a theme?
Very nice moeur, it works !
I tried it with XP Style, and It returned True, then I changed my settings to Classic Style, and it returned False
I guess now we have to wait for penagate to incorporate it in the control...
It gives True on my PC.
This might be a little simpler
It returns 0 if no style is applied to a window, otherwise it returns the handle to the style.VB Code:
Private Declare Function GetWindowTheme Lib "UxTheme.dll" ( _ hwnd As Long _ ) As Long
I think I got it. It now tests for Themes and adjusts looks accordingally.
Anyone want to test? :)
EDIT: New attachment. A small cosmetical correction.
Yup, It works fine on both styles XP & Classical...
By the way, why do you always indent all the code ? It's so anoying, I always have to indent back on all the modules when I download code from you...
:) I dont know, I dont like when it is close to the left border. I aways make one tab from the left...
So, what do we do now? Wait for Penagate to make the ComlumnClick and DblClick events?
I dont think that they are usefull, at least not double click, as it will always drop or colapse the list on first click.
Any other (un)known bugs to fix? Ideas to implement?
I added an About box, check attachment
For credits I wrote:
I'm not good at making nice looking About boxes, and also not good with credits stuff...Code:DropDownListView credits to:
CVMichael - had the idea, and started the project
baja_yu - contributed with fixes, and completed it
penagate - contributed with XP Style and events
Joacim Andersson - CTextSize class for TextWidth & TextHeight
moeur - isThemePresent code snipet.
If I missed something please tell tell me what to add (or do it yourself and attach back the project updated)
That's fine. We dont need anything fancy. Maybe we should create an icon for it (and use it in the About dialog too). Anyone have any good icons handy?
So, is this the final version then?
Nooo.... :DQuote:
Originally Posted by baja_yu
We need to fix it so it changes style properly when the Windows style is changed. Also, the sizing under Classic mode seems to be a bit off. Will fix ;)