QueryStatus Not Being Called

Discussions related to SoftPro Select user interface development.

Moderator: Phil Barton

Post Reply
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

QueryStatus Not Being Called

Post by roteague »

I've got multiple packages registred in my application. One of the packages works perfectly, however on the other QueryStatus never gets called. This package is defined as (some lines omitted for clarity):

Code: Select all

    <MenuRef id="shell:RibbonMenu">
      <Group id="RibbonTabGroup1" priority="100">
        <Menu id="TGAdminRibbonTab" priority="10" text="TGAdmin (New)">
          
          <Group id="RibbonTabChunksGroup1" priority="10">
            <Menu id="RibbonChunk1" priority="10" text="TG SoftPro Configuration">
              <Group id="RibbonChunkItemsGroup1" priority="10" style="Horizontal">

                <Button id="TimelineConfigButton" kind="Button" largeImage="Resources\Timeline-32x32.png"
                        smallImage="Resources\Timeline-16x16.png" priority="10" text="Timeline Dynamic"
                        toolTip="Click here to manage the Timeline Contingency List." style="TextUnderneath" />
                <Button id="PrintJobTasksRibbonButton" kind="Button" largeImage="Resources\PrintTasks.png"
                        smallImage="Resources\PrintTasks.png" priority="10" text="Print Job Tasks"
                        toolTip="Click here to manage Print Job Tasks." style="TextUnderneath Dynamic" />
                
              </Group>
            </Menu>
          </Group>
and the register handler as:

Code: Select all

  base.RegisterHandler(TGAdminScreensPackage.DuplicateTMKAdminButton, this.DuplicateTMKAdminButton_Invoked);
            base.RegisterHandler(TGAdminScreensPackage.PrintJobTasksRibbonButton, this.PrintJobTasksButton_Invoked);

            base.RegisterHandler(TGAdminScreensPackage.DuplicateTMKAdminButton, null, this.MyButton_QueryStatus);
            base.RegisterHandler(TGAdminScreensPackage.PrintJobTasksRibbonButton, null, this.MyButton_QueryStatus);

            base.RegisterHandler(TGAdminScreensPackage.RibbonTabGroup1, null, this.TGAdminRibbonTab_QueryStatus);
All of the events are raised, except for the last one. This doesn't work on any computer it's installed or, nor any other developer station, so it's not related to issues with my machine.

Any ideas?
Robert
Hadi Chemaly

Re: QueryStatus Not Being Called

Post by Hadi Chemaly »

Hi Robert,

You cannot attach event handlers to ctd groups as a group represents a conceptual layer; you should rather attach handlers to concrete items such as menus, buttons, etc. Now having said that, we do not give you the ability to interfere with the status of ribbon tabs as that violates the guidelines for the Microsoft Office Fluent UI after which we modeled our ribbon.

Can you tell us what you are trying to achieve through your last query status handler?

On another note, and you are probably aware of this, you can register a query status handler and an invoke handler within the same RegisterHandler(commandID, invokeHandler, queryStatusHandler) call, there is no need to split it in two and use null to fill the gap. Two calls would still work though as you have it right now.

I hope this helps.
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: QueryStatus Not Being Called

Post by roteague »

The exact same code works fine in another package.

We are trying to turn off the tab, which we are able to do in another package. FWIW, I don't believe this violates the Office Fluent UI guidelines, as ribbons can be context sensitive (notice how the developer tab can be turned on/off in MS Office products, for example).
Robert
Hadi Chemaly

Re: QueryStatus Not Being Called

Post by Hadi Chemaly »

Robert,

You are right, my previous statement about tab visibility is inaccurate as a general statement. I digged a little deeper, and found out the following:

1. We do no let you interfere with the visibility of Select tabs even if you try to register query status handlers to manipulate their state.
2. Once the visibility of a ribbon tab is determined at the launch of the application, it cannot be changed during the same session. In other words, a tab does not appear and disappear dynamically while the application is running, but is rather either visible or invisible for as long as the application instance is running.
3. Dynamic ribbon tab behavior is available through contextual tabs. For an example, look at the SPAdmin Users and Groups.

For you purpose, try registering a query status handler for TGAdminRibbonTab instead of RibbonTabGroup1.

Sorry for the confusion.
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: QueryStatus Not Being Called

Post by roteague »

Thanks Hadi,

We want to turn on/off the tab at runtime. The tabs aren't dynamic.

We have two packages, one that works:

Code: Select all

            // Determine whether to show or hide the tab from the user
            base.RegisterHandler(TGAdminPackage.TGAdminRibbonTabGroup1, null, this.TGAdminRibbonTab_QueryStatus);

--- CTD:
    <MenuRef id="shell:RibbonMenu">
      <Group id="TGAdminRibbonTabGroup1" priority="90">
        <Menu id="TGAdminRibbonTab" priority="10" text="TGAdmin" style="Dynamic">

          <!-- TGAdmin Configuration -->
          <Group id="TGAdminRibbonTabChunksGroup1" priority="10">
            <Menu id="OrderScreensRibbonChunk" priority="10" text="Configuration">
              <Group id="OrderScreensRibbonChunkItemsGroup1" priority="10" style="Horizontal">
                
                <Button id="TimelineConfigurationRibbonButton" kind="Button" largeImage="Resources\Timeline-32x32.png" 
                        smallImage="Resources\Timeline-16x16.png" priority="10" text="Timeline" 
                        toolTip="Click here to manage the Timeline Contingency List." style="Dynamic TextUnderneath" />
              </Group>
            </Menu>
          </Group>
          
        </Menu>
      </Group>
    </MenuRef>

and one that doesn't:

Code: Select all

            
// Determine whether to show or hide the tab from the user
            base.RegisterHandler(TGAdminScreensPackage.RibbonTabGroup1, null, this.TGAdminRibbonTab_QueryStatus);
Robert
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: QueryStatus Not Being Called

Post by roteague »

Accidentally posted too soon:

Code: Select all

--- CTD:
    <MenuRef id="shell:RibbonMenu">
      <Group id="RibbonTabGroup1" priority="100">
        <Menu id="TGAdminRibbonTab" priority="10" text="TGAdmin (New)">
          
          <Group id="RibbonTabChunksGroup1" priority="10">
            <Menu id="RibbonChunk1" priority="10" text="TG SoftPro Configuration">
              <Group id="RibbonChunkItemsGroup1" priority="10" style="Horizontal">

                <Button id="TimelineConfigButton" kind="Button" largeImage="Resources\Timeline-32x32.png"
                        smallImage="Resources\Timeline-16x16.png" priority="10" text="Timeline Dynamic"
                        toolTip="Click here to manage the Timeline Contingency List." style="TextUnderneath" />
                <Button id="PrintJobTasksRibbonButton" kind="Button" largeImage="Resources\PrintTasks.png"
                        smallImage="Resources\PrintTasks.png" priority="10" text="Print Job Tasks"
                        toolTip="Click here to manage Print Job Tasks." style="TextUnderneath Dynamic" />
                
              </Group>
            </Menu>
          </Group>

          <Group id="OrderAdminChunksGroup" priority="10">
            <Menu id="OrderAdminChunk" priority="10" text="Order Admin Tasks">
              <Group id="OrderAdminItemsChunkItemsGroup" priority="10" style="Horizontal">

                <Button id="DuplicateTMKAdminButton" kind="Button" largeImage="Resources\DuplicateTMK.png"
                        smallImage="Resources\DuplicateTMK.png" priority="10" text="Duplicate TMK"
                        toolTip="Click here to manage the Duplicate TMK List." style="TextUnderneath Dynamic" />

              </Group>
            </Menu>
          </Group>

        </Menu>
      </Group>
    </MenuRef>
Using TGAdminRibbonTab doesn't work. I can zip this up if you like and send it via email.

The only differerence I can see, is the package that doesn't work is VS2008 and the one that does is VS2010.

Thanks,

Robert
Robert
Hadi Chemaly

Re: QueryStatus Not Being Called

Post by Hadi Chemaly »

I noticed you are missing the

Code: Select all

style="Dynamic"
in your second .ctd code (the one not working).

Could this be your issue?
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: QueryStatus Not Being Called

Post by roteague »

Hadi,

I added the style Tag, but still doesn't seem to make a difference. I'm a bit busy on other things right now, but I'll work with it a bit more when I get time.
Robert
Post Reply