Page 86 of 86 FirstFirst ... 367683848586
Results 3,401 to 3,416 of 3416

Thread: CommonControls (Replacement of the MS common controls)

  1. #3401

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,976

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by chosk View Post
    Hi Krool,

    I have been away from programming for a few years and am now back. First thing I look at is your controls and of course download the latest version. I have two computers Win 10 Pro 21H2 and since I am having this problem on only one, I know the problem is at my end. I have try for a few days but no luck so maybe I try asking here.

    I am getting this error (screenshot) when I tried to open any of the Forms in the Std-Exe demo. Also has this error when I try to run the demo. Any idea where I should be looking?

    Thank you.
    Just replace the OLEGuids.tlb with the latest version to your syswow64 folder.

  2. #3402
    Addicted Member
    Join Date
    Feb 2014
    Posts
    254

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    Just replace the OLEGuids.tlb with the latest version to your syswow64 folder.
    Super. This fix it.

    Thank you.

  3. #3403
    Addicted Member
    Join Date
    Jan 2012
    Posts
    161

    Re: CommonControls (Replacement of the MS common controls)

    Hi Krool,

    I'm using the ListView in Report-mode with a relatively high icon, which would allow at least 3 lines for the label. However, even when I set LabelWrap to True, the label is displayed on one line, centered in the middle of the icon, and is cut off when it's too long for the available space.

    Am I missing something, or is what I'm looking for simply not possible?

    Thanks,
    Erwin

  4. #3404

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,976

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Erwin69 View Post
    Hi Krool,

    I'm using the ListView in Report-mode with a relatively high icon, which would allow at least 3 lines for the label. However, even when I set LabelWrap to True, the label is displayed on one line, centered in the middle of the icon, and is cut off when it's too long for the available space.

    Am I missing something, or is what I'm looking for simply not possible?

    Thanks,
    Erwin
    No, the ListView is "SingleLine" in report-mode.
    The only way is the tile view mode where the sub-items are each separate lines. But it's similar to icon view.. so no report-mode style.

  5. #3405
    Addicted Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    143

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by softv View Post
    Dear Krool,

    Warm Greetings! Happy to be writing to you again, after quite some period of time, and getting the opportunity thus to thank you once again, profoundly, for your monumental efforts.

    In this post, I have attached a small project, a test app ("1. Scrollbar issues in Richtextbox.zip") to highlight two issues with scrollbars which I encountered while using the RichTextBox control.

    A screenshot of the test app below, just after starting it.
    Attachment 185088

    A screenshot of the test app below, after clicking the two buttons in it, one after the other.
    Attachment 185089

    Note-1: Please do read the comments in my code, wherever they appear. Those comments are very important, as far as this 'test app' is concerned.

    Note-2
    : The scrollbars do reappear correctly in rtb1 and rtb2 once I start scrolling the texts in them.

    Note-3: In case the scrollbars do appear correctly only, at your end, always, then kindly bear with me and kindly let me know what could be the mistake I am doing at my end which makes the scrollbars disappear or get painted incompletely.

    Note-4:
    My vb6 IDE is themed. My OS is Windows10, 64-bit. Screen resolution is 1920*1080. Under 'Scale and Layout' in Display settings, it shows '100% (Recommended)'.

    Note-5: If the above-explained issues do occur at your end too, but if they are not due to your control, then kindly let me know as to what I should do further. As of now, my own workarounds which I have mentioned (in the test app) do help solve the scrollbar issues in my projects. But then, for each RichTextBox, I need to necessarily have these workarounds.

    Note-6: This is the 2nd time ever (and the first time ever, in this thread) that I am posting a project. So, if any mistake on my part in the way I have presented my project, kindly bear with me.

    Kind regards.
    Any solution/suggestions, for the above two issues, Krool?

    Just a gentle reminder only, Krool. Otherwise, I do understand your time constraints.

    Kind Regards.

  6. #3406

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,976

    Re: CommonControls (Replacement of the MS common controls)

    softv, thranks for bringing this up again.
    Should be fixed now.

  7. #3407
    Junior Member
    Join Date
    Mar 2020
    Location
    Germany (BW)
    Posts
    25

    Re: CommonControls (Replacement of the MS common controls)

    Hello!
    As a late reply to my post #3393 (right margin in richtext) I want to share my solution for that issue with the forum.
    As mentioned earlier, the right margin in the microsoft control behaves different from the right margin in the replacement control.
    Here is my solution
    Code:
    nHdc = CreateDC("Display", "", 0, 0)
    SendMessage hwnd, EM_SETTARGETDEVICE, nHdc, ByVal mnRightMargin - LeftMargin
    DeleteDC nHdc
    Maybe the lines can be placed in then source of the control; I put them in my advanced usercontrol in my RightMargin Property.

    Krool, if this was your intention when you mentioned the printer margin output - I got you wrong, sorry.

    Anyway, I now can take full advantage of the improved control in my app.
    Thanks and bye for now

  8. #3408
    New Member
    Join Date
    Jun 2022
    Posts
    1

    Re: CommonControls (Replacement of the MS common controls)

    Hi Krool and thanks for your project!

    I have developed for year an editing program for decoder channel list and used listview to show all data like channel, transponder, etc, i've implemented a OLE drag and drop for all listview to order manually the items and it works without no problem, setting OLEDragMode as vbOLEDragAutomatic and OLEDropMode as vbOLEDropManual. Event OLEDragDrop are raised and in OLEDragOver I can select the item over the mouse cursor. A strange problem appear when I substituted the ListView with your, version 1.7.37, using ocx control for IDE on Win 10 64. When i drag an item over the same control the cursor change do deny, Effect in OLEDragOver remain at 0 and the event OLEDragDrop are not raised, but this appens only when the property View is List or Report. I've tried to change the setting in controls demo in all mode possible but the problems remain, the correct behaviour happens only when drag an item from another control. In ListBox and TreeView instead all works properly. It's not possible with ListView to dragdrop an item in the same control when is in list or report mode? I hope that is a simple problem to solve and wait for your replay.

    Thank you.

  9. #3409
    Addicted Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    143

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Krool View Post
    softv, thranks for bringing this up again.
    Should be fixed now.
    Thanks a LOT, as always, for the update, dear Krool.

    Kind Regards.

  10. #3410

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,976

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by cecelife View Post
    I have developed for year an editing program for decoder channel list and used listview to show all data like channel, transponder, etc, i've implemented a OLE drag and drop for all listview to order manually the items and it works without no problem, setting OLEDragMode as vbOLEDragAutomatic and OLEDropMode as vbOLEDropManual. Event OLEDragDrop are raised and in OLEDragOver I can select the item over the mouse cursor. A strange problem appear when I substituted the ListView with your, version 1.7.37, using ocx control for IDE on Win 10 64. When i drag an item over the same control the cursor change do deny, Effect in OLEDragOver remain at 0 and the event OLEDragDrop are not raised, but this appens only when the property View is List or Report. I've tried to change the setting in controls demo in all mode possible but the problems remain, the correct behaviour happens only when drag an item from another control. In ListBox and TreeView instead all works properly. It's not possible with ListView to dragdrop an item in the same control when is in list or report mode? I hope that is a simple problem to solve and wait for your replay.
    Thanks. Should be fixed now.

    Quote Originally Posted by Seniorchef View Post
    Hello!
    As a late reply to my post #3393 (right margin in richtext) I want to share my solution for that issue with the forum.
    As mentioned earlier, the right margin in the microsoft control behaves different from the right margin in the replacement control.
    Here is my solution
    Code:
    nHdc = CreateDC("Display", "", 0, 0)
    SendMessage hwnd, EM_SETTARGETDEVICE, nHdc, ByVal mnRightMargin - LeftMargin
    DeleteDC nHdc
    Maybe the lines can be placed in then source of the control; I put them in my advanced usercontrol in my RightMargin Property.

    Krool, if this was your intention when you mentioned the printer margin output - I got you wrong, sorry.
    Ok, but EM_SETTARGETDEVICE should'nt be for margins at all. Why are you passing the margin at lParam ? It's suppossed to be a line width...
    Last edited by Krool; Jun 27th, 2022 at 08:09 AM.

  11. #3411
    Junior Member
    Join Date
    Mar 2020
    Location
    Germany (BW)
    Posts
    25

    Re: CommonControls (Replacement of the MS common controls)

    So that's what I understood from MS's documentation here https://docs.microsoft.com/en-us/win...ettargetdevice. The linewidth is the width between left and right margin. When the left margion is 0 that makes the right margin the linewidth.
    The code in my snippet sets the linewidth and all text in the control is wrapped at that mark, like in the MS control in my sample.
    Greetings

  12. #3412

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,976

    Re: CommonControls (Replacement of the MS common controls)

    Quote Originally Posted by Seniorchef View Post
    So that's what I understood from MS's documentation here https://docs.microsoft.com/en-us/win...ettargetdevice. The linewidth is the width between left and right margin. When the left margion is 0 that makes the right margin the linewidth.
    The code in my snippet sets the linewidth and all text in the control is wrapped at that mark, like in the MS control in my sample.
    Greetings
    You seem right. The MS RichTextBox doesn't use EM_SETMARGINS, it only uses EM_SETTARGETDEVICE.
    So, how shall we proceed?

    My proposal would be to keep using EM_SETMARGINS and just call EM_SETTARGETDEVICE and each change of either left or right margin property.
    The LineWidth is correctly the RightMargin minus LeftMargin (in Twips always)

    Also
    Code:
    CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL)
    seems to be the correct usage. So it also works on multiple monitors.

    EDIT: If RightMargin minus LeftMargin results in 0 then the wParam (hDC) is also 0.

    EDIT2: The MS RichTextBox doesn't have a LeftMargin. (only RightMargin) so a negative LineWidth never applies. Can you test if a negative LineWidth works ? E.g. RightMargin set to 0 and LeftMargin set to something menaingful.
    Thanks
    Last edited by Krool; Jun 28th, 2022 at 01:42 AM.

  13. #3413
    Junior Member
    Join Date
    Mar 2020
    Location
    Germany (BW)
    Posts
    25

    Re: CommonControls (Replacement of the MS common controls)

    I'm busy this morning, but give a sample later this day...
    My line with createDC() works on my PC with five monitors, but nevertheless yours works too. Depends prob. on the declaration (which I forgot to copy).
    Greetings

  14. #3414
    Junior Member
    Join Date
    Mar 2020
    Location
    Germany (BW)
    Posts
    25

    Re: CommonControls (Replacement of the MS common controls)

    Here some information:
    It's true, the MS control has no left margin; this is one reason why I prefer your control.
    A negative LineWidth is same like a LineWidth of 0 which cancels the WYSIWYG and makes the text wrap to the right window border.
    Code:
    'Create a new project
    'Add a form
    'Add the VBCCR17.OCX
    'Paste this code to the form
    
    Option Explicit
    
    Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As Long, ByVal lpInitData As Long) As Long
    Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
    
    Const WM_USER = &H400
    Const EM_SETTARGETDEVICE = (WM_USER + 72)
    
    Dim mnRightMargin&
    
    Private Sub Form_Load()
       appLeftMargin = 500     'twips
       appRightMargin = 5000   'twips
       'Paste text from the clipboard to the control to make the margins usefull...
       'Resize the form to see the behavior of the control and the margins
       
    End Sub
    
    Private Sub Form_Resize()
       If ScaleHeight > 60 And ScaleWidth > 60 Then
          rtf.Move 30, 30, ScaleWidth - 60, ScaleHeight - 60
       End If
    End Sub
    
    Property Let appLeftMargin(ByVal nNewValue As Long)
    On Error Resume Next
    Dim nHdc&
       
       'anything to do...
       If rtf.LeftMargin <> nNewValue Then
          'set VBCCR-control new LeftValue
          rtf.LeftMargin = nNewValue
          'check rightmargin...
          If mnRightMargin > nNewValue Then
             nHdc = CreateDC("Display", "", 0&, 0&)
             'set the linewidth according the margins, make WYSIWYG
             SendMessage rtf.hwnd, EM_SETTARGETDEVICE, nHdc, ByVal mnRightMargin - nNewValue
             'clean up
             DeleteDC nHdc
          End If
       End If
    End Property
    
    Property Let appRightMargin(ByVal nNewValue As Long)
    Dim nHdc As Long
    Dim nLeftMargin&
    
       'anything to do...
       If nNewValue <> mnRightMargin Then
          nLeftMargin = rtf.LeftMargin
          'illegal RightMargin set to 0
          'take the WYSIWYG from Control...
          Select Case nNewValue
           Case Is <= nLeftMargin
             'cache RightMargin
             mnRightMargin = 0
             'reset the controls rightmargin property ...
             rtf.RightMargin = 0
             'make the VBCCR-Control wrap to window
             SendMessage rtf.hwnd, EM_SETTARGETDEVICE, 0&, 0&
           
          'set RightMargin
          Case Else
             'cache RightMargin
             mnRightMargin = nNewValue
             'make control WYSIWYG
             nHdc = CreateDC("Display", "", 0&, 0&)
             'set the linewidth according the margins, make WYSIWYG
             SendMessage rtf.hwnd, EM_SETTARGETDEVICE, nHdc, ByVal mnRightMargin - nLeftMargin
             'clean up
             DeleteDC nHdc
          End Select
       End If
    End Property
    So in my opinion leave the handling of the margins as they are. The handling of the LineWidth should be done by the calling app, even more because there is no right and left margin stored in a richtext. It should be up to the app to set and handle them.

    Greetings

  15. #3415
    Junior Member
    Join Date
    Mar 2020
    Location
    Germany (BW)
    Posts
    25

    Re: CommonControls (Replacement of the MS common controls)

    Thinking about it, there could be a more elegant solution:
    A RightMargin greater than the LeftMargin sets the LineWidth to RightMargin minus LeftMargin.
    A RightMargin of zero or negative (or smaller than LeftMargin) sets the RightMargin to that (positive) value and cancels the LineWidth.
    This is more or less the essence of my sample above but it also breaks the compatibility of the RightMargin Property, because negative values are legit.

    Code:
    LeftMargin=0: RightMargin=-100     'RightMargin=100 twips from the right border of the control
    LeftMargin=0: RightMargin=5000     'LineWidth=5000 twips
    LefMargin=100: RightMargin=2400    'LineWidth=2300 twips
    LeftMargin=500: RightMargin=75      'LineWidth=0, RightMargin=75 twips from right border
    Greetings

  16. #3416
    Junior Member
    Join Date
    Mar 2020
    Location
    Germany (BW)
    Posts
    25

    Re: CommonControls (Replacement of the MS common controls)

    I also implemented the event RulerScroll to my code. The Event is used to move a ruler according to the position of the scrollbars of the control. I'm using the "VBAccelerator Subclassing adn Timer Assistent" for subclassing, so the snippets are

    Code:
    'start Subclassing
    SSubTimer6.AttachMessage Me, rtf.hWndUserControl, WM_COMMAND
    and in the queue

    Code:
    Dim ScrollPos As POINTAPI
    Dim X&, Y&
    
       'Subclassing ...
       If iMsg = WM_COMMAND Then
           '
          Select Case Int(wParam \ &H10000)
                
             Case EN_UPDATE
                SendMessage rtf.hwnd, EM_GETSCROLLPOS, 0, ScrollPos
                X = (ScrollPos.X * Screen.TwipsPerPixelX)
                Y = (ScrollPos.Y * Screen.TwipsPerPixelY)
                RaiseEvent RulerScroll(X, Y)
    ...
    The name of the event "RulerScroll" is arbitrary. I use it to scroll a ruler above the text to show the caret's position and for tabs and borders.

    Greetings

Page 86 of 86 FirstFirst ... 367683848586

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