Page 96 of 96 FirstFirst ... 468693949596
Results 3,801 to 3,814 of 3814

Thread: CommonControls (Replacement of the MS common controls)

  1. #3801
    Fanatic Member
    Join Date
    Oct 2013
    Posts
    788

    Re: CommonControls (Replacement of the MS common controls)

    Could anyone show me how to populate Krool's Treeview from database?

  2. #3802

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: CommonControls (Replacement of the MS common controls)

    Update released.

    Bugfix that setting SelectedItem to Nothing will not fire Click event, if index changed, in the ImageCombo control.
    Behavior is the same as in a normal ComboBox setting ListIndex to -1.
    The ImageCombo cleared the selection but did not fired a Click event when there was a selected index before.

    EDIT: The MS ImageCombo does not fire a Click event. But it's not logical and should behave as a normal ComboBox, which fires a Click event..

  3. #3803

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: CommonControls (Replacement of the MS common controls)

    This demo is showing of how to use the ImageCombo control as a DriveCombo. (Unicode replacement for the VB.DriveListBox and use of system icons)
    Attached Files Attached Files
    Last edited by Krool; Jun 2nd, 2024 at 04:27 AM.

  4. #3804
    Addicted Member
    Join Date
    Jun 2010
    Posts
    200

    Question Re: CommonControls (Replacement of the MS common controls)

    Hi and thanks for these wonderful controls Krool!

    I have successfully replaced my old UniSuitePlus controls with VBCCR, as apart from they no longer are supported VBCCR also gives me the option to utilize only the controls I need. However, my old UniComboBox & UniListBox controls had some useful Events that are missing in VBCCR. I'm now trying to add this functionality by modify the VBCCR code (Yes, I'm aware of that it falls on my responsibility to keep track of and adjust for any future updates).

    Basically, what I need help with is to find the proper places for the "RaiseEvent" calls to the Events I have added. The UniSuite Combo- and ListBox controls has the nice and useful functionality to distinguish between if ListIndex changed due to user action (Keyboard or Mouse Click) or if it was due action in the code. So for this I have added a ListIndexChanged() Event and it's quite strait forward to implement as it's simply a matter of either replace RaiseEvent Click or add RaiseEvent ListIndexChanged to the same location. So no problem there really.

    What's more problematic for me is to find the proper location to detect that the user clicked either the Escape or the Return key ending the Edit operaton. My old ComboBox control has the events "BeginEdit" and "EndEdit", which I have also added. I have solved BeginEdit but for the other here I need to catch the reason why Edit operation ended (and corresponding place in the code), which basically can be due to 4 causes:

    Loss of focus, Drop Down of List or pressing either Escape or Return keys (maybe Tab as well but that would probably fall under loss of focus). Here I could need some guidance though as I figure t has to be in some of the subclass sub/Function routines but the structure there seems quite complex.

    I have identified "Private Sub IOleInPlaceActiveObjectVB_TranslateAccelerator(...)" as one routine where much of this already is tested for and putting Debug.Print statements there seems to yield needed result but at the same time other things with these keys are also happening there and I have just recently started to look deeper into this with subclassing.

    So if anyone can help me out here, where to start etc. and/or maybe where not to go... and I will try to learn as I go.

    TIA 7
    M$ vs. VB6 = The biggest betrayal and strategic mistake of the century!?

  5. #3805
    Hyperactive Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    451

    Re: CommonControls (Replacement of the MS common controls)

    just some hints:

    The combobox does have a hWndEdit property for the edit box. Check the internal variable name for this property and search for the subclassing code that uses this variable. For more information about subclassing the edit box, check the MSDN.

  6. #3806
    Addicted Member
    Join Date
    Jun 2010
    Posts
    200

    Re: CommonControls (Replacement of the MS common controls)

    Mith, thanks for your hints, they helped me out of my confusion as having been away from coding for some time it didn't cross my mind that the Edit portion sort of is a control within the control or at least it fits my mind to think of it that way.

    I have a follow up question though. I have created my own ActiveX project to host just the controls I am using and noted the original OCX project has a Conditional Compiler Argument "CondComp=VBCCR_OCX = 1" (not present in the StdExe version) that leads me to the PreTranslateMsg stuff, which I have no previous experience with. But is it a correct assumption of me to include that conditional argument in my private project to have my ocx make use of the PreTranslate code?

    TIA 7
    M$ vs. VB6 = The biggest betrayal and strategic mistake of the century!?

  7. #3807

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by 7edm View Post
    Mith, thanks for your hints, they helped me out of my confusion as having been away from coding for some time it didn't cross my mind that the Edit portion sort of is a control within the control or at least it fits my mind to think of it that way.

    I have a follow up question though. I have created my own ActiveX project to host just the controls I am using and noted the original OCX project has a Conditional Compiler Argument "CondComp=VBCCR_OCX = 1" (not present in the StdExe version) that leads me to the PreTranslateMsg stuff, which I have no previous experience with. But is it a correct assumption of me to include that conditional argument in my private project to have my ocx make use of the PreTranslate code?

    TIA 7
    If you want to use your private OCX in a VBA environment you need the PreTranslateMsg stuff. Otherwise (VB6 only) you don't.
    But that PreTranslateMsg stuff is used only as kind of fallback.
    So it doesn't harm to set "CondComp=VBCCR_OCX = 1" in your private OCX as well, even when you use it in VB6 only.

  8. #3808
    Addicted Member
    Join Date
    Jun 2010
    Posts
    200

    Re: CommonControls (Replacement of the MS common controls)

    Thanks Krool, yes I use it in VB6 only and have no other plans. Maybe in TwinBasic later if I make that step, but I have noticed that UsePreTranslateMsg got set to False anyway even if I set the VBCCR_OCX=1 or not, due to being VB6 I now understand.

    All well then and once I got it working I will share what I came up with as it may be of use to someone else as well. Now I just need to gain a bit deeper understanding of this whole subclass procedure to reach the state where it feels like I know what I'm doing
    M$ vs. VB6 = The biggest betrayal and strategic mistake of the century!?

  9. #3809
    Addicted Member
    Join Date
    Jun 2010
    Posts
    200

    Re: CommonControls (Replacement of the MS common controls)

    Ops one more question surrounding this...

    In WindowsProceEdit there is this code
    Code:
    Private Function WindowProcEdit(ByVal hWnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, ByVal lParam As LongPtr) As LongPtr
    Select Case wMsg
        Case WM_SETFOCUS
            If wParam <> UserControl.hWnd And wParam <> ComboBoxHandle Then SetFocusAPI UserControl.hWnd: Exit Function
            
            #If ImplementPreTranslateMsg = True Then
                     
            If UsePreTranslateMsg = False Then Call ActivateIPAO(Me) Else Call ComCtlsPreTranslateMsgActivate(hWnd)
            
            #Else
            
            Call ActivateIPAO(Me)
            
            #End If
            
        Case WM_KILLFOCUS
            
            #If ImplementPreTranslateMsg = True Then
            
            If UsePreTranslateMsg = False Then Call DeActivateIPAO Else Call ComCtlsPreTranslateMsgDeActivate
    ...
    If I were to put a RaiseEvent statement here, would it be prefereble to do that after ActivateIPAO and before DeActivateIPAO are called or it doesn't matter? I'm asking because the stuff that hides behind those calls are over my head right now and I'd prefer not to screw up things ;-) My intuition tells me though that I probably should do it after the Activate call and before the DeActive, is that correct?
    M$ vs. VB6 = The biggest betrayal and strategic mistake of the century!?

  10. #3810
    Addicted Member
    Join Date
    Jun 2010
    Posts
    200

    Re: CommonControls (Replacement of the MS common controls)

    Trying to understand the internals of the code, and in ComboBoxW.ctl I find

    Code:
    Private Function WindowProcList(ByVal hWnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, ByVal lParam As LongPtr) As LongPtr
    Select Case wMsg
    ...
        Case LB_FINDSTRING
            If PropAlwaysFindExact = True Then wMsg = LB_FINDSTRINGEXACT
    End Select
    WindowProcList = ComCtlsDefaultProc(hWnd, wMsg, wParam, lParam)
    Select Case wMsg
        Case WM_MOUSEMOVE
            If (GetMouseStateFromParam(wParam) And vbLeftButton) = vbLeftButton Then Call CheckTopIndex
        Case WM_MOUSEWHEEL, WM_VSCROLL, LB_SETTOPINDEX
            Call CheckTopIndex
    End Select
    End Function
    and I can't help to wonder if the use of ListBoxW constants (LB_FINDSTRING & LB_FINDSTRINGEXACT) here is a bug or a feature, and if the latter what are they supposed to catch?

    EDIT: also notice LB_SETTOPINDEX that seems to be starngely placed here?

    EDIT2: By "strangely placed" I mean, these are ListBox message constants, used in a ComboBox subclass routine. I don't quite get the logic in that.
    Last edited by 7edm; Jun 2nd, 2024 at 12:26 PM.
    M$ vs. VB6 = The biggest betrayal and strategic mistake of the century!?

  11. #3811
    Lively Member
    Join Date
    Jul 1999
    Location
    London
    Posts
    79

    Re: CommonControls (Replacement of the MS common controls)

    Hi guys,

    Congrats Kroll, putting this tool together, I did not use it yet, so can't say much...
    I´m trying to test the Treeview...
    I´ve followed the installation instructions but I´m getting the msg:

    User-defined type not defined

    CODE LINE (Declarations):
    Private PropNodes As TvwNodes


    Any help will be great.
    MBS.
    MBS

  12. #3812

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,450

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by MBS View Post
    Hi guys,

    Congrats Kroll, putting this tool together, I did not use it yet, so can't say much...
    I´m trying to test the Treeview...
    I´ve followed the installation instructions but I´m getting the msg:

    User-defined type not defined

    CODE LINE (Declarations):
    Private PropNodes As TvwNodes


    Any help will be great.
    MBS.
    The best is you begin with the OCX as it's very user-friendly. In the first post of this thread you find a link to the OCX thread where you can download the OCX, which you need to register and then can easily use it.

  13. #3813
    Lively Member
    Join Date
    Jul 1999
    Location
    London
    Posts
    79

    Re: CommonControls (Replacement of the MS common controls)

    Got it, seems to be working fine... I'll let you guys know if it works for my project!
    Thanks again, Krool!!
    MBS

  14. #3814
    Lively Member
    Join Date
    Jul 1999
    Location
    London
    Posts
    79

    Re: CommonControls (Replacement of the MS common controls)

    Thanks so much Kroll, all I wanted was the "node.checkbox" property.... but trying to replace the standard treeview control with the VBCCR treeview brought me 2 major problems:
    a) Annoying flickering on mouse move/tracking over the control
    b) the IDE crashed twice

    And, the behavior on the events of VBCCR treeview I would have to adjust lots of lines of coding, would take a lot of effort...
    So, at the end, I kept the standard control.

    Once again, thanks for the the tool, i will try other controls in the future.
    MBS
    MBS

Page 96 of 96 FirstFirst ... 468693949596

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