scott93727
Number of posts : 17 Registration date : 2009-10-15
| Subject: code for a text editor Sun Jun 27, 2010 11:38 am | |
| Can anyone post the code for a text editor written in Panoramic, thanks | |
|
Gregory
Number of posts : 9 Age : 41 Localisation : South Africa Registration date : 2010-05-12
| Subject: Re: code for a text editor Sun Jun 27, 2010 9:35 pm | |
| Here is a quick and very simple example i made that may give you a base to work from, or mabye an idea on how to get started. Keep in mind that this is just a basic idea and just one way to look at how to go about it. There are quite a few more flexible commands in Panoramic that you could use to improve on this in many ways. Anyway :-) HTH - Code:
-
label SetupEditor, LoadFiles, SaveFiles, LoadSettingsMenu label QuitEditor, NewFiles, SetFontStyle, SaveSettings
dim LoadFile$, SaveFile$
width 0, 800 : height 0, 600 caption 0, "Simple Text Editor"
main_menu 1 ' The file menu... sub_menu 2 : caption 2, "&File" : parent 2,1 sub_menu 3 : caption 3, "&New" : parent 3,2 sub_menu 4 : caption 4, "&Open" : parent 4,2 sub_menu 5 : caption 5, "&Save" : parent 5,2 sub_menu 6 : caption 6, "Exit" : parent 6,2 ' The options menu... sub_menu 7 : caption 7, "&Options" : parent 7,1 sub_menu 8 : caption 8, "Settings" : parent 8,7
gosub SetupEditor
open_dialog 10 : filter 10, "Text Files (*.txt)|*.txt" save_dialog 11 : filter 11, "Text Files (*.txt)|*.txt"
' The settings form... form 12 : caption 12, "Settings" width 12, 220 : height 12, 210 button 13 : parent 13,12 list 14 : parent 14,12 alpha 15 : parent 15,12 caption 13, "Save" width 13, 75 : height 13, 23 top 13, 145 : left 13, 60 top 14, 10 : left 14, 70 width 14, 100 : height 14, 100 font_names_add 14 top 15, 10 : left 15, 10 : caption 15, "Select font" hide 12
' The menu functions... on_click 3, NewFiles on_click 4, LoadFiles on_click 5, SaveFiles on_click 6, QuitEditor on_click 8, LoadSettingsMenu on_click 13, SaveSettings on_click 14, SetFontStyle end
' Subs & Functons... SetupEditor: memo 9 left 9, 5 : top 9, 5 width 9, 780 : height 9, 535 full_space 9 : font_size 9, 10 bar_both 9 return LoadFiles: LoadFile$ = file_name$(10) if LoadFile$ <> "_" then file_add 9, LoadFile$ return SaveFiles: SaveFile$ = file_name$(11) if SaveFile$ <> "_" then file_save 9, SaveFile$ return NewFiles: ' Could possibly add a messagebox here to save first... clear 9 return LoadSettingsMenu: show 12 return SaveSettings: hide 12 return SetFontStyle: font_name 9, item_index$(14) return QuitEditor: terminate
| |
|