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...
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
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.
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
Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)
Originally Posted by smileyoufu
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:
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?
Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)
Originally Posted by jpbro
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.
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:
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?
Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)
Originally Posted by jpbro
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:
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).
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
-----------------------------
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
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
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.
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]
Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)
Originally Posted by smileyoufu
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)
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
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
----------------------------------------
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...
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++:
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).
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)
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
Last edited by reexre; Feb 23rd, 2018 at 04:44 AM.
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...
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 ... )
Last edited by reexre; Feb 28th, 2018 at 03:47 PM.
Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)
Originally Posted by reexre
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.
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...
Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)
Very very good!
Just what I was looking for, thanks!
Originally Posted by Schmidt
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.
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.
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.
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.
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.
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.
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
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
Re: VB6 Dynamic Menu-, Popup- and Toolbar-Demo (vbRichClient-based)
Originally Posted by wuxiu
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