Updated BPDemo with a working BFilePanel and a working BAlert

This commit is contained in:
ocoursiere
2004-01-11 18:00:04 +00:00
parent 66acd35741
commit c497837837
2 changed files with 50 additions and 7 deletions

View File

@@ -21,16 +21,46 @@ program Main;
{$M+} {$M+}
uses uses
Application, Message, Roster, Rect, Window, Application, Message, Roster, Rect, Window,
Main_Window; Main_Window, SysUtils;
type type
TMonApplication = class(BApplication) TMonApplication = class(BApplication)
public public
procedure ReadyToRun; override;
function QuitRequested : Boolean; override; function QuitRequested : Boolean; override;
procedure RefsReceived(amessage : BMessage); override;
procedure ArgvReceived(argc : integer; argv : PPChar); override;
procedure AboutRequested; override;
procedure Pulse; override;
procedure ReadyToRun; override;
end; end;
procedure TMonApplication.RefsReceived(amessage : BMessage);
begin
WriteLn('RefsReceived');
WriteLn('message.what : ' + IntToStr(amessage.what));
amessage.PrintToStream;
end;
procedure TMonApplication.ArgvReceived(argc : integer; argv : PPChar);
var
i : integer;
begin
WriteLn('Nb argument : ' + IntToStr(argc));
for i := 0 to argc - 1 do
WriteLn(argv[i]);
end;
procedure TMonApplication.AboutRequested;
begin
WriteLn('AboutRequested');
end;
procedure TMonApplication.Pulse;
begin
WriteLn('Pulse');
end;
function TMonApplication.QuitRequested : Boolean; function TMonApplication.QuitRequested : Boolean;
begin begin

View File

@@ -21,10 +21,10 @@ unit Main_Window;
interface interface
{$M+} {$M+}
uses uses
SysUtils, SysUtils, Application, AppDefs,
Alert, InterfaceDefs, ListItem, Menu, Menubar, Message, Rect, StringView, Alert, InterfaceDefs, ListItem, Menu, Menubar, Message, Rect, StringView,
TabView, View, Window, TabView, View, Window,
Common, Button_View, Edit_View, Other_View; Common, Button_View, Edit_View, Other_View, FilePanel,entry, messenger;
type type
TMyWindow = class(BWindow) TMyWindow = class(BWindow)
@@ -150,6 +150,9 @@ var
S : String; S : String;
p : PChar; p : PChar;
Alert : BAlert; Alert : BAlert;
FilePanel : BFilePanel;
aref : entry_ref;
aspecialmessage : BMessage;
begin begin
inherited; inherited;
case aMessage.what of case aMessage.what of
@@ -222,9 +225,19 @@ begin
VEdit.Edit.SetEnabled(false); VEdit.Edit.SetEnabled(false);
end; end;
MSG_MENU_BASE + 1 :
begin
aspecialmessage := BMessage.Create(17);
aspecialmessage.AddString('titititititi', 'titititititi');
FilePanel := BFilePanel.Create(B_OPEN_PANEL, be_app_BMessenger, aref, 0, true,
{aspecialmessage}nil,
nil, false, true);
FilePanel.Show;
end;
MSG_MENU_BASE + 2 : MSG_MENU_BASE + 2 :
begin begin
Quit; be_app.PostMessage(B_QUIT_REQUESTED);
end; end;
end; // case end; // case