Page 4 of 5 FirstFirst 12345 LastLast
Results 121 to 160 of 173

Thread: Is there a DropDown list but like a ListView ?

  1. #121
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Is there a DropDown list but like a ListView ?

    Did you check out the latest version? It's in post #117 poste by Michael.

  2. #122
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Is there a DropDown list but like a ListView ?

    One more thing that would be nice, Change and Click events for the control...

  3. #123
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Is there a DropDown list but like a ListView ?

    Isn't Click the same as either MouseUp or ItemSelect?

  4. #124
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Is there a DropDown list but like a ListView ?

    Your right. We dont need them then. What's the resizing problem you mentioned? I dont see it.

  5. #125
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Is there a DropDown list but like a ListView ?

    It's too short, and in Classic mode the button is a pixel or two too tall. I had it the same height as a normal combo box, but then we have the problem with the listview row height. That could be solved by turning off the gridlines from lstChoice, but then we wouldn't see the column separators. I guess if that isn't an issue we could do that, what do you think?

  6. #126
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Is there a DropDown list but like a ListView ?

    I cant see that. Can you send a screenshot?
    Also, check this version out. I made some modification in the usercontrol's Resize event. There was a problem that the user could manualy resize the control to have shorter height then needed. The corrections are commented.

    I have checked it both in classic mode and in XP Style mode. Works good in both. The only difference (not a problem) is that in classic mode, the dropdown button resizes along with the control, but in XP mode the picDrop is always the same height.
    Attached Files Attached Files

  7. #127
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Is there a DropDown list but like a ListView ?

    Quote Originally Posted by baja_yu
    I cant see that. Can you send a screenshot?
    I can't now either, it seems to have fixed itself

    Also, check this version out. I made some modification in the usercontrol's Resize event. There was a problem that the user could manualy resize the control to have shorter height then needed. The corrections are commented.
    I tried that and it wouldn't let me

    I have checked it both in classic mode and in XP Style mode. Works good in both. The only difference (not a problem) is that in classic mode, the dropdown button resizes along with the control, but in XP mode the picDrop is always the same height.
    Fixed

  8. #128
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Is there a DropDown list but like a ListView ?

    The resizing now is not allowed by user. The control automatically takes the exact height that is needed by selected font size.

  9. #129
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Is there a DropDown list but like a ListView ?

    I have added an InitTheme procedure to the control that takes care of choosing between XP style and Classic style. The procedure is called from _Initialize and also for all controls when the system colours change (WM_SYSCOLORCHANGE, from the WndProc), so the appearance always matches the users theme.

    Also, the graphic used for cmdDrop has a grey background which shows up if the user's button face colour is not the same. Can you think of a way around this? I tried Wingdings but none of the arrow symbols are the same as the Windows one.

  10. #130
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Is there a DropDown list but like a ListView ?

    There is a character in Webdings that looks like it. I think it is on number six.

  11. #131
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Is there a DropDown list but like a ListView ?

    OK, I found the symbol, but I can't get it the right size. It is either too small (6 or 7) or too big (8 or 9 pt). Anyway, that doesn't matter too much.

    I can't get the drop-down button to be the right height, it keeps making itself too tall for some reason, like it has a minimum height

    Also, should we support combo box window message? (CB_*)?

  12. #132

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Is there a DropDown list but like a ListView ?

    You know what we need ? A ListIndex property... or a way to change the selection through code, and when we DO change the selection through code, the Changed event should fire also...
    Last edited by CVMichael; Jul 8th, 2005 at 01:20 PM.

  13. #133
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Is there a DropDown list but like a ListView ?

    Hey guys. I've been away from my PC for a few days. Where are we at with the project? What's left to be done?

  14. #134

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Is there a DropDown list but like a ListView ?

    Quote Originally Posted by penagate
    I can't get the drop-down button to be the right height, it keeps making itself too tall for some reason, like it has a minimum height
    Post the project as you have it, i think I'll be able to fix that...

    Quote Originally Posted by penagate
    Also, should we support combo box window message? (CB_*)?
    I don't think so, then we whould have to subclass the control, that would be too much I think.

    Quote Originally Posted by baja_yu
    Hey guys. I've been away from my PC for a few days. Where are we at with the project? What's left to be done?
    The only thing I think we are left to do is what I said in my previous post about the ListIndex property.

    Also... I want to make a List property (same as a regular drop down) where you put your data in, but since we have more than one column, then it should have a character separator like comma, so then every comma the data will be in the next column. That way if you have constant data, you can preset it at design time.

    [edit]
    PS, I know how to make the ListIndex thing, but I don't know how to make the List property to have multiline input... I tried with String() but that did not work...
    Last edited by CVMichael; Jul 10th, 2005 at 08:50 AM.

  15. #135
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Is there a DropDown list but like a ListView ?



    Here is the latest I have:
    Attached Files Attached Files

  16. #136
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Is there a DropDown list but like a ListView ?

    Quote Originally Posted by CVMichael
    [edit]
    PS, I know how to make the ListIndex thing, but I don't know how to make the List property to have multiline input... I tried with String() but that did not work...
    Nar, I don't know, also that reminds me, the Font choice box is very ugly... Do you know how to make it use the standard Font box like other controls?

  17. #137

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Is there a DropDown list but like a ListView ?

    Quote Originally Posted by penagate
    I can't get the drop-down button to be the right height, it keeps making itself too tall for some reason, like it has a minimum height
    I fixed the problem, it was because the button's Font was set to webdings, as soon as you change to "MS Sans Serif" the button's size resizes properly...

    I'm gonna try to see if I can get the List property to work...

  18. #138
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Is there a DropDown list but like a ListView ?

    Quote Originally Posted by CVMichael
    I fixed the problem, it was because the button's Font was set to webdings, as soon as you change to "MS Sans Serif" the button's size resizes properly...
    Yes, that was so that the arrow symbol would show up properly Otherwise, if you use an image, you get the background colour around the arrow, and it doesn't look to great if the user has custom colours.

  19. #139

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Is there a DropDown list but like a ListView ?

    There must be a way to fix that with a picture...

    By the way, you did not make it show the arrow with webdings... in the button caption you have to type "6", and remove the picture, then it will show the down arrow from webdings. But I tried it and first of all you have the problem with the height, and second the arrow is too low, it's not in the center of the button, and it looks so bad because of that.

    I changed it back to the picture...

    I'm gonna change the button color in my windows so I can see the picture's background, that way I can troubleshoot the problem and find a way to make it transparent...

  20. #140
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Is there a DropDown list but like a ListView ?

    Regarding the List property, maybe it would be better to use the pipe character as the separator, it is less likely that thse user will need that character.
    Another idea, cant we make the List property accept an array. Then simply have the control got through the array and read the first 'colimn number' items from it?

  21. #141
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Is there a DropDown list but like a ListView ?

    Quote Originally Posted by CVMichael
    By the way, you did not make it show the arrow with webdings... in the button caption you have to type "6", and remove the picture, then it will show the down arrow from webdings. But I tried it and first of all you have the problem with the height, and second the arrow is too low, it's not in the center of the button, and it looks so bad because of that.
    I did Maybe I didn't save it. And yes it looks terrible.

  22. #142

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Is there a DropDown list but like a ListView ?

    I searched the web on Google, and the vbforums, and I could not find anything helpfull for the List property.
    I tried like this:
    VB Code:
    1. Public Property Get List(Index As Integer) As String
    2.  
    3. End Property
    4.  
    5. Public Property Let List(Index As Integer, ByVal vNewValue As String)
    6.  
    7. End Property
    8.  
    9. ' and like this:
    10. Public Property Get List() As String()
    11.  
    12. End Property
    13.  
    14. Public Property Let List(ByRef vNewValue() As String)
    15.  
    16. End Property
    and many other things, and NONE of them made the List property show up in the Properties List
    Last edited by CVMichael; Jul 10th, 2005 at 10:52 AM.

  23. #143
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Is there a DropDown list but like a ListView ?

    For the drop down button you should use the DrawFrameControl API function. Since that is what Windows is doing it should be drawn with the correct style on XP as well. To try it out just start a new standard EXE project. Add a PictureBox to the Form and set the BorderStyle to 0-None. Then copy and paste the following code:
    VB Code:
    1. Private Declare Function DrawFrameControl Lib "user32.dll" ( _
    2.  ByVal hDC As Long, _
    3.  ByRef lpRect As RECT, _
    4.  ByVal uType As Long, _
    5.  ByVal uState As Long) As Long
    6.  
    7. Private Declare Function SetCapture Lib "user32.dll" ( _
    8.  ByVal hwnd As Long) As Long
    9.  
    10. Private Declare Function ReleaseCapture Lib "user32.dll" () As Long
    11.  
    12. Private Type RECT
    13.     Left As Long
    14.     Top As Long
    15.     Right As Long
    16.     Bottom As Long
    17. End Type
    18.  
    19. Private Const DFC_SCROLL As Long = 3
    20. Private Const DFCS_SCROLLDOWN As Long = &H1
    21. Private Const DFCS_PUSHED As Long = &H200
    22.  
    23. Private Enum eBtnState
    24.     eButtonUp
    25.     eButtonDown = DFCS_PUSHED
    26. End Enum
    27.  
    28. Private blnHasCapture As Boolean
    29. Private nfBtnState As eBtnState
    30.  
    31. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    32.     If Button = vbLeftButton Then
    33.         nfBtnState = eButtonDown
    34.         Picture1.Refresh
    35.     End If
    36. End Sub
    37.  
    38. Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    39.     If blnHasCapture = False Then
    40.         SetCapture Picture1.hwnd
    41.         blnHasCapture = True
    42.     End If
    43.     If (X < 0 Or X > Picture1.ScaleWidth) Or (Y < 0 Or Y > Picture1.ScaleHeight) Then
    44.         If Button = 0 Then
    45.             ReleaseCapture
    46.             blnHasCapture = False
    47.         End If
    48.         nfBtnState = eButtonUp
    49.     ElseIf (Button And vbLeftButton) = vbLeftButton Then
    50.         nfBtnState = eButtonDown
    51.     End If
    52.     Picture1.Refresh
    53. End Sub
    54.  
    55. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    56.     SetCapture Picture1.hwnd
    57.     nfBtnState = eButtonUp
    58.     blnHasCapture = True
    59.     Picture1.Refresh
    60. End Sub
    61.  
    62. Private Sub Picture1_Paint()
    63.     Dim r As RECT
    64.     r.Bottom = Picture1.ScaleHeight \ Screen.TwipsPerPixelY
    65.     r.Right = Picture1.ScaleWidth \ Screen.TwipsPerPixelX
    66.     Call DrawFrameControl(Picture1.hDC, r, DFC_SCROLL, DFCS_SCROLLDOWN Or nfBtnState)
    67. End Sub
    Last edited by Joacim Andersson; Jul 10th, 2005 at 11:24 AM.

  24. #144
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Is there a DropDown list but like a ListView ?

    Thanks Joacim, very nice Unfortunately it doesn't work with XP styles, but that's not an issue, it can be used to draw the non-styled version of the button.

  25. #145
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Is there a DropDown list but like a ListView ?

    Just made a slight edit to the Picture1_MouseMove event so it redraw itself if you've pressed down the button (without releasing it) and moved the mouse away from the picture box and then entered it again.

  26. #146
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Is there a DropDown list but like a ListView ?

    Quote Originally Posted by penagate
    Unfortunately it doesn't work with XP styles
    That's probably because Windows doesn't recognise the picturebox as the push button used in a combo box. But I know for a fact that this is the way Windows draw drop-down buttons and scrollbar buttons.

  27. #147
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Is there a DropDown list but like a ListView ?

    Joacim's code looks very promissing. Maybe there is a way to adapt it for XP styles as well...

  28. #148

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Is there a DropDown list but like a ListView ?

    Can anyone figure out how to do the List property ? (cuz i'm really tired of trying things)

  29. #149
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Is there a DropDown list but like a ListView ?

    Why do you want to use a simple List property for? Why not use ListItems since you're using a ListView anyway.

  30. #150
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Is there a DropDown list but like a ListView ?

    Here are some small corrections to the latest code.

    1. I added some text and links in the about box.
    2. There was a problem with SetFocus for the list. When you drop it down once using the cmdDrop, the focus is set and you can scroll using the arrow keys. But after that if you drop it again (without setting the focust to another control on the form) the keys are not functional (the focus is not set). The problem did not occur if you droped the list by clicking on the lstChoice.

    I'll see what I can do about the List (ListItems) property.

    Regarding the button and XP styles, wouldn't using the manifest file work for our control too? Because all the controls we used for making it support XP styles when using the manifest file.
    Attached Files Attached Files
    Last edited by baja_yu; Jul 10th, 2005 at 05:48 PM.

  31. #151
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Is there a DropDown list but like a ListView ?

    Regarding the List property, we would have to either:

    1. have it access the data in lstChoice, but then we would need to modify it to have an extra column which would hold the info which item (index number) in the lstListData is selected
    2. have it access the selected item of lstListData (if the selected property is retained after making the selection). But then we would need to make it so the selection (data in lstChoice) changes too after making a change in lstListData.

    What do you guys think?

  32. #152
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Is there a DropDown list but like a ListView ?

    Here is a change for classic users
    VB Code:
    1. Private Sub UserControl_Resize()
    2.     Dim FntSize As Single
    3.    
    4.     FntSize = oFont.TextHeight("A") * Screen.TwipsPerPixelY
    5.    
    6.     If isThemePresent = False Then
    7.         If UserControl.Height > FntSize + 120 Then
    8.             UserControl.Height = FntSize + 120
    9.         ElseIf UserControl.Height < FntSize Then
    10.             UserControl.Height = FntSize + 120
    11.         End If
    12.         'add this line - these numbers look good on my machine
    13.         cmdDrop.Move UserControl.ScaleWidth - cmdDrop.Width - 25, _
    14.             30, 255, UserControl.ScaleHeight - 60
    15.     Else
    16.         If UserControl.Height > FntSize + 60 Then
    17.             UserControl.Height = FntSize + 60
    18.         ElseIf UserControl.Height < FntSize Then
    19.             UserControl.Height = FntSize + 60
    20.         End If
    21.         'move this line up here
    22.         picDrop.Move UserControl.ScaleWidth - picDrop.Width - 15, _
    23.             15, 255, UserControl.ScaleHeight - 30
    24.     End If
    25.  
    26. 'rest of code ....

  33. #153
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Is there a DropDown list but like a ListView ?

    I searched the web on Google, and the vbforums, and I could not find anything helpfull for the List property.
    I tried like this:
    I don't think you can have a property array show up in the properties window.

    What is it you want to do with this property? read/set one row of data or the entire table?

    If you want to set data through the list property, I would suggest making the property a delimited string. You could even add a property page to the list property if you want the user to be able to just type the info in.

  34. #154

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Is there a DropDown list but like a ListView ?

    I want this type of list:
    Attached Images Attached Images  

  35. #155
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Is there a DropDown list but like a ListView ?

    So would that access the entire table of data? If so then the list has to have columns.

    In either case, you'll have to make a property page for the List property. On that property page you can put whatever controls you want. I don't know what type of control can show columns and at the same time allow the user to edit all the cells.

    I guess we could fake it by popping up a textbox over the cell when it's clicked.

    I could come up with an example if you let me know what you want it to look like.

  36. #156
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Is there a DropDown list but like a ListView ?

    To get set the correct width of the drop-down button you should use the GetSystemMetric API function with the SM_CXHSCROLL value.

  37. #157

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Is there a DropDown list but like a ListView ?

    With a property page, I would've been done by now... I wanted to imitate the regular List property of DropDown.
    I our case the columns would be separated by comma or |, or we could make another property to set the separator...

    Then you would have to input something like (for 3 columns) (for example):
    1,a,aa
    2,b,ab
    3,c,ac
    4,d,ad

    But I looked everywhere, and LOTS of people asked for the same question, and no one had an anser.

    So I guess i'll be making a property page after all...

  38. #158
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Is there a DropDown list but like a ListView ?

    So, the List property should just be a string of delimited values such as
    "1|a|aa|2|b|ab|3|c|ac|4|d|ad"
    and since the control knows how many coulmns it has it knows where to make the row breaks.

  39. #159

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Is there a DropDown list but like a ListView ?

    moeur, please look how the List property is for the DropDown... the list has multiline input....

    The way I typed it in the post, THAT'S EXACTLY the way will be typed in the List Property
    1,a,aa
    2,b,ab
    3,c,ac
    4,d,ad

    NOT
    1|a|aa|2|b|ab|3|c|ac|4|d|ad

    Just put a DropDown of a form, click on List property in the Properties list, and type something, to go to the next line you have to exit the List property, and then go back. Then you will have the cursor under the text you previously typed....

  40. #160
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Is there a DropDown list but like a ListView ?

    Quote Originally Posted by CVMichael
    click on List property in the Properties list, and type something, to go to the next line you have to exit the List property, and then go back.
    ... or you could just press Ctrl+Enter...

Page 4 of 5 FirstFirst 12345 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width