How to convert VB "set" function to Fivewin

Post Reply
dixonchu
Posts: 21
Joined: Mon Nov 14, 2005 2:20 am

How to convert VB "set" function to Fivewin

Post by dixonchu »

How to convert VB "set" function to Fivewin

VB sample code


'Declare a Ribbon Bar object
Dim RibbonBar As RibbonBar

'Add a Ribbon Bar to the command bars
Set RibbonBar = CommandBars.AddRibbonBar("Ribbon Bar")

'Specify the Ribbon Bar is to use the stretched docking style. The Ribbon Bar
'can only be docked to the top or bottom of an application
RibbonBar.EnableDocking xtpFlagStretched

Dim ControlFile As CommandBarPopup

'Add a normal popup to the Ribbon Bar.

Set ControlFile = RibbonBar.Controls.Add(xtpControlPopup, -1, "&File", 1)

'Add commands to the popup
With ControlFile.CommandBar.Controls
.Add xtpControlButton, ID_FILE_NEW, "&New"
.Add xtpControlButton, ID_FILE_OPEN, "&Open..."
Set Control = .Add(xtpControlButton, ID_APP_EXIT, "E&xit")
Control.BeginGroup = True
End With

.......

could anyone help me convert the following code to fivewin

1. Set RibbonBar = CommandBars.AddRibbonBar("Ribbon Bar")
2. Set ControlFile = RibbonBar.Controls.Add(xtpControlPopup, -1, "&File", 1)


Thanks !!!
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dixon,

Assuming that CommandBars is an ActiveX object:

>1. Set RibbonBar = CommandBars.AddRibbonBar("Ribbon Bar")

local hRibbonBar := CommandBars:Do( "AddRibbonBar", "RibbonBar" )

> 2. Set ControlFile = RibbonBar.Controls.Add(xtpControlPopup, -1, "&File", 1)

local hControls := OleGetProperty( hRibbonBar, "Controls" )
local hControlFile := OleInvoke( hControls, "Add", xtpControlPopup, -1, "&File", 1)
regards, saludos

Antonio Linares
www.fivetechsoft.com
dixonchu
Posts: 21
Joined: Mon Nov 14, 2005 2:20 am

Post by dixonchu »

Dear Antonio

It's very kindly of you to help me out

1. Set RibbonBar = CommandBars.AddRibbonBar("Ribbon Bar")
2. Set ControlFile = RibbonBar.Controls.Add(xtpControlPopup, -1, "&File", 1)

It's ok now

But I still have problem for the following commands
Could you help me this AGAIN !

'Add commands to the popup
With ControlFile.CommandBar.Controls
.Add xtpControlButton, ID_FILE_NEW, "&New"
.Add xtpControlButton, ID_FILE_OPEN, "&Open..."
Set Control = .Add(xtpControlButton, ID_APP_EXIT, "E&xit")
Control.BeginGroup = True
End With

Thank you very much !

Best regards !

Dixon Chu
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dixon,

> With ControlFile.CommandBar.Controls

local hCommandBar := OleGetProperty( hControlFile, "CommandBar" )
local hControls := OleGetProperty( hCommandBar, "Controls" )

Its easy :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Taiwan
Posts: 218
Joined: Fri Oct 07, 2005 1:55 am
Location: Taipei, Taiwan
Contact:

Post by Taiwan »

Antonio Linares wrote:Dixon,

> With ControlFile.CommandBar.Controls

local hCommandBar := OleGetProperty( hControlFile, "CommandBar" )
local hControls := OleGetProperty( hCommandBar, "Controls" )

Its easy :-)
Hello Antonio,

Could you try to convert these code to FWH?

Code: Select all

Private Sub CommandBars_Execute(ByVal Control As XtremeCommandBars.ICommandBarControl)
    Select Case Control.Id
        Case ID_APP_ABOUT:     MsgBox "Version " & App.Major & "." & App.Minor & "." & App.Revision
        Case ID_FILE_NEW:       MsgBox Control.Caption & " Clicked"
        Case ID_FILE_OPEN:      MsgBox Control.Caption & " Clicked"
        Case ID_FILE_CLOSE:     MsgBox Control.Caption & " Clicked"
        Case ID_FILE_SAVE:      MsgBox Control.Caption & " Clicked"
        
        Case ID_APP_EXIT:      Unload Me
        
        Case ID_VIEW_STATUS_BAR:
            CommandBars.StatusBar.Visible = Not CommandBars.StatusBar.Visible
            CommandBars.RecalcLayout
       
        Case ID_EDIT_CUT:
            Clipboard.SetText txtClient.SelText
            txtClient.SelText = vbNullString
        Case ID_EDIT_COPY:      Clipboard.SetText txtClient.SelText
        Case ID_EDIT_PASTE:     txtClient.SelText = Clipboard.GetText
        Case Else:
            MsgBox Control.Caption & " clicked", vbOKOnly, "Button Clicked"
    End Select
End Sub
Thank you.

Regards,

Richard
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Richard,

Code: Select all

function CommandBars_Execute( hControl )

   do case
        case OleGetProperty( hControl, "Id" ) == ID_APP_ABOUT
            ...
   endcase

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Taiwan
Posts: 218
Joined: Fri Oct 07, 2005 1:55 am
Location: Taipei, Taiwan
Contact:

Post by Taiwan »

Antonio Linares wrote:Richard,

Code: Select all

function CommandBars_Execute( hControl )

   do case
        case OleGetProperty( hControl, "Id" ) == ID_APP_ABOUT
            ...
   endcase

return nil
Hello Antonio,

How to put this function when we clicked?

Code: Select all

local hControls := OleGetProperty( hRibbonBar, "Controls" ) 
local hControlFile := OleInvoke( hControls, "Add", xtpControlPopup, -1, "&File", 1)
But I don't understand, how to Execute when I clicked someone menuitem or ToolBar's button?

Regards,

Richard
dixonchu
Posts: 21
Joined: Mon Nov 14, 2005 2:20 am

Post by dixonchu »

Antonio

It's OK now , Thanks

Best Regards

Dixon Chu
dixonchu
Posts: 21
Joined: Mon Nov 14, 2005 2:20 am

Post by dixonchu »

Dear Antonio

Could you help me again !

How to conver VB "AddHandle" to FWH

StatusBar = CommandBars.StatusBar
AddHandler StatusBar.PaneClick, AddressOf StatusBar_PaneClickEvent

Thanks again !

Dixon Chu
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dixon,

AddHandler looks like an event response.

Please review samples\webexp.prg to see how to manage ActiveX events
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply