How to convert VB "set" function to Fivewin

How to convert VB "set" function to Fivewin

Postby dixonchu » Tue Apr 10, 2007 9: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 !!!
dixonchu
 
Posts: 21
Joined: Mon Nov 14, 2005 2:20 am

Postby Antonio Linares » Tue Apr 10, 2007 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby dixonchu » Wed Apr 11, 2007 1: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
dixonchu
 
Posts: 21
Joined: Mon Nov 14, 2005 2:20 am

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Taiwan » Wed Apr 11, 2007 4: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?
Code: Select all  Expand view
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
Taiwan
 
Posts: 218
Joined: Fri Oct 07, 2005 1:55 am
Location: Taipei, Taiwan

Postby Antonio Linares » Wed Apr 11, 2007 5:04 pm

Richard,
Code: Select all  Expand view
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
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Taiwan » Wed Apr 11, 2007 10:17 pm

Antonio Linares wrote:Richard,
Code: Select all  Expand view
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  Expand view
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
User avatar
Taiwan
 
Posts: 218
Joined: Fri Oct 07, 2005 1:55 am
Location: Taipei, Taiwan

Postby dixonchu » Thu Apr 12, 2007 5:01 am

Antonio

It's OK now , Thanks

Best Regards

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

Postby dixonchu » Fri Apr 13, 2007 8: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
dixonchu
 
Posts: 21
Joined: Mon Nov 14, 2005 2:20 am

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 76 guests

cron