Author Topic: need help from Nikolay on his addin (or someone else who is smarter than me)  (Read 1217 times)

0 Members and 1 Guest are viewing this topic.

perry59

  • Sr. Member
  • ****
  • Posts: 290
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

  • Hero Member
  • *****
  • Posts: 1639
    • ShapeSheet™ Knowledge Base
Hi, perry59!

Which addin do you mean?

Nikolay

  • Hero Member
  • *****
  • Posts: 1144
    • UnmanagedVisio
Could you be more specific :)
I mean, some screenshot may and which add-in do you mean?

perry59

  • Sr. Member
  • ****
  • Posts: 290
A picture is worth a dozen words, hope this helps :)

Nikolay

  • Hero Member
  • *****
  • Posts: 1144
    • UnmanagedVisio
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:
Code
        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

  • Sr. Member
  • ****
  • Posts: 290
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

  • Sr. Member
  • ****
  • Posts: 290
Oh, and to answer questions, it is my own addin using Nikolay's addin template (vb version)

Nikolay

  • Hero Member
  • *****
  • Posts: 1144
    • UnmanagedVisio
So did changing this "300" to something else work?
It should be the same in VB version:
Code
    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

  • Sr. Member
  • ****
  • Posts: 290
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?
« Last Edit: November 03, 2022, 11:37:01 AM by perry59 »

Nikolay

  • Hero Member
  • *****
  • Posts: 1144
    • UnmanagedVisio
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

  • Sr. Member
  • ****
  • Posts: 290
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

  • Sr. Member
  • ****
  • Posts: 290
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

  • Hero Member
  • *****
  • Posts: 1144
    • UnmanagedVisio
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

  • Sr. Member
  • ****
  • Posts: 290
Thanks for your help Nikolay, so glad you're still here!

perry59

  • Sr. Member
  • ****
  • Posts: 290
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.