Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3956

Learning to create menu items in desktop app

$
0
0

Hi,

I’m trying to learn adding menu items to my application but the Xojo documentation doesn’t explicitly teach you how to build them.

I have the default menus that Xojo starts with, and I added a Page Setup menu item to my File menu where I want to make setting changes.

When I run the app, Quit has automatically relocated underneath the menu for the name of the application (I did read in the design tips how/why this is done for Windows compatibility).

My Page Setup option appears by itself on the File menu, grayed out, and is set to Auto Enabled.

How do I attach code to my Page Setup menu item?

I have a button on a screen in my app that performs this function as follows:

//Var s As String
Var pageSetup As PrinterSetup
pageSetup = New PrinterSetup
If pageSetup.ShowPageSetupDialog Then
  App.s = pageSetup.Settings
End If

// save printer settings to file

Var f As FolderItem
Var bs As BinaryStream

// get a folderitem
f = New FolderItem("Whole File", FolderItem.PathModes.Native)

// create a binary file with the type of text (defined in the file types dialog)
bs = BinaryStream.Create(f, True)

// check to see if it was created
If bs <> Nil Then
  //write the contents of the editField
  bs.Write(App.s.ConvertEncoding(Encodings.UTF8))
  
  // close the binaryStream
  bs.Close
End If

But for proper design, I want to move this to a Page Setup menu option. If someone can point me in the right direction, thank you!!!

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 3956

Trending Articles