need help from Nikolay on his addin (or someone else who is smarter than me)

Started by perry59, November 02, 2022, 06:49:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

perry59

I  am having an issue with the anchor panel. Typically I can click a button on my ribbon to show or hide it.
Right now when I click the button the panel shows, but it's just a little sliver at the right side of the visio window which I must carefully grab with the mouse curser to pull it out to a usable size. As soon as I click outside the panel, in the main window, the panel goes back to being a small sliver. It looks like the code gives it an initial size but visio is squishing it. Is there something I can do in code to prevent this from happening or is this some visio setting I am unaware of?
Thanks

Surrogate


Nikolay

Could you be more specific :)
I mean, some screenshot may and which add-in do you mean?

perry59


Nikolay

As far as I unnerstand, you are using this project template, right?
https://marketplace.visualstudio.com/items?itemName=NikolayBelyh.ExtendedVisioAddinProject2017

If so, the default panel width is set in the "PanelFrame" file, here:

        public Window CreateWindow(Window visioParentWindow)
        {
            Window retVal = null;

            try
            {
                if (visioParentWindow == null)
                    return null;

                if (_form != null)
                {
                    _visioWindow = visioParentWindow.Windows.Add(
                        _form.Text,
                        (int)VisWindowStates.visWSDockedRight | (int)VisWindowStates.visWSAnchorMerged | (int)VisWindowStates.visWSVisible,
                        VisWinTypes.visAnchorBarAddon,
                        0,
                        0,
                        300, // <<<<<<<<<<<<<<< default panel width
                        300,
                        AddonWindowMergeId,
                        string.Empty,
                        0);



perry59

yes, that's it, only difference is I'm using the VB version, but it still has 300.
although the panel is still squished to the smallest possible width until I manually stretch it out

perry59

Oh, and to answer questions, it is my own addin using Nikolay's addin template (vb version)

Nikolay

So did changing this "300" to something else work?
It should be the same in VB version:

    Public Function CreateWindow(visioParentWindow As Window) As Window
        Dim retVal As Window = Nothing
        Try
            If visioParentWindow Is Nothing Then
                Return Nothing
            End If
            If _form IsNot Nothing Then
                _visioWindow = visioParentWindow.Windows.Add(_form.Text,
                        CInt(VisWindowStates.visWSDockedRight) Or CInt(VisWindowStates.visWSAnchorMerged) Or CInt(VisWindowStates.visWSVisible),
                        VisWinTypes.visAnchorBarAddon,
                        0,
                        0,
                       300,
                       300,
                       AddonWindowMergeId, String.Empty, 0)

perry59

I never changed it from the default "300" as that worked fine in the past. I will try and see what happens but I don't expect any change.
I don't know why that now the panel shrinks to it's smallest possible width when it opens. I'm thinking it's a visio thing and not an issue with your addin code.So I am looking for a way to "force" it open regardless of what visio wants.

EDIT:
in fact I'm sure it's a visio issue because I just ran this on my laptop and it works as expected. There is something about the visio installation on my work computer that is causing this, I just don't know what it is yet. Something in visio settings? something in the registry?

Nikolay

I see. Maybe some update to Visio UI rolled out by Microsoft recently.
Just tested my current one (Microsoft® Visio® Plan 2 MSO (Version 2210 Build 16.0.15726.20068) 32-bit) - for me the panel seems to be okay (i.e. width "300" is respected)

If you could share Visio version (or maybe the project itself) I could try to reproduce the issue.

perry59

when I get back to my desk I'll get the version and build number. All I can say now is that we are on visio 2016, I also have that on my laptop. I am unaware of any updates to visio lately

perry59

the build info for my visio at work (the problematic one) is:
Microsoft® Visio® 2016 MSO (Version 2209 Build 16.0.15629.20196) 32-bit

the build info for my personal copy (that works) is:
Microsoft® Visio® 2016 MSO (Version 2210 Build 16.0.15726.20070) 64-bit

again, I don't think it's a problem with the addin code, just something weird with the visio installation on my work computer

Nikolay

Last time I have seen an issue with child window positioned oddly was when there was some optimization introduced for the hardware acceleration in Visio (the "panel" started appearing in the top-left corner of the screen instead of docked-right).
Then it somehow fixed itself with the next Visio update. I'll try to install that version exactly to try the next days.

perry59


perry59

Still haven't been able to figure out what's going on, google has not helped much. It only happens on my work computer which is weird, on my laptop with the same version of visio it works fine. Another strange symptom, if the drawing window is maximized and you hit alt-f7 which shrinks the drawing window just a bit the panel peeks out a little more, making it more obvious that something is supposed to be there.