Jump to content
Sign in to follow this  
trancexx

Ribbon

Recommended Posts

Andreik It would probably be:

Func _MyUIApp_OnViewChanged($pSelf, $iViewId, $iTypeId, $pView, $iVerb, $iReason)
    #forceref $pSelf, $iViewId, $iTypeId, $pView, $iVerb, $iReason
    Local Static $g_pRibbon
    Switch $iVerb
        Case 0  ;UI_VIEWVERB_CREATE
            ConsoleWrite("UI_VIEWVERB_CREATE" & @CRLF)
            If Not IsObj($g_pRibbon) Then
                Local $oUnknown = ObjCreateInterface($pView, $sIID_IUnknown, "")
                $oUnknown.AddRef()
                Local $pRibbon
                $oUnknown.QueryInterface($sIID_IUIRibbon, $pRibbon)
                $g_pRibbon = ObjCreateInterface($pRibbon, $sIID_IUIRibbon, $tagIUIRibbon)
            EndIf
        Case 2  ;UI_VIEWVERB_SIZE
            ConsoleWrite("UI_VIEWVERB_SIZE" & @CRLF)
            Local $uRibbonHeight
            If IsObj($g_pRibbon) Then $g_pRibbon.GetHeight($uRibbonHeight)
            ConsoleWrite("$uRibbonHeight = " & $uRibbonHeight & @CRLF)
    EndSwitch
    Return 0 ; S_OK
EndFunc
Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Thank you it works but now I'm confused. Based on what it's calculated the height of the ribbon? I have a windows that cannot be resized and the ribbon is 146 px height on (readed in _MyUIApp_OnViewChange and with AutoIt Info Tool, same value no matter used machine) but on different machines, the appearance is not the same.

snc3ed.png   35c3ml4.png

LE: I forgot to mention how other controls are created.

The controls are created at positions based on ribbon height + an offset. For example the most left label that surround the treeview it located at position 150 (146 ribbon height + 4px).

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites

That looks to me as if the quick access toolbar (being right of the window's icon) of the ribbon was placed below the ribbon and then put above after the other controls have been created. In that case an offset of about 25px would have been created.

Do you rearrange other controls every time OnViewChanged is called? You should.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Ok, let's say I rearrange all controls every time OnViewChange is called but how can I know how to rearrange them because I know just the ribbon actions: UI_VIEWVERB_CREATE, UI_VIEWVERB_SIZE. For example UI_VIEWVERB_SIZE is called when I minimize/restore the ribbon or when I set the quick access below or above the ribbon. When I minimize the ribbon, controls should be placed in a position different than when quick acees is placed below ribbon. Or maybe if it's possible I would like to remove these options.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Don't remove them. They make ribbon what ribbon is.

What do you mean you don't know how to rearrange the controls. Are we talking about the same controls? I'm talking about controls that you make in your gui - buttons, listviews, etc...


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Yes, about the controls used in my gui. If I choose to minimize the ribbon all my gui controls should be moved a little up but how can I know I choosed to minimize the ribbon and not to place the quick access bar below ribbon case when all my gui controls should be moved a little down. All I said it's both actions are trapped in OnViewChange with message UI_VIEWVERB_SIZE and no more informations about.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Hm, I don't get it. Can you upload your files so that I can try.

I have updated the first post with new/old example and I'm moving controls as ribbon moves there. Do you have problems with that script?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

No I haven't and now I made my script to move well the controls. If you don't mind I would have one more question. When my gui is resizing to make enough space for all controls and gui it's big enough to get out of my screen I have a bad effect on my gui like in the image.

2582yz9.png

I suppose it something related to used gui style. The style of window is:

BitXOR($WS_OVERLAPPEDWINDOW,$WS_MINIMIZEBOX,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME)

 

 


When the words fail... music speaks

Share this post


Link to post
Share on other sites

AutoIt internally does lots of processing when you resize windows. If you don't care much about what AutoIt want to do with controls then you can register WM_SIZE and do youur own processing there when sizing happens. I'm doing that in my script.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

I did it already but unfortunately this don't prevent this problem. Anyway thanks for your help, I'm pretty sure I'll find soon a solution for this problem. :)


When the words fail... music speaks

Share this post


Link to post
Share on other sites

I did it already but unfortunately this don't prevent this problem. Anyway thanks for your help, I'm pretty sure I'll find soon a solution for this problem. :)

 

Hello all / Andreik,

i know it´s long ago, but I have now exactly the same problem. Do you find a solution for this problem?

Share this post


Link to post
Share on other sites

Thank you it works but now I'm confused. Based on what it's calculated the height of the ribbon? I have a windows that cannot be resized and the ribbon is 146 px height on (readed in _MyUIApp_OnViewChange and with AutoIt Info Tool, same value no matter used machine) but on different machines, the appearance is not the same.

snc3ed.png   35c3ml4.png

LE: I forgot to mention how other controls are created.

The controls are created at positions based on ribbon height + an offset. For example the most left label that surround the treeview it located at position 150 (146 ribbon height + 4px).

 

I found out the problem yesterday. The problem is the AERO-Style from Windows. If AERO is active, the controls are fitting perfect in the GUI.

Share this post


Link to post
Share on other sites

Have anyone an idea if it's possible to create dynamic the binary markup that is shown in example as ribress.dll?


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Looking through MSDN documentation I tried to create different groups of buttons with ControlGroup element but for some reason all my examples fail to compile except the example from MSDN. So I think I miss something but for some reason it's not obviously exactly what.

Here is the MSDN XML markup:

<Group CommandName="cmdSizeDefinitionsGroup"
       SizeDefinition="ButtonGroups">
  <!-- Row 1 -->
  <ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton1" />
      <Button CommandName="cmdSDButton2" />
      <Button CommandName="cmdSDButton3" />
      <Button CommandName="cmdSDButton4" />
      <Button CommandName="cmdSDButton5" />
      <Button CommandName="cmdSDButton6" />
      <Button CommandName="cmdSDButton7" />
      <Button CommandName="cmdSDButton8" />
      <Button CommandName="cmdSDButton9" />
      <Button CommandName="cmdSDButton10" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton11" />
      <Button CommandName="cmdSDButton12" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton13" />
      <Button CommandName="cmdSDButton14" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton15" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton16" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton17" />
      <Button CommandName="cmdSDButton18" />
    </ControlGroup>
  </ControlGroup>
  <!-- Row 2 -->
  <ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton19" />
      <Button CommandName="cmdSDButton20" />
      <Button CommandName="cmdSDButton21" />
      <Button CommandName="cmdSDButton22" />
      <Button CommandName="cmdSDButton23" />
      <Button CommandName="cmdSDButton24" />
      <Button CommandName="cmdSDButton25" />
      <Button CommandName="cmdSDButton26" />
      <Button CommandName="cmdSDButton27" />
      <Button CommandName="cmdSDButton28" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton29" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton30" />
      <Button CommandName="cmdSDButton31" />
    </ControlGroup>
  </ControlGroup>
  <Button CommandName="cmdSDButton32" />            
</Group>

And this is the result:

IC510686.png

You can see how buttons from the first row are groups of 10, 2, 2, 1, 1, 2 buttons.

Well if I try to group the buttons from the first line in groups of 10, 2, 2, 2, 2 then I need to put button15 and button16 in the same control group and the XML should look like below:

<Group CommandName="cmdSizeDefinitionsGroup"
       SizeDefinition="ButtonGroups">
  <!-- Row 1 -->
  <ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton1" />
      <Button CommandName="cmdSDButton2" />
      <Button CommandName="cmdSDButton3" />
      <Button CommandName="cmdSDButton4" />
      <Button CommandName="cmdSDButton5" />
      <Button CommandName="cmdSDButton6" />
      <Button CommandName="cmdSDButton7" />
      <Button CommandName="cmdSDButton8" />
      <Button CommandName="cmdSDButton9" />
      <Button CommandName="cmdSDButton10" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton11" />
      <Button CommandName="cmdSDButton12" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton13" />
      <Button CommandName="cmdSDButton14" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton15" />
      <Button CommandName="cmdSDButton16" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton17" />
      <Button CommandName="cmdSDButton18" />
    </ControlGroup>
  </ControlGroup>
  <!-- Row 2 -->
  <ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton19" />
      <Button CommandName="cmdSDButton20" />
      <Button CommandName="cmdSDButton21" />
      <Button CommandName="cmdSDButton22" />
      <Button CommandName="cmdSDButton23" />
      <Button CommandName="cmdSDButton24" />
      <Button CommandName="cmdSDButton25" />
      <Button CommandName="cmdSDButton26" />
      <Button CommandName="cmdSDButton27" />
      <Button CommandName="cmdSDButton28" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton29" />
    </ControlGroup>
    <ControlGroup>
      <Button CommandName="cmdSDButton30" />
      <Button CommandName="cmdSDButton31" />
    </ControlGroup>
  </ControlGroup>
  <Button CommandName="cmdSDButton32" />            
</Group>

 

And when I try to compile I got this errors:

error SC1032 : Group contains too many controls for the chosen SizeDefinition.
error SC1032 : Group contains too many controls for the chosen SizeDefinition.
error SC1012 : Unable to determine mapping of elements for Group to SizeDefinition 'ButtonGroups'.
error SC1009 : Unable to apply Group.SizeDefinition property 'ButtonGroups'.

These errors makes no sense for me since I didn't add anything to group so I still have 32 buttons but in another configuration. Any help is appreciated.

Edited by Andreik
typo

When the words fail... music speaks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...