FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to convert VB "set" function to Fivewin
Posts: 21
Joined: Mon Nov 14, 2005 02:20 AM
How to convert VB "set" function to Fivewin
Posted: Tue Apr 10, 2007 09:00 AM

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 !!!

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
How to convert VB "set" function to Fivewin
Posted: Tue Apr 10, 2007 09:47 AM

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
Posts: 21
Joined: Mon Nov 14, 2005 02:20 AM
How to convert VB "set" function to Fivewin
Posted: Wed Apr 11, 2007 01:49 AM

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

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
How to convert VB "set" function to Fivewin
Posted: Wed Apr 11, 2007 12:55 PM

Dixon,

> With ControlFile.CommandBar.Controls

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

Its easy :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 218
Joined: Fri Oct 07, 2005 01:55 AM
How to convert VB "set" function to Fivewin
Posted: Wed Apr 11, 2007 04:38 PM
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?
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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
How to convert VB "set" function to Fivewin
Posted: Wed Apr 11, 2007 05:04 PM
Richard,
function CommandBars_Execute( hControl )

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

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 218
Joined: Fri Oct 07, 2005 01:55 AM
How to convert VB "set" function to Fivewin
Posted: Wed Apr 11, 2007 10:17 PM
Antonio Linares wrote:Richard,
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?
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
Posts: 21
Joined: Mon Nov 14, 2005 02:20 AM
How to convert VB "set" function to Fivewin
Posted: Thu Apr 12, 2007 05:01 AM

Antonio

It's OK now , Thanks

Best Regards

Dixon Chu

Posts: 21
Joined: Mon Nov 14, 2005 02:20 AM
How to convert VB "set" function to Fivewin
Posted: Fri Apr 13, 2007 08:44 AM

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

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
How to convert VB "set" function to Fivewin
Posted: Fri Apr 13, 2007 10:38 AM

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

Continue the discussion