Page 2 of 3 FirstFirst 123 LastLast
Results 41 to 80 of 81

Thread: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

  1. #41

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Taken over the changes in #40 now - and also think, that the point 1 in jpbro's posting #39 is now covered as well.

    Please download again from #1

    Olaf

  2. #42
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Thanks Olaf.

    Quick bug report: If one presses ALT and then right and then ALT again, the menu should be destroyed

    Quick fix:

    cwMenuBar:
    Code:
    Private Sub KWatch_VKeyDown(ByVal vKey As Integer, ByVal MapIdx As Long)
      If vKey = 9 Or vKey = 16 Or vKey = 17 Then TabOrShiftOrCtrlKeyDown = True
      If vKey = 17 Then mCtrlDown = 1
      If vKey = 16 Then mShiftDown = 2
     
      CheckForKeyBoardShortcut vKey
      
      If vKey = 18 Then
        W.Root.WidgetForm.SetFocus
        W.SetFocus
        If Not CurPopUp Is Nothing Then CurPopUp.DestroyPopup: Set CurPopUp = Nothing : MenuBarActive = True
        If Not Screen.ActiveForm Is Nothing Then 'we send an Esc-KeyUp-Event in case of a VB-Form as TopLevel-Host
          Dim Evt(0 To 27) As Byte: Evt(0) = 1: Evt(4) = vbKeyEscape: Evt(8) = 2 '<- flagged as KeyUp
          SendInput 1, Evt(0), UBound(Evt) + 1
        End If
      End If
    End Sub
    That way it gets immediately toggled to false in the VKeyUp event for which I also suggest the following readability change

    Code:
        If Not MenuBarActive And Not TabOrShiftOrCtrlKeyDown And Widgets.Count > 0 Then
          MenuBarActive = True
        ElseIf MenuBarActive And Not TabOrShiftOrCtrlKeyDown And Widgets.Count > 0 Then
          MenuBarActive = False
        End If
    Equivalent to

    Code:
        If Not TabOrShiftOrCtrlKeyDown And Widgets.Count > 0 Then MenuBarActive = Not MenuBarActive
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  3. #43

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Applied these suggestions too - new download under #1

    Olaf

  4. #44
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Cool. One last tiny suggestion. Currently, when pressing ALT, if one then presses the right (or left) arrow, we get the 'menu shift' effect. All good there, but the menu that is shifted to gets dropped down, as currently coded.

    This fixes that;

    Code:
    Private Sub CurPopUp_MenuBarEntryShift(ByVal ShiftLeft As Boolean)
    .
    .
    .
      mBlockDestroy = True
      If MenuBarActive Then
        MenuBarItem.Widget.MouseEnter Nothing
      Else
        MenuBarItem.ShowPopUp True
      End If
      MenuBarItem.Widget.Refresh
      W.Refresh
      mBlockDestroy = False
    End Sub
    to replace
    Code:
      mBlockDestroy = True
      MenuBarActive = False: MenuBarItem.ShowPopUp True
      MenuBarItem.Widget.Refresh
      W.Refresh
      mBlockDestroy = False
    And that is pretty much all I have to offer on this subject, I think!
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  5. #45

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Ok, now also taken over (for the sake of compatibility with the MS-Menu-behaviour).

    New Download under #1.

    Thanks again Colin.

    Olaf

  6. #46
    New Member
    Join Date
    Feb 2015
    Posts
    1

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Hello Olaf,

    is it possible to use this dynamic menu as notification-icon with the menu as context menu?

    Regards,
    Matthias

  7. #47
    Lively Member
    Join Date
    Mar 2015
    Posts
    104

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    H Olaf.

    Thanks for the great Menu-popup-toolbar code. I was playing around with the DLL of Office XP and .NET Style ActiveX V 1.61 that was on http://www.xpstyle-menu.com/ .The site had disappeared so I'm glad I came across your code.

    I still need to try out the menu system, as I like seeing how things work. Thanks once again, Dreamer.

  8. #48
    Lively Member
    Join Date
    Oct 2014
    Posts
    93

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    When the function is disabled, the text moves to the left.
    ToolBar.AddItem "TxtItem2", "Document-Save-As", "TxtItem2", , "Text-Item with Icon", False 'Enabled = False -> Bug,When the function is disabled, the text moves to the left
    ToolBar.AddItem "TxtItem5", "Document-Open", "TxtItem5", ddCrumbBar, "Text-Item with Icon and CrumbBar-Style-DropDown", False 'Enabled = False -> Bug,When the function is disabled, the text moves to the left

    Name:  False.jpg
Views: 1776
Size:  22.0 KB

  9. #49
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Quote Originally Posted by smileyoufu View Post
    When the function is disabled, the text moves to the left.
    ToolBar.AddItem "TxtItem2", "Document-Save-As", "TxtItem2", , "Text-Item with Icon", False 'Enabled = False -> Bug,When the function is disabled, the text moves to the left
    ToolBar.AddItem "TxtItem5", "Document-Open", "TxtItem5", ddCrumbBar, "Text-Item with Icon and CrumbBar-Style-DropDown", False 'Enabled = False -> Bug,When the function is disabled, the text moves to the left
    In the Draw method of the cwToolbarItem class, you can add this code to the Else ' Disabled State block to fix this issue:

    Code:
        If Len(W.ImageKey) Then
          xOffs = dy
        End If

  10. #50
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Olaf, a quick question about widget state drawing - Should there be a disabled state option for things like drawing the toolbar arrows? Right now they appear black when the parent widget is disabled, but I think it would be more appropriate to draw them in a disabled color. I see states like Hovered, Checked, Pressed, etc..., but not Disabled. Or is there a more appropriate way to accomplish this with the widget library?

  11. #51

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Quote Originally Posted by jpbro View Post
    Olaf, a quick question about widget state drawing - Should there be a disabled state option for things like drawing the toolbar arrows? Right now they appear black when the parent widget is disabled, but I think it would be more appropriate to draw them in a disabled color. I see states like Hovered, Checked, Pressed, etc..., but not Disabled. Or is there a more appropriate way to accomplish this with the widget library?
    Erm,the W.Enabled state reflects that Disabled State (when it returns False).
    And each single Child-Widget (down the hierarchy) "inherits" the returned result,
    e.g. when the ParentControl in question was set to e.g.:

    MyToolBar.Widget.Enabled = False
    then all the cwToolBarItem-ChildWidgets will reflect this disabled parent-state in their own
    W.Enabled property (and can use that State-Info to properly redraw themselves).

    Maybe in your own Tests you missed, calling a ...Widget.Refresh or something?
    (the philosophy in the WidgetEngine is, to avoid doing too many "AutoRefresh-calls"
    under the covers, when Widget-Properties are changed - to avoid performance-
    issues, when certain Widget-Props are changed or initialized "in a loop" -
    so, manual Refreshs are needed after changing most Widget-Props (in case
    you want to see the immediate Effects).

    Thanks for posting the code-snippet to fix the little Bug in cwToolBarItem -
    will integrate that into the vbWidgets-Repo.

    Olaf

  12. #52
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Sorry for not being clearer. What I mean is that the arrow of a disabled cwToolbarItem is drawn identically to an arrow of an enabled cwToolbarItem. For example, compare:

    Name:  ToolbarArrows.jpg
Views: 1753
Size:  10.1 KB

    In other UIs that I'm familiar with, the arrow would be drawn in the "grayed" color (same as the disabled text color) to indicate that the arrow too is disabled.

    What I was thinking was that it would be accomplished in the Draw method of the cwToolbarItem class with something like:

    If ArrowType Then
    Cairo.Theme.DrawTo CC, W, thmTypeArrow, thmStateDisabled, dx - 11.5, (dy - ArrowSize) \ 2, ArrowSize, ArrowSize, 0, thmDirectionDown
    End If

    But there is no thmStateDisabled. I'm still getting familiar with the widget part of the library, so it's likely that my expectations are just out of sync with your implementations. Is there a way to draw the arrow in the disabled text color?

  13. #53

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Quote Originally Posted by jpbro View Post
    Sorry for not being clearer. What I mean is that the arrow of a disabled cwToolbarItem is drawn identically to an arrow of an enabled cwToolbarItem. For example, compare:
    Ah, I see - I see, sorry...

    Simple fix (directly within the cThemeWin7-Class) - then affecting all Arrow-Drawings automatically:

    In case you don't want to wait on my next vbWidgets-GitHub-Push you can do that by finding the snippet:
    Code:
    Case thmTypeArrow
            CC.TranslateDrawings (X + dx * 0.5) - 0.04, (y + dy * 0.5) + 0.22
            Angle = GetAngle(Direction)
            
            CC.RotateDrawingsDeg Angle
              CC.SetLineWidth 0.4
    '            CC.MoveTo -Int(dx * 0.28) + 0.15, 0
    '            CC.LineTo Int(dx * 0.28) + 0.45, -Int(dy * 0.5) - 0.45
    '            CC.LineTo Int(dx * 0.28) + 0.45, Int(dy * 0.5) + 0.45
                CC.MoveTo -(dx * 0.29), 0
                CC.LineTo (dx * 0.29), -(dy * 0.58)
                CC.LineTo (dx * 0.29), (dy * 0.58)
              CC.ClosePath
            CC.RotateDrawingsDeg -Angle
            
            Color = W.ForeColor
    ...
    Then just changing the last line above (which I've marked magenta) to:
    Code:
         Color = IIf(W.Enabled, W.ForeColor, W.DisabledColor)
    Just updated the cTheme-Class which is directly built into the RC5 as well with this small change
    (coming in the next release - but when vbWidgets.dll is used, it currently overrides the
    RC5-Theme-Instance anyways with its own one (cThemeWin7).

    Olaf

  14. #54
    Lively Member
    Join Date
    Oct 2014
    Posts
    93

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    I do appreciate your timely help.The problem is resolved perfectly

  15. #55
    Lively Member
    Join Date
    Oct 2014
    Posts
    93

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Will toolbar icons can achieve great style it?
    Style icon:
    Name:  MaxIcon.gif
Views: 1640
Size:  19.4 KB

  16. #56
    Lively Member
    Join Date
    Oct 2014
    Posts
    93

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    [VB6 Dynamic Menu-, Popup- and Toolbar-Demo] -----Error
    Error step:.
    1 to compile the project as a EXE file
    2 executive menu command "File->Open->cancel",
    3 exit EXE file
    4 mistake
    Name:  Err.png
Views: 1559
Size:  4.3 KB

    -----------------------------
    Error step:
    step1: IDE Moee create a cWidgetForm object
    step2: IDE Moee create call "New_c.FSO.ShowOpenDialog" method
    step3: Conversion project for exe files
    step4: Execute "ExeExitErrorDemo.exe" file (IDE Mode OK,Not error)
    step5: Click the Browse button
    step6: click Cancel button
    Step7: fourth: exit the "ExeExitErrorDemo.exe" file
    step8: there is an error

    Demo:
    ExeExitErrorDemo(vbRichClient5).zip

    undefined Code:
    1. Option Explicit
    2. 'to reproduce the fault, the project must be compiled into a EXE file. In IDE mode, there will be no fault. 要重现该故障,必需将此工程编译为exe文件。在IDE模式下,不会出现故障的
    3. Private pnlTool As cWidgetForm
    4.  
    5. Private Sub Form_Load()
    6.     Set pnlTool = Cairo.WidgetForms.CreateChild(Me.hWnd) '"After the cWidgetForm object is created, an error will occur.  创建cWidgetForm 对象后,才会发生错误
    7. End Sub
    8.  
    9. Private Sub Form_Terminate()
    10.     If Forms.Count = 0 Then New_c.CleanupRichClientDll
    11. End Sub
    12.  
    13. Private Sub btnBrowse_Click()
    14.     Dim strFilePath As String
    15.     strFilePath = OsdOpenDlg(Me.hWnd, "", "openregdlg")     'API OpenDlg Demo err
    16.     If Len(strFilePath) Then
    17.         MsgBox strFilePath
    18.     End If
    19. End Sub
    20.  
    21. Private Sub Command1_Click()
    22.     Dim Path As String
    23.     Path = New_c.FSO.ShowOpenDialog(, App.Path, , , , , Me.hWnd) 'New_c.FSO OpenDlg Demo err
    24.     If Len(Path) Then MsgBox Path
    25. End Sub

    Name:  E1.png
Views: 1530
Size:  18.4 KB
    Name:  E2.jpg
Views: 1462
Size:  42.6 KB
    Attached Images Attached Images  
    Last edited by smileyoufu; Aug 26th, 2016 at 11:39 PM.

  17. #57
    Lively Member
    Join Date
    Oct 2014
    Posts
    93

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Name:  E4.png
Views: 1423
Size:  25.4 KB

  18. #58
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Hi smileyoufu - I can't reproduce the problem here with your demo, are you using the latest version of the vbRC5 library?

  19. #59
    Lively Member
    Join Date
    Oct 2014
    Posts
    93

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Hi jpbro - Thank you very much for your help and reply.
    My Rc5 Version:5.0.50 LastUpdate:2016-7-21 22:31
    I'm sorry, maybe I didn't describe it clearly.

    Update:
    Error step:
    step1: IDE Moee create a cWidgetForm object
    step2: IDE Moee create call "New_c.FSO.ShowOpenDialog" method
    step3: Conversion project for exe files
    step4: Execute "ExeExitErrorDemo.exe" file (IDE Mode OK,Not error)
    step5: Click the Browse button
    step6: click Cancel button
    Step7: fourth: exit the "ExeExitErrorDemo.exe" file
    step8: there is an error

    ExeExitErrorDemo(vbRichClient5)-2.zip

    Name:  Bug1.jpg
Views: 1489
Size:  33.1 KB

    Name:  RC5Info.jpg
Views: 1490
Size:  55.4 KB

    Name:  V.jpg
Views: 1348
Size:  17.9 KB
    Last edited by smileyoufu; Aug 26th, 2016 at 11:34 PM.

  20. #60
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Strange, I can't reproduce the problem after following your steps. I tried on both Windows 10 and Windows XP and I'm able to close the window after showing and canceling the dialog without any error.

    NOTE: I did not run your EXE (you're not supposed to post binaries here BTW), but compiled my own binary from your source and I'm not getting the error.

  21. #61
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    你好smileyoufu ,我也没有发现你所说的问题,你的测试工程正常工作。
    I also did not find out what you said, your test works normally.

  22. #62
    Lively Member
    Join Date
    Oct 2014
    Posts
    93

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Re test results:
    1.OS:Win10--All OK
    2.OS:Win7 Chinese (64)+ China”vbWidgets-MenuDemos”--OK
    3.OS:Win7 Chinese (64)+”MenuAndToolbarDemo” --Error]

    Name:  Win7.jpg
Views: 1432
Size:  37.0 KB
    Attached Images Attached Images  
    Last edited by smileyoufu; Aug 27th, 2016 at 11:58 PM.

  23. #63
    Lively Member
    Join Date
    Oct 2014
    Posts
    93

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    陈林:谢谢你的回复。如果你是中国的,请加我QQ86053924交流
    Thank you very much.
    Re test results:
    1.OS:Win10--All OK
    2.OS:Win7 Chinese (64)+ China”vbWidgets-MenuDemos”--OK
    3.OS:Win7 Chinese (64)+”MenuAndToolbarDemo” --Error]

  24. #64

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Quote Originally Posted by smileyoufu View Post
    3.OS:Win7 Chinese (64)+”MenuAndToolbarDemo” --Error]
    Also cannot reproduce the problem (from the Demo-Code you posted) -
    but you might add some explicit cleanup-code for the pnlTool-Panel
    (in Form_Unload)...

    Code:
    Private Sub Form_Unload(Cancel As Integer)
       pnlTool.Unload
       Set pnlTool = Nothing
    End Sub
    As for the MenuAndToolbarDemo itself - what if you use the (Dll-compiled)
    Widget-Classes directly from the vbWidgets.dll ...

    Steps to switch to vbWidgets.dll:
    - remove all the Private Class-Files from the Project (cfPopUp and all cw... Classes).
    - put a reference to a recent vbWidgets.dll into the MenuAndToolbarDemo-Project (it contains the just removed Classes)

    What is the behaviour then?

    Olaf

  25. #65
    Lively Member
    Join Date
    Oct 2014
    Posts
    93

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    [QUOTE=Schmidt;5084477]Also cannot reproduce the problem (from the Demo-Code you posted) -
    but you might add some explicit cleanup-code for the pnlTool-Panel
    (in Form_Unload)...

    Thank you Olaf:
    Re:
    1.Has been added pnl Tool.Unload code, but does not work, there is still an error
    2.Here is a demo, with a minimum of code demonstrates the occurrence of an error process
    3.This process does not use vb Widgets.dll . errors and no relationship vb Widgets.dll

    ExeExitErrorDemo(vbRichClient5)-The simplest error demonstration.zip
    Name:  ErrorInfo-Has stopped working.jpg
Views: 1462
Size:  23.2 KB
    Code:
    Option Explicit
    'to reproduce the fault, the project must be compiled into a EXE file. In IDE mode, there will be no fault.
    '要重现该故障,必需将此工程编译为exe文件。在IDE模式下,不会出现故障的
    Private pnlTool As cWidgetForm
      '"After the cWidgetForm object is created, an error will occur.
      '创建cWidgetForm 对象后,才会发生错误
    Private Sub Form_Load()
        Set pnlTool = Cairo.WidgetForms.CreateChild(Me.hWnd)
    End Sub
    Private Sub Form_Unload(Cancel As Integer)
    pnlTool.Unload    'Add new    There is no change, there are still errors
        Set pnlTool = Nothing  'Add new    There is no change, there are still errors
    End Sub
    
    Private Sub Form_Terminate()
        If Forms.Count = 0 Then New_c.CleanupRichClientDll
    End Sub



    As for the MenuAndToolbarDemo itself - what if you use the (Dll-compiled)
    Widget-Classes directly from the vbWidgets.dll ...

    Steps to switch to vbWidgets.dll:
    - remove all the Private Class-Files from the Project (cfPopUp and all cw... Classes).
    - put a reference to a recent vbWidgets.dll into the MenuAndToolbarDemo-Project (it contains the just removed Classes)

    What is the behaviour then?
    ----------------------------------------
    Re Olaf:
    I'm using the latest vb Widgets.dll module test error persists
    ----------------------------------------
    Attached Images Attached Images  
    Attached Files Attached Files

  26. #66
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    678

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    These menus are awesome!

    I 'd like to use it in my PhotoModularFX to replace a DropDownList. (For the selection of the Node/FX to add )

    So I would have a main menu with -"Add Node"
    -Then a number of Categories
    -And For each category a number of entries.

    The number of entries are about 200
    I still don't know the number of categories.

    In short
    a big problem arises when a menu or submenu has a number of items such that they can not all be displayed at once on the screen.

    It should be introduced a vertical scroll bar or a vList
    but I have no idea how to do it ....

    Name:  JJJ.jpg
Views: 1193
Size:  64.5 KB


    Another solution in "Fruity Loop" Studio by "image line"
    is to add extra columns
    Name:  FL.jpg
Views: 1308
Size:  51.1 KB

  27. #67
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Hi reexre,

    As you may have seen if you've read this entire thread (OK, that's unlikely!), I did quite a lot of testing with this widget and posted, here, a lot of code changes and other feedback. Unfortunately, your particular case never crept onto my radar so I, personally, can offer no suggestions that will immediately remedy your problem. Hopefully, Olaf will chime-in if this is a situation he has already thought about.

    If not, maybe I can find some time to look at this over the weekend. Happy to help out another proponent of RC5 and really good, also, to see an amazing product that you have delivered (using RC5) in PhotoModularFX.
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  28. #68
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Unfortunately I have no immediate solution either, but if we're exploring possible solutions I'd like to chime in with some thoughts.

    First, I don't like scrolling menus - if you have that many items, I think there must be a better UI choice. The Fruity Loops example is OK (definitely preferable to a scrolling menu IMO).

    Another option would be to have alphabetic sub-menus like Notepad++:

    Name:  notepad_language_menu.jpg
Views: 1362
Size:  39.3 KB

    But as a keyboard entry kind of guy, I would love to just be able to type into a search box for long menus like this. For example, the menu pops up (like the Fruity Loops example), but a search box also takes focus. I can then start typing: "p", "u", "r", 'e"... and the list gets filtered as I go eventually to show (with the first item highlighted):

    Code:
    Pure FM
    Pure FM 1
    Pure FM 2
    Pure FM 3
    Pure FM PWM
    I can then press Enter to select the highlighted item (or click with the mouse if I prefer), or press up/down arrows to move the selection. ESC would first clear the search, then subsequently close the menu if pressed again (cancel/no selection).

  29. #69
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    And before anyone starts complaining about my 76 "New" tabs...yes, yes, I know!

  30. #70
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    678

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    thanks collinE66
    I'm close to what I need.
    The only problem now is that a menu with a lot of items suffers of Very slow Mouseover-event (Highlight)
    Name:  Immagine.jpg
Views: 1255
Size:  31.2 KBName:  Immagine2.jpg
Views: 1227
Size:  51.8 KB

    I changed in ConstructMenuFromDataSource of cwMenu
    Code:
    Private Sub ConstructMenuFromDataSource(DataSource As cMenuItem)
        Const IcoOffsX& = 30
        Dim DSItem As cMenuItem, MenuItem As cwMenuItem, MCC As cCairoContext, RM As cwMenu
        Dim I As Long, dx As Double, dy As Double, Caption As String
        Dim ItemX As Single
        Dim MaxH As Single
    
        Set RM = RootMenu
    
        Set mDataSource = DataSource
        Set MCC = W.MeasureContext
        mRowHeight = MCC.GetFontHeight + 7
    
        mMenuWidth = 0
        For I = 0 To mDataSource.SubItemCount - 1
            Set DSItem = mDataSource.SubItemByIndex(I)
            Caption = DSItem.Caption
            dx = MCC.GetTextExtents(Caption)
            If mMenuWidth < dx Then mMenuWidth = dx
        Next I
        mMenuWidth = IcoOffsX + mMenuWidth + 45
    
        mMenuHeight = 2
        For I = 0 To mDataSource.SubItemCount - 1
            Set DSItem = mDataSource.SubItemByIndex(I)
    
            Caption = DSItem.Caption
            If Caption = "-" Then
                dy = 8
            Else
                If Not RM Is Nothing Then RM.RaiseReplaceCaption DSItem, Caption
                dy = mRowHeight
            End If
    
            Set MenuItem = Widgets.Add(New cwMenuItem, DSItem.Key, ItemX, mMenuHeight, mMenuWidth - 2, dy)
            MenuItem.Widget.ImageKey = DSItem.IconKey
            MenuItem.Widget.Enabled = DSItem.Enabled
            MenuItem.Widget.FontName = W.FontName
            MenuItem.Widget.FontSize = W.FontSize
            MenuItem.Widget.BackColor = W.BackColor
            MenuItem.Caption = Caption
            MenuItem.IsCheckable = DSItem.IsCheckable
            MenuItem.IsOption = DSItem.IconKey = OptionMenuItemIconKey  'Here is the workaround to have
            'option-like cwMenuItems from cMenuItems
            'with "magic" iconkey indicator
            If DSItem.IsCheckable Then MenuItem.Checked = DSItem.Checked
            If Caption = "-" Then MenuItem.Widget.Enabled = False
            If DSItem.SubItemCount Then Set MenuItem.SubMenuDS = DSItem
            mMenuHeight = mMenuHeight + dy
    
            If mMenuHeight > Screen.Height / Screen.TwipsPerPixelY - dy * 2 Then
                MaxH = mMenuHeight
                ItemX = ItemX + mMenuWidth
                mMenuHeight = 0
            End If
    
        Next I
    
        If ItemX Then
            mMenuWidth = ItemX + mMenuWidth
            mMenuHeight = MaxH
        End If
    
        mMenuHeight = mMenuHeight + 4
    End Sub
    and just this line in InitAndShow
    Code:
    ...
        If PopupPosY < 4 Then PopupPosY = 4
    
        Set PopUp = New cfPopUp
        PopUp.Load Me, PopupPosX, PopupPosY, mMenuWidth, mMenuHeight, mInitiatorWidget.Zoom
    
        PopUp.Show
    ...

    I swap icons to the right...
    I don't know if it is not a standard , but I prefer to have the icons at right...



    EDIT
    If mMenuHeight > Screen.Height / Screen.TwipsPerPixelY - dy * 2 Then
    I think this should be replaced with something else, expecially if zoomed app or DPI-aware ... don't know exactly

  31. #71
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Ok, if you could upload a small demo project incorporating the changes you have made so far, that would save me a bit of time.

    I have to say, though, I agree with jpbro about this approach to your UI design. If I were a user of software that presented choices to me like that, I'd most likely look for an alternative program. It's just...too...overwhelming!
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  32. #72
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    678

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    @CollinE66
    Changes are only the "red" lines...
    I meant the menu to have all items in categories plus a "ALL/Everything" category with all items.
    But , yes, maybe is better to group all items in Categories, without the the ALL/Everything, even if I though it could be useful to find an Item when one doesn't know its category. (Alphabetical get)
    (In my PhotoModularFX now, all items are in a Dorp-Down List)
    (I still have to find a good category for each Item)

    EDIT (1):
    Link to Small Demo

    EDIT (2)
    Link removed (noone cares ... )

  33. #73

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Quote Originally Posted by reexre View Post
    I meant the menu to have all items in categories plus a "ALL/Everything" category with all items.
    I agree with Colin that this "All/Everyting" entry in the Menu should be handled differently.

    I would place it "at the top" of the menu - as a simple entry like:
    - "All..." (the 3 dots informing the User, that "something follows", usually a Popup-Dialog or some other kind of indirection into the GUI...)

    Such a Popup-Dialogue (or non-modal ToolWindow) could then use (on the left-hand-side):
    - a cwVList ... which in its OwnerDraw-Event allows you to not only render Text and SubText for the Item-Entry, but larger Icons as well
    ..(in your case I'd perhaps show "two-of-them", to kind of describe the "before-and-after" transition the effect in question will produce)

    On the right-Hand-side beside the cwVList (if you'd make that ToolForm somewhat larger horizontally):
    - you could show "on List-Click" even a "live-effect" of the transform, based on a "somewhat larger than IconSize, nice Input-Image"
    ..(instead of the "principle-transition via two smaller Icons", which the cwVList-rendering shows on the left).

    Since the cwVList would be scrollable (even searchable if you put a little Search-Field into that PopUp),
    you could give the User a nice "All Effects in alphabetical Order"-Overview in a still comparably small PopUp- or Tool-Window.

    Olaf

  34. #74
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,253

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Hi reexre,

    Well, I took a look at the code and had a little play: One of the first things that struck me was how often the Paint event of cwMenu fires. When mousing over different items (on the same menu), it fires no less than six times! The smallest number I could that down to was two. It seems that, for each widget that receives the focus, we get two paint events in the parent. One for the newly-focused widget and one for the outgoing one, I'm guessing. If I am right about this (Olaf?), then presumably this is part of the internal widget engine behaviour.

    Anyway, although I could reduce the number of these paints down to two (and some functionality was compromised by that, btw), it led to no significant improvement that could help in a scenario such as your large multi-column menu, I'm afraid. Maybe it's possible with some internal widget-engine changes, but that's speculation on my part...
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  35. #75
    Lively Member
    Join Date
    Nov 2020
    Posts
    67

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Very very good!
    Just what I was looking for, thanks!

    Quote Originally Posted by Schmidt View Post
    The example is completely ownerdrawn and truly independent from any MS-Menu-APIs, so one
    can adapt *anything* as needed (e.g. the shape of the dropdown-form, colors, fonts, etc.) -
    though the Demo as it is tries for a moderate style, mimicking a Win7-look roughly (with some
    slight differences I personally like, but the whole thing is adaptable as said).
    Olaf
    I'd like to change the style of the menu.
    Where can I find some documentation?
    I couldn't find anything about this on your site.

    The RC5widgetsTutorial\5 Widgets and the Theme-Engine sample is empty.

    Thank a lot.
    Last edited by LeoFar; Feb 26th, 2021 at 03:17 PM.

  36. #76
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Olaf, It looks as if this will be the next item I will be experimenting with, adding a menu to a transparent form (as you demonstrated to me in the other thread).

    Is it possible to call a hidden VB6 form's popupmnu method?

    For simplicity's sake I had hoped that it would be possible to trigger a separate hidden native VB6 form's popupmnu method, meaning that I could re-use an existing VB6 menu from another project lock, stock and barrel.

    FYI. On my transparent GDI+ dock I use the PopupMenu method of the local transparent form to call a separate menu form that has it's visible property set to false,
    Code:
    Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
        If Button = vbRightButton Then 'right click to display a menu
            PopupMenu menuForm.mnuMainMenu, vbPopupMenuRightButton. 
        endif
    end sub
    Using this approach I can copy/paste the menuForm into any project and encapsulate all the menu code and make it easily transferable between projects. Is it possible to do the same with the PopupMenu method, for instance, in your steampunk earth widget? It would make it much easier to transfer an existing menu from a similar program if it were possible.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  37. #77
    Frenzied Member VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    1,322

    Lightbulb Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    You can call "PopupMenu" from anywhere and supply a menu object as parameter. Furthermore you can assign that single PopupMenu to any other form or class using a callback mechanism. I have demonstrated this callback process in my Lightweight RichEdit Unicode Textbox class. There you can see the PopupMenu was created on the form as usual but it responds individually to each RichEdit TextBox created.

    Also a PopupMenu should respond to the "WM_CONTEXTMENU" message which is triggered by pressing the specific Windows Menu key and also "Shift-F10" in addition to the usual right mouse click...

    Form containing the PopupMenu:
    Code:
    Private m_Callback As IPopupMenu
    
    Public Property Set Callback(oCallback As IPopupMenu)
        Set m_Callback = oCallback
    End Property
    
    Private Sub mnuContextOptions_Click(Index As Integer)
        If Not (m_Callback Is Nothing) Then m_Callback.Click Index, mnuContextOptions
    End Sub
    IPopupMenu class:
    Code:
    Option Explicit
    
    Public Sub Click(Index As Integer, objMenu As Object)
    
    End Sub
    Then you implement IPopupMenu in all other forms or classes where you want to use it:

    Code:
    Implements IPopupMenu
    
    Set menuForm.Callback = Me
    Last edited by VanGoghGaming; Apr 13th, 2023 at 08:21 AM.

  38. #78
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    It is possible - I just answered my own question! My motto should be think first, speak after.



    Code:
    Private Sub W_MouseDown(Button As Integer, Shift As Integer, ByVal x As Single, ByVal y As Single)
       If Button = vbRightButton Then
            Call menuForm.PopupMenu(menuForm.mnuMainMenu)
       End If
    end sub

    PS. and Van Gogh got in first - thankyou Van Gogh but I have an answer right ear.
    Last edited by yereverluvinuncleber; Apr 13th, 2023 at 09:39 AM.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  39. #79
    New Member
    Join Date
    Nov 2023
    Posts
    4

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    One Bug:
    When we change the fontsize of the menu(PopUpMenus Demo), the display interface is confusing:
    Code:
     PopUp.Widget.FontSize = 20
    Name:  PopMenuErr.jpg
Views: 135
Size:  15.3 KB

    Bug Class: cwMenu
    Bug Sub: ConstructMenuFromDataSource Sub
    Code:
    Private Sub ConstructMenuFromDataSource(DataSource As cMenuItem)
    
      Set RM = RootMenu
      
      Set mDataSource = DataSource
      Set MCC = W.MeasureContext
      mRowHeight = MCC.GetFontHeight + 7
      
      mMenuWidth = 0
      For i = 0 To mDataSource.SubItemCount - 1
        Set DSItem = mDataSource.SubItemByIndex(i)
        Caption = DSItem.Caption
        dx = MCC.GetTextExtents(Caption)
        If mMenuWidth < dx Then mMenuWidth = dx
      Next i
    mRowHeight is always 22(e.g. MCC.GetFontHeight = 15), regardless of the fontsize. The same error appears in the statement: dx =e MCC.GetTextExtents

  40. #80

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)

    Quote Originally Posted by wuxiu View Post
    One Bug:
    When we change the fontsize of the menu(PopUpMenus Demo)...
    Don't do that, then...

    If this was applied, to account for "DPI-awareness", there's a far better option:
    - simply set the cWidgetRoot.Zoom to a factor > 1

    E.g. when the Widgets in question are hosted on a:
    - Public Form As cWidgetForm
    - or on a Panel As cWidgetForm

    Then the whole thing can be adjusted (including the Popup-Menu), with a one-liner like:
    Form.WidgetRoot.Zoom = Form.WidgetRoot.CurrentDisplay.Zoom 'or a userdefined Factor between e.g. 0.5 - 3.0
    or
    Panel.WidgetRoot.Zoom = Panel.WidgetRoot.CurrentDisplay.Zoom 'or a userdefined Factor between e.g. 0.5 - 3.0

    No need to adjust Font-Sizes separately on each Widget or Popup...
    (the whole Widget-engine-concept supports "Device-Independend-Pixels" (DIP))
    https://www.google.com/search?q=%22D...dent-Pixels%22

    Olaf

Page 2 of 3 FirstFirst 123 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