![]() |
|
|
Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
Опции темы | Поиск в этой теме | Опции просмотра |
#1
|
|||
|
|||
![]() Добрый день!
Помогите пожалуйста написать программу: Разработка программы отображения структуры меню на визуальное дерево. Разработать программу отображения в виде дерева TTreeView структуры меню. Дерево должно собираться по принципу «Name = Parent» (т.е. имя пункта меню = имя родительского пункта), а фактически отображаться должны названия пунктов меню. Буду благодарна. |
#2
|
|||
|
|||
![]() подскажите пожалуйста, какой ЛИСТИНГ будет у этой программы?
|
#3
|
||||
|
||||
![]() ЛистинГ:
Код:
unit Unit1; interface uses Menus, ComCtrls, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, ActnList; type TForm1 = class(TForm) ActionList: TActionList; ActionPaste: TAction; ActionDel: TAction; ActionStart: TAction; ActionStop: TAction; ActionMeter: TAction; ActionSetting: TAction; Actionabout: TAction; ActionClose: TAction; ActionSelectAll: TAction; TreeView1: TTreeView; MainMenu1: TMainMenu; MenuItem1: TMenuItem; MenuItem2: TMenuItem; MenuItem3: TMenuItem; MenuItem4: TMenuItem; MenuItem5: TMenuItem; MenuItem6: TMenuItem; MenuItem7: TMenuItem; MenuItem8: TMenuItem; MenuItem9: TMenuItem; MenuItem10: TMenuItem; MenuItem11: TMenuItem; MenuItem12: TMenuItem; MenuItem13: TMenuItem; MenuItem14: TMenuItem; MenuItem32: TMenuItem; MenuItem33: TMenuItem; MenuItem34: TMenuItem; procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure mapping(AMainMenu: TMainMenu; ATreeView: TTreeView; ATreeNode: TTreeNode; AMenuItem: TMenuItem); var i: Integer; begin if AMenuItem=nil then for i:=0 to AMainMenu.Items.Count-1 do mapping(AMainMenu, ATreeView, ATreeNode, AMainMenu.Items[i]) else begin if ATreeNode=nil then ATreeNode:=ATreeView.Items.Add(nil, AMenuItem.Caption) else ATreeNode:=ATreeView.Items.AddChild(ATreeNode, AMenuItem.Caption); for i:=0 to AMenuItem.Count-1 do mapping(AMainMenu, ATreeView, ATreeNode, AMenuItem.Items[i]); end; end; procedure TForm1.FormCreate(Sender: TObject); begin mapping(MainMenu1, TreeView1, nil, nil); end; end. http://data.cod.ru/82295 Пишу программы за еду. __________________ |
#4
|
|||
|
|||
![]() спасибо большое!)
|
#5
|
|||
|
|||
![]() у меня еще один (не большой) вопрос :
в этой программе надо будет еще добавить "возможность сохранения файла в текстовом файле" спасибо...! |
#6
|
|||
|
|||
![]() всё уже..., спс...
мне написали прогу) если что: Код:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls; type TForm1 = class(TForm) TreeView1: TTreeView; Edit1: TEdit; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button5Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin TreeView1.Items.AddChild(TreeView1.Selected, Edit1.Text); end; procedure TForm1.Button2Click(Sender: TObject); begin TreeView1.SaveToFile('Tree.txt'); end; procedure TForm1.Button3Click(Sender: TObject); begin if FileExists('Tree.txt') Then TreeView1.LoadFromFile('Tree.txt') Else ShowMessage(‘netu fayla!'); end; procedure TForm1.Button4Click(Sender: TObject); begin TreeView1.FullExpand; end; procedure TForm1.Button5Click(Sender: TObject); begin TreeView1.FullCollapse; end; end. Последний раз редактировалось Admin, 20.01.2011 в 10:59. |
#7
|
|||
|
|||
![]() подскажите...
вот тут, к этой программе надо еще добавить алгоритм , чтобы программа показывало дерево в текстовом файле... |