diff --git a/bepascal/demos/demo/compile b/bepascal/demos/demo/compile index 7888a0e..9304f23 100644 --- a/bepascal/demos/demo/compile +++ b/bepascal/demos/demo/compile @@ -5,4 +5,4 @@ fi ppc386 -FE./ -FU./units ./sources/main.pp -oBPDemo mergeres ./sources/Resource.rsrc BPDemo -mimeset BPCalculator +mimeset BPDemo diff --git a/bepascal/demos/demo/sources/button_view.pp b/bepascal/demos/demo/sources/button_view.pp index 7e9145f..8a37fb3 100644 --- a/bepascal/demos/demo/sources/button_view.pp +++ b/bepascal/demos/demo/sources/button_view.pp @@ -1,141 +1,134 @@ -{ BePascal - A pascal wrapper around the BeOS API - Copyright (C) 2002 Olivier Coursiere - Eric Jourde - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -} +{ BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2002-2003 Olivier Coursiere + Eric Jourde -unit button_view; + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} +unit Button_View; {$M+} interface + uses - classes,beobj, application, message, _beep, roster, SysUtils,interfacedefs, - archivable, handler, rect, window, view, graphicdefs, dataio,box, - invoker, messenger, Control, Button,listview,listitem,outlinelistview,common; - + Box, Button, GraphicDefs, InterfaceDefs, ListView, ListItem, Message, + OutlineListView, Rect, View, + Common; type - TButton_View = class(BView) - public - constructor Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal); - Button1: BButton; - Button2: BButton; - Button3: BButton; - - ListView1 : BListView; - ItemString : BStringItem; - outlineListView : BOutlineListView; - Box1 : BBox; - Box2 : BBox; + TButton_View = class(BView) + public + constructor Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal); + Button1: BButton; + Button2: BButton; + Button3: BButton; + ListView1 : BListView; + ItemString : BStringItem; + outlineListView : BOutlineListView; + Box1 : BBox; + Box2 : BBox; end; implementation constructor TButton_View.Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal); -Var - aRect2 : BRect; - mess : BMessage; - rgb : RGB_color; - +var + aRect2 : BRect; + mess : BMessage; + rgb : RGB_color; begin - inherited; - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - // Button 1 - aRect2 := BRect.Create(20, 20, 100, 30); - mess := BMessage.Create(MSG_BUTTON_BASE+1); - Button1 := BButton.Create(aRect2, 'Button 1', 'Button 1', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - Button1.SetViewColor(rgb); - AddChild(Button1, nil); - aRect2.Free; + inherited; + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + // Button 1 + aRect2 := BRect.Create(20, 20, 100, 30); + mess := BMessage.Create(MSG_BUTTON_BASE+1); + Button1 := BButton.Create(aRect2, 'Button 1', 'Button 1', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + Button1.SetViewColor(rgb); + AddChild(Button1, nil); + aRect2.Free; - // Button 2 - aRect2 := BRect.Create(20, 20+30, 100, 30+30); - mess := BMessage.Create(MSG_BUTTON_BASE+2); - Button2 := BButton.Create(aRect2, 'Add Item', 'Add Item', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - Button2.SetViewColor(rgb); - AddChild(Button2, nil); - aRect2.Free; + // Button 2 + aRect2 := BRect.Create(20, 20+30, 100, 30+30); + mess := BMessage.Create(MSG_BUTTON_BASE+2); + Button2 := BButton.Create(aRect2, 'Add Item', 'Add Item', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + Button2.SetViewColor(rgb); + AddChild(Button2, nil); + aRect2.Free; - // Button 3 - aRect2 := BRect.Create(20, 20+60, 100, 30+60); - mess := BMessage.Create(MSG_BUTTON_BASE+3); - Button3 := BButton.Create(aRect2, 'Add Outline', 'Add Outline', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - Button3.SetViewColor(rgb); - AddChild(Button3, nil); - aRect2.Free; - - // Box for ListView - aRect2 := BRect.Create(120, 30, 250, 300); - Box1 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, - B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); - Box1.SetLabel('BListView'); - Box1.SetBorder(B_FANCY_BORDER); - AddChild(Box1, nil); - aRect2.Free; - - // ListView1 - aRect2 := BRect.Create(10, 15, 120, 250); - ListView1 := BListView.create(aRect2,'toto', - B_SINGLE_SELECTION_LIST, - B_FOLLOW_LEFT or B_FOLLOW_TOP, - B_WILL_DRAW or B_NAVIGABLE or B_FRAME_EVENTS); - Box1.AddChild(ListView1, nil); - aRect2.Free; - - -{ ItemString := BStringItem.create('test 1',0,true); - ListView1.AddItem(ItemString); - ItemString := BStringItem.create('test 2',1,true); - ListView1.AddItem(ItemString); + // Button 3 + aRect2 := BRect.Create(20, 20+60, 100, 30+60); + mess := BMessage.Create(MSG_BUTTON_BASE+3); + Button3 := BButton.Create(aRect2, 'Add Outline', 'Add Outline', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + Button3.SetViewColor(rgb); + AddChild(Button3, nil); + aRect2.Free; + + // Box for ListView + aRect2 := BRect.Create(120, 30, 250, 300); + Box1 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, + B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); + Box1.SetLabel('BListView'); + Box1.SetBorder(B_FANCY_BORDER); + AddChild(Box1, nil); + aRect2.Free; + + // ListView1 + aRect2 := BRect.Create(10, 15, 120, 250); + ListView1 := BListView.create(aRect2,'toto', B_SINGLE_SELECTION_LIST, + B_FOLLOW_LEFT or B_FOLLOW_TOP, + B_WILL_DRAW or B_NAVIGABLE or B_FRAME_EVENTS); + Box1.AddChild(ListView1, nil); + aRect2.Free; + +{ + ItemString := BStringItem.create('test 1',0,true); + ListView1.AddItem(ItemString); + ItemString := BStringItem.create('test 2',1,true); + ListView1.AddItem(ItemString); } - // Box for OutLineListItem - aRect2 := BRect.Create(260, 30, 400, 300); - Box2 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, - B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); - Box2.SetLabel('BOutlineListView '); - Box2.SetBorder(B_FANCY_BORDER); - AddChild(Box2, nil); - aRect2.Free; + // Box for OutLineListItem + aRect2 := BRect.Create(260, 30, 400, 300); + Box2 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, + B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); + Box2.SetLabel('BOutlineListView '); + Box2.SetBorder(B_FANCY_BORDER); + AddChild(Box2, nil); + aRect2.Free; - // Outlinelistitem - aRect2 := BRect.Create(10, 15, 120, 250); - outlineListView := BOutlineListView.create(aRect2,'toto', - B_SINGLE_SELECTION_LIST, - B_FOLLOW_LEFT or B_FOLLOW_TOP, - B_WILL_DRAW or B_NAVIGABLE or B_FRAME_EVENTS); - Box2.AddChild(outlineListView, nil); - aRect2.Free; - - - ItemString := BStringItem.create('test 1',0,true); - outlineListView.AddItem(ItemString); - ItemString := BStringItem.create('test 1.1',1,true); - outlineListView.AddItem(ItemString); - ItemString := BStringItem.create('test 1.2',1,true); - outlineListView.AddItem(ItemString); - ItemString := BStringItem.create('test 2',0,true); - outlineListView.AddItem(ItemString); - ItemString := BStringItem.create('test 2.1',1,true); - outlineListView.AddItem(ItemString); - ItemString := BStringItem.create('test 3',0,true); - outlineListView.AddItem(ItemString); + // Outlinelistitem + aRect2 := BRect.Create(10, 15, 120, 250); + outlineListView := BOutlineListView.create(aRect2,'toto', + B_SINGLE_SELECTION_LIST, + B_FOLLOW_LEFT or B_FOLLOW_TOP, + B_WILL_DRAW or B_NAVIGABLE or B_FRAME_EVENTS); + Box2.AddChild(outlineListView, nil); + aRect2.Free; - + ItemString := BStringItem.create('test 1',0,true); + outlineListView.AddItem(ItemString); + ItemString := BStringItem.create('test 1.1',1,true); + outlineListView.AddItem(ItemString); + ItemString := BStringItem.create('test 1.2',1,true); + outlineListView.AddItem(ItemString); + ItemString := BStringItem.create('test 2',0,true); + outlineListView.AddItem(ItemString); + ItemString := BStringItem.create('test 2.1',1,true); + outlineListView.AddItem(ItemString); + ItemString := BStringItem.create('test 3',0,true); + outlineListView.AddItem(ItemString); end; -end. +end. \ No newline at end of file diff --git a/bepascal/demos/demo/sources/common.pp b/bepascal/demos/demo/sources/common.pp index 4440e0a..39cb8ce 100644 --- a/bepascal/demos/demo/sources/common.pp +++ b/bepascal/demos/demo/sources/common.pp @@ -1,13 +1,16 @@ -unit common; +unit Common; + interface + const - MSG_TEST_APP_BASE = 79000; - MSG_BUTTON_BASE = MSG_TEST_APP_BASE + 100; - MSG_CHECKBOX_BASE = MSG_TEST_APP_BASE + 200; - MSG_RADIOBUTTON_BASE = MSG_TEST_APP_BASE + 300; - MSG_STRINGVIEW_BASE = MSG_TEST_APP_BASE + 400; - MSG_MENU_BASE = MSG_TEST_APP_BASE + 500; - MSG_STATUSBAR_BASE = MSG_TEST_APP_BASE + 600; + MSG_TEST_APP_BASE = 79000; + MSG_BUTTON_BASE = MSG_TEST_APP_BASE + 100; + MSG_CHECKBOX_BASE = MSG_TEST_APP_BASE + 200; + MSG_RADIOBUTTON_BASE = MSG_TEST_APP_BASE + 300; + MSG_STRINGVIEW_BASE = MSG_TEST_APP_BASE + 400; + MSG_MENU_BASE = MSG_TEST_APP_BASE + 500; + MSG_STATUSBAR_BASE = MSG_TEST_APP_BASE + 600; implementation -end. + +end. \ No newline at end of file diff --git a/bepascal/demos/demo/sources/edit_view.pp b/bepascal/demos/demo/sources/edit_view.pp index 91d8777..8aa0b36 100644 --- a/bepascal/demos/demo/sources/edit_view.pp +++ b/bepascal/demos/demo/sources/edit_view.pp @@ -1,23 +1,22 @@ -{ BePascal - A pascal wrapper around the BeOS API - Copyright (C) 2002 Olivier Coursiere - Eric Jourde - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -} +{ BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2002-2003 Olivier Coursiere + Eric Jourde -unit edit_view; + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} +unit Edit_View; {$M+} interface @@ -25,131 +24,130 @@ uses classes,beobj, application, message, _beep, roster, SysUtils,interfacedefs, archivable, handler, rect, window, view, graphicdefs, dataio,box, scrollview, invoker, messenger, Control,textview,font,textcontrol,radiobutton,common; - -type - TEdit_View = class(BView) - public - constructor Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal); - aTextView : BTextView; - Edit : BTextControl; - - afont : Bfont; - Box1 : BBox; - Box2 : BBox; - Box3 : BBox; - Box4 : BBox; - RadioButton1, - RadioButton2 : BRadioButton; - RadioButton3, - RadioButton4 : BRadioButton; - scroll_vert :BscrollView; +type + TEdit_View = class(BView) + public + constructor Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal); + + aTextView : BTextView; + Edit : BTextControl; + + afont : Bfont; + Box1 : BBox; + Box2 : BBox; + Box3 : BBox; + Box4 : BBox; + RadioButton1, + RadioButton2 : BRadioButton; + RadioButton3, + RadioButton4 : BRadioButton; + scroll_vert : BscrollView; end; implementation constructor TEdit_View.Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal); -Var +var aRect2,aRect3 : BRect; mess : BMessage; rgb : RGB_color; begin - inherited; - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + inherited; + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - // Box for textview - aRect2 := BRect.Create(20, 20, 200, 300); - Box2 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, - B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); - Box2.SetLabel('BTextView '); - Box2.SetBorder(B_FANCY_BORDER); - AddChild(Box2, nil); - aRect2.Free; + // Box for textview + aRect2 := BRect.Create(20, 20, 200, 300); + Box2 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, + B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); + Box2.SetLabel('BTextView '); + Box2.SetBorder(B_FANCY_BORDER); + AddChild(Box2, nil); + aRect2.Free; - // textView - aRect2 := BRect.Create(10, 15, 160, 260); - aRect3 := BRect.Create(0, 0, 140, 500-160); - aTextView := BTextView.Create(aRect2, 'Test2',aRect3, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + // textView + aRect2 := BRect.Create(10, 15, 160, 260); + aRect3 := BRect.Create(0, 0, 140, 500-160); + aTextView := BTextView.Create(aRect2, 'Test2',aRect3, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - scroll_vert:=BscrollView.create('scroll1',aTextView,B_FOLLOW_ALL, B_WILL_DRAW or B_PULSE_NEEDED or B_FRAME_EVENTS,true,true,B_PLAIN_BORDER); - Box2.addchild(scroll_vert,nil); + scroll_vert:=BscrollView.create('scroll1',aTextView,B_FOLLOW_ALL, B_WILL_DRAW or B_PULSE_NEEDED or B_FRAME_EVENTS,true,true,B_PLAIN_BORDER); + Box2.addchild(scroll_vert,nil); - aTextView.setStylable(true); - aRect2.Free; - aRect3.Free; + aTextView.setStylable(true); + aRect2.Free; + aRect3.Free; - // Box for TextControl - aRect2 := BRect.Create(220, 20, 400, 300); - Box1 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, - B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); - Box1.SetLabel('BTextControl '); - Box1.SetBorder(B_FANCY_BORDER); - AddChild(Box1, nil); - aRect2.Free; + // Box for TextControl + aRect2 := BRect.Create(220, 20, 400, 300); + Box1 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, + B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); + Box1.SetLabel('BTextControl '); + Box1.SetBorder(B_FANCY_BORDER); + AddChild(Box1, nil); + aRect2.Free; - mess := BMessage.Create(77780); - aRect2 := BRect.Create(10, 15, 150, 20); - Edit:=BTextControl.Create(aRect2,' Zone_calcul',' ','',mess,B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - Edit.setdivider(0); - Edit.setalignment(B_ALIGN_LEFT,B_ALIGN_LEFT); - //Edit.SetEnabled(false); - Box1.AddChild(Edit,nil); - aRect2.Free; + mess := BMessage.Create(77780); + aRect2 := BRect.Create(10, 15, 150, 20); + Edit:=BTextControl.Create(aRect2,' Zone_calcul',' ','',mess,B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + Edit.setdivider(0); + Edit.setalignment(B_ALIGN_LEFT,B_ALIGN_LEFT); + //Edit.SetEnabled(false); + Box1.AddChild(Edit,nil); + aRect2.Free; - // Box for Textalignement - aRect2 := BRect.Create(10, 40, 150, 100); - Box3 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, - B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); - Box3.SetLabel('setalignment '); - Box3.SetBorder(B_FANCY_BORDER); - Box1.AddChild(Box3, nil); - aRect2.Free; + // Box for Textalignement + aRect2 := BRect.Create(10, 40, 150, 100); + Box3 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, + B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); + Box3.SetLabel('setalignment '); + Box3.SetBorder(B_FANCY_BORDER); + Box1.AddChild(Box3, nil); + aRect2.Free; - // RadioButton1 - mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 1); - aRect2 := BRect.Create(10, 14, 120, 24); - RadioButton1 := BRadioButton.Create(aRect2, 'RB1', 'B_ALIGN_LEFT', mess, - B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - Box3.AddChild(RadioButton1, nil); - RadioButton1.SetValue(1); - aRect2.Free; + // RadioButton1 + mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 1); + aRect2 := BRect.Create(10, 14, 120, 24); + RadioButton1 := BRadioButton.Create(aRect2, 'RB1', 'B_ALIGN_LEFT', mess, + B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + Box3.AddChild(RadioButton1, nil); + RadioButton1.SetValue(1); + aRect2.Free; - // RadioButton2 - mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 2); - aRect2 := BRect.Create(10, 34, 120, 54); - RadioButton2 := BRadioButton.Create(aRect2, 'RB2', 'B_ALIGN_RIGHT', mess, - B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - Box3.AddChild(RadioButton2, nil); - aRect2.Free; + // RadioButton2 + mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 2); + aRect2 := BRect.Create(10, 34, 120, 54); + RadioButton2 := BRadioButton.Create(aRect2, 'RB2', 'B_ALIGN_RIGHT', mess, + B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + Box3.AddChild(RadioButton2, nil); + aRect2.Free; - // Box for SetEnabled - aRect2 := BRect.Create(10, 120, 150, 180); - Box4 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, - B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); - Box4.SetLabel('SetEnabled '); - Box4.SetBorder(B_FANCY_BORDER); - Box1.AddChild(Box4, nil); - aRect2.Free; + // Box for SetEnabled + aRect2 := BRect.Create(10, 120, 150, 180); + Box4 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, + B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); + Box4.SetLabel('SetEnabled '); + Box4.SetBorder(B_FANCY_BORDER); + Box1.AddChild(Box4, nil); + aRect2.Free; - // RadioButton3 - mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 3); - aRect2 := BRect.Create(10, 14, 120, 24); - RadioButton3 := BRadioButton.Create(aRect2, 'RB1', 'SetEnabled(true)', mess, - B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - Box4.AddChild(RadioButton3, nil); - RadioButton3.SetValue(1); - aRect2.Free; - - // RadioButton4 - mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 4); - aRect2 := BRect.Create(10, 34, 120, 54); - RadioButton4 := BRadioButton.Create(aRect2, 'RB2', 'SetEnabled(false)', mess, - B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - Box4.AddChild(RadioButton4, nil); - aRect2.Free; + // RadioButton3 + mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 3); + aRect2 := BRect.Create(10, 14, 120, 24); + RadioButton3 := BRadioButton.Create(aRect2, 'RB1', 'SetEnabled(true)', mess, + B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + Box4.AddChild(RadioButton3, nil); + RadioButton3.SetValue(1); + aRect2.Free; + // RadioButton4 + mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 4); + aRect2 := BRect.Create(10, 34, 120, 54); + RadioButton4 := BRadioButton.Create(aRect2, 'RB2', 'SetEnabled(false)', mess, + B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + Box4.AddChild(RadioButton4, nil); + aRect2.Free; end; -end. +end. \ No newline at end of file diff --git a/bepascal/demos/demo/sources/main.pp b/bepascal/demos/demo/sources/main.pp index 808d960..64198cc 100644 --- a/bepascal/demos/demo/sources/main.pp +++ b/bepascal/demos/demo/sources/main.pp @@ -1,6 +1,6 @@ { BePascal - A pascal wrapper around the BeOS API - Copyright (C) 2002 Olivier Coursiere - Eric Jourde + Copyright (C) 2002-2003 Olivier Coursiere + Eric Jourde This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -16,29 +16,23 @@ License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA } - program Main; {$M+} uses - beobj, application, message, _beep, roster, SysUtils, - archivable, handler, rect, window, view, graphicdefs, dataio, - invoker, messenger, Control, Button,stringview,textcontrol,checkbox, - main_window; + Application, Message, Roster, Rect, Window, + Main_Window; type + TMonApplication = class(BApplication) public procedure ReadyToRun; override; - function QuitRequested : boolean; override; + function QuitRequested : Boolean; override; end; - - - - -function TMonApplication.QuitRequested : boolean; +function TMonApplication.QuitRequested : Boolean; begin Result := inherited; be_app.Free; @@ -59,24 +53,20 @@ begin end; - var aRect : BRect; win : TMyWindow; - begin - TMonApplication.Create; - try - aRect := BRect.Create(20, 20, 740, 500); - win := TMyWindow.Create(aRect, 'BP Demo', B_TITLED_WINDOW, B_NOT_RESIZABLE or B_NOT_ZOOMABLE or B_QUIT_ON_WINDOW_CLOSE, B_CURRENT_WORKSPACE); - win.Show; - be_app.Run; - be_app.HideCursor; - be_app.ShowCursor; - finally - aRect.Free; - win.Free; - end; -end. - - + TMonApplication.Create; + try + aRect := BRect.Create(20, 20, 740, 500); + win := TMyWindow.Create(aRect, 'BP Demo', B_TITLED_WINDOW, B_NOT_RESIZABLE or B_NOT_ZOOMABLE or B_QUIT_ON_WINDOW_CLOSE, B_CURRENT_WORKSPACE); + win.Show; + be_app.Run; + be_app.HideCursor; + be_app.ShowCursor; + finally + aRect.Free; + win.Free; + end; +end. \ No newline at end of file diff --git a/bepascal/demos/demo/sources/main_window.pp b/bepascal/demos/demo/sources/main_window.pp index a50c558..1ea7dc7 100644 --- a/bepascal/demos/demo/sources/main_window.pp +++ b/bepascal/demos/demo/sources/main_window.pp @@ -1,6 +1,6 @@ { BePascal - A pascal wrapper around the BeOS API - Copyright (C) 2002 Olivier Coursiere - Eric Jourde + Copyright (C) 2002-2003 Olivier Coursiere + Eric Jourde This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -16,39 +16,35 @@ License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA } - -unit main_window; +unit Main_Window; interface {$M+} uses - beobj, application, message, _beep, roster, SysUtils,appdefs, - archivable, handler, rect, window, view, graphicdefs, dataio, interfacedefs,textView,alert, - invoker, messenger, Control, Button,stringview,textcontrol,checkbox,TabView,listitem, - menu, menubar, - button_view,edit_view,common,other_view; + SysUtils, + Alert, InterfaceDefs, ListItem, Menu, Menubar, Message, Rect, StringView, + TabView, View, Window, + Common, Button_View, Edit_View, Other_View; - -Type -TMyWindow = class(BWindow) +type + TMyWindow = class(BWindow) private - aView : BView; + aView : BView; TabView : BTabView; - Tab1 : BTab; - Tab2 : BTab; - - + Tab1 : BTab; + Tab2 : BTab; public constructor Create(aFrame : BRect; title : PChar; atype, aFlags, aWorkspaces : Cardinal); override; destructor Destroy; override; procedure MessageReceived(amessage : BMessage); override; VButton : TButton_View; - VEdit : TEdit_View; + VEdit : TEdit_View; Explain : BStringView; - VOther : TOther_View; + VOther : TOther_View; end; -Const Message1='Message : '; +const + Message1 = 'Message : '; implementation @@ -65,88 +61,83 @@ var sepItem, sepItem2 : BSeparatorItem; item : BMenuItem; item1 : BMenuItem; - begin - inherited; - try - try - // menu - - aRect2 := BRect.Create(0,0,300,300); - menubar := BMenuBar.Create(aRect2, 'Bonjour', B_FOLLOW_LEFT_RIGHT or B_FOLLOW_TOP, B_ITEMS_IN_COLUMN, True); - AddChild(menubar, nil); - aRect2.Free; - Menu := BMenu.Create('File', B_ITEMS_IN_COLUMN); - item := BMenuItem.Create('Open', BMessage.Create(MSG_MENU_BASE+1), 'o'{#0}, 0); - item1 := BMenuItem.Create('Close', BMessage.Create(MSG_MENU_BASE+2), 'z'{#0}, 0); + inherited; + try + try + // menu + aRect2 := BRect.Create(0, 0, 300, 300); + menubar := BMenuBar.Create(aRect2, 'Bonjour', B_FOLLOW_LEFT_RIGHT + or B_FOLLOW_TOP, B_ITEMS_IN_COLUMN, True); + AddChild(menubar, nil); + aRect2.Free; + Menu := BMenu.Create('File', B_ITEMS_IN_COLUMN); + item := BMenuItem.Create('Open', BMessage.Create(MSG_MENU_BASE + 1), 'o'{#0}, 0); + item1 := BMenuItem.Create('Close', BMessage.Create(MSG_MENU_BASE + 2), 'z'{#0}, 0); - Menu.AddItem(item); - Menu.AddSeparatorItem; - Menu.AddItem(item1); + Menu.AddItem(item); + Menu.AddSeparatorItem; + Menu.AddItem(item1); - MenuBar.AddItem(Menu); - - // Create the main View - aRect := BRect.Create(0, 0, 1000, 600); - aView := BView.Create(aRect, 'Test', B_FOLLOW_ALL, B_WILL_DRAW); - aView.SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - self.AddChild(aView, nil); - aRect.Free; + MenuBar.AddItem(Menu); + + // Create the main View + aRect := BRect.Create(0, 0, 1000, 600); + aView := BView.Create(aRect, 'Test', B_FOLLOW_ALL, B_WILL_DRAW); + aView.SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + self.AddChild(aView, nil); + aRect.Free; - // Show text Message - aRect:= BRect.Create(20, 400, 200, 420); - Explain := BStringView.Create(aRect,'explain','Message : ',B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - aView.AddChild(Explain, nil); - aRect.Free; + // Show text Message + aRect:= BRect.Create(20, 400, 200, 420); + Explain := BStringView.Create(aRect,'explain','Message : ', B_FOLLOW_LEFT + or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + aView.AddChild(Explain, nil); + aRect.Free; - - // TabView - aRect:= BRect.Create(20, 25, 700, 400); - TabView:=BTabview.Create(aRect,'test', - B_WIDTH_AS_USUAL, - B_FOLLOW_TOP, - B_FULL_UPDATE_ON_RESIZE or B_WILL_DRAW or B_NAVIGABLE_JUMP or B_FRAME_EVENTS or B_NAVIGABLE); - aView.AddChild(TabView, nil); - aRect.Free; + // TabView + aRect := BRect.Create(20, 25, 700, 400); + TabView := BTabview.Create(aRect,'test', B_WIDTH_AS_USUAL, B_FOLLOW_TOP, + B_FULL_UPDATE_ON_RESIZE or B_WILL_DRAW or + B_NAVIGABLE_JUMP or B_FRAME_EVENTS or B_NAVIGABLE); + aView.AddChild(TabView, nil); + aRect.Free; - // Button - aRect:= BRect.Create(0, 0, 700, 500); - VButton := TButton_View.Create(aRect, 'Test 1', B_FOLLOW_ALL, B_NAVIGABLE); - aRect.Free; + // Button + aRect := BRect.Create(0, 0, 700, 500); + VButton := TButton_View.Create(aRect, 'Test 1', B_FOLLOW_ALL, B_NAVIGABLE); + aRect.Free; - Tab1:=BTab.create(VButton); - Tab1.SetLabel('BButton & BListView'); + Tab1 := BTab.create(VButton); + Tab1.SetLabel('BButton & BListView'); - TabView.AddTab(VButton,Tab1); + TabView.AddTab(VButton,Tab1); - // Edit - aRect:= BRect.Create(0, 0, 700, 500); - VEdit := TEdit_View.Create(aRect, 'Test 1', B_FOLLOW_ALL, B_NAVIGABLE); - aRect.Free; + // Edit + aRect := BRect.Create(0, 0, 700, 500); + VEdit := TEdit_View.Create(aRect, 'Test 1', B_FOLLOW_ALL, B_NAVIGABLE); + aRect.Free; - Tab1:=BTab.create(VEdit); - Tab1.SetLabel('BeditText'); - - TabView.AddTab(VEdit,Tab1); + Tab1 := BTab.create(VEdit); + Tab1.SetLabel('BeditText'); + + TabView.AddTab(VEdit,Tab1); - // Other - aRect:= BRect.Create(0, 0, 700, 500); - VOther := TOther_View.Create(aRect, 'Test 1', B_FOLLOW_ALL, B_NAVIGABLE); - aRect.Free; + // Other + aRect := BRect.Create(0, 0, 700, 500); + VOther := TOther_View.Create(aRect, 'Test 1', B_FOLLOW_ALL, B_NAVIGABLE); + aRect.Free; - Tab1:=BTab.create(VOther); - Tab1.SetLabel('Other'); - - TabView.AddTab(VOther,Tab1); - - - TabView.Select(0); - + Tab1 := BTab.create(VOther); + Tab1.SetLabel('Other'); + + TabView.AddTab(VOther, Tab1); + + TabView.Select(0); finally end; finally end; - end; destructor TMyWindow.Destroy; @@ -154,66 +145,89 @@ begin inherited; end; - - procedure TMyWindow.MessageReceived(aMessage : BMessage); -Var S : String; - p : pchar; - Alert : BAlert; +var + S : String; + p : PChar; + Alert : BAlert; begin inherited; - Case aMessage.what of - MSG_BUTTON_BASE+1 : Begin - Explain.SetText(Message1+'button 1 clic'); - End; - MSG_BUTTON_BASE+2 : Begin - Explain.SetText(Message1+'button Add Item click'); - VButton.ItemString := BStringItem.create('new Item',0,true); - VButton.ListView1.AddItem(VButton.ItemString); - End; - MSG_BUTTON_BASE+3 : Begin - Explain.SetText(Message1+'button Add OutlineListItem clic'); - VButton.ItemString := BStringItem.create('New Item',0,true); - VButton.outlineListView.AddItem(VButton.ItemString); - End; - MSG_BUTTON_BASE+4 : Begin - VOther.StatusBar1.Update(10, nil, nil); - S:='Position: '+FloatToStr(VOther.StatusBar1.CurrentValue)+' \ '+FloatToStr(VOther.StatusBar1.MaxValue); - p:=stralloc(length(s)+1); - strpcopy(p,s); - VOther.Value.SetText(p); - strdispose(p); - End; - MSG_BUTTON_BASE+5 : Begin - VOther.StatusBar1.Update(-10, nil, nil); - S:='Position: '+FloatToStr(VOther.StatusBar1.CurrentValue)+' \ '+FloatToStr(VOther.StatusBar1.MaxValue); - p:=stralloc(length(s)+1); - strpcopy(p,s); - VOther.Value.SetText(p); - strdispose(p); - End; - MSG_BUTTON_BASE+6 : Begin - Alert:=BAlert.Create('Attention','You have request a alert ?','Help','Cancel','OK',B_WIDTH_AS_USUAL,B_WARNING_ALERT); - Alert.go; - End; - MSG_RADIOBUTTON_BASE + 1 : Begin - VEdit.Edit.setalignment(B_ALIGN_LEFT,B_ALIGN_LEFT); - End; - MSG_RADIOBUTTON_BASE + 2 : Begin - VEdit.Edit.setalignment(B_ALIGN_RIGHT,B_ALIGN_RIGHT); - End; - MSG_RADIOBUTTON_BASE + 3 : Begin - VEdit.Edit.SetEnabled(true); - End; - MSG_RADIOBUTTON_BASE + 4 : Begin - VEdit.Edit.SetEnabled(false); - End; - MSG_MENU_BASE +2 : Begin - quit; - End; - end; + case aMessage.what of + + MSG_BUTTON_BASE + 1 : + begin + Explain.SetText(Message1 + 'button 1 clic'); + end; + + MSG_BUTTON_BASE + 2 : + begin + Explain.SetText(Message1 + 'button Add Item click'); + VButton.ItemString := BStringItem.create('new Item', 0, true); + VButton.ListView1.AddItem(VButton.ItemString); + end; + + MSG_BUTTON_BASE + 3 : + begin + Explain.SetText(Message1 + 'button Add OutlineListItem clic'); + VButton.ItemString := BStringItem.create('New Item', 0, true); + VButton.outlineListView.AddItem(VButton.ItemString); + end; + + MSG_BUTTON_BASE + 4 : + begin + VOther.StatusBar1.Update(10, nil, nil); + S := 'Position: ' + FloatToStr(VOther.StatusBar1.CurrentValue) + ' \ ' + + FloatToStr(VOther.StatusBar1.MaxValue); + p := stralloc(length(s) + 1); + strpcopy(p,s); + VOther.Value.SetText(p); + strdispose(p); + end; + + MSG_BUTTON_BASE + 5 : + begin + VOther.StatusBar1.Update(-10, nil, nil); + S := 'Position: ' + FloatToStr(VOther.StatusBar1.CurrentValue) + ' \ ' + + FloatToStr(VOther.StatusBar1.MaxValue); + p := stralloc(length(s) + 1); + strpcopy(p,s); + VOther.Value.SetText(p); + strdispose(p); + end; + + MSG_BUTTON_BASE + 6 : + begin + Alert := BAlert.Create('Attention','You have request a alert ?','Help', + 'Cancel','OK', B_WIDTH_AS_USUAL, B_WARNING_ALERT); + Alert.go; + end; + + MSG_RADIOBUTTON_BASE + 1 : + begin + VEdit.Edit.setalignment(B_ALIGN_LEFT,B_ALIGN_LEFT); + end; + + MSG_RADIOBUTTON_BASE + 2 : + begin + VEdit.Edit.setalignment(B_ALIGN_RIGHT,B_ALIGN_RIGHT); + end; + + MSG_RADIOBUTTON_BASE + 3 : + begin + VEdit.Edit.SetEnabled(true); + end; + + MSG_RADIOBUTTON_BASE + 4 : + begin + VEdit.Edit.SetEnabled(false); + end; + + MSG_MENU_BASE + 2 : + begin + Quit; + end; + + end; // case end; -end. - - +end. \ No newline at end of file diff --git a/bepascal/demos/demo/sources/other_view.pp b/bepascal/demos/demo/sources/other_view.pp index f6d0b6c..4a6faeb 100644 --- a/bepascal/demos/demo/sources/other_view.pp +++ b/bepascal/demos/demo/sources/other_view.pp @@ -1,112 +1,109 @@ -{ BePascal - A pascal wrapper around the BeOS API - Copyright (C) 2002 Olivier Coursiere - Eric Jourde - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -} +{ BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2002-2003 Olivier Coursiere + Eric Jourde -unit other_view; + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} +unit Other_View; {$M+} interface + uses - classes,beobj, application, message, _beep, roster, SysUtils,interfacedefs, - archivable, handler, rect, window, view, graphicdefs, dataio,box, scrollview,statusbar,button,stringview, - invoker, messenger, Control,textview,font,textcontrol,radiobutton,common; - + Box, Button, GraphicDefs, InterfaceDefs, Message, Rect, StatusBar, + Stringview, View, + Common; type - Tother_View = class(BView) - public - constructor Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal); + Tother_View = class(BView) + public + constructor Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal); - Box1 : BBox; - Box2 : BBox; - StatusBar1 : BStatusBar; - Button1: BButton; - Button2: BButton; - Button3: BButton; - Value : BStringView; + Box1 : BBox; + Box2 : BBox; + StatusBar1 : BStatusBar; + Button1: BButton; + Button2: BButton; + Button3: BButton; + Value : BStringView; end; implementation constructor Tother_View.Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal); -Var - aRect2,aRect3 : BRect; - mess : BMessage; - rgb : RGB_color; - +var + aRect2, aRect3 : BRect; + mess : BMessage; + rgb : RGB_color; begin - inherited; - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + inherited; + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - // Box for Statusbar - aRect2 := BRect.Create(20, 20, 200, 300); - Box2 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, - B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); - Box2.SetLabel('BStatusBar '); - Box2.SetBorder(B_FANCY_BORDER); - AddChild(Box2, nil); - aRect2.Free; + // Box for Statusbar + aRect2 := BRect.Create(20, 20, 200, 300); + Box2 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, + B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); + Box2.SetLabel('BStatusBar '); + Box2.SetBorder(B_FANCY_BORDER); + AddChild(Box2, nil); + aRect2.Free; - // StatusBar1 - aRect2 := BRect.Create(20, 20, 170, 200); - StatusBar1 := BStatusBar.Create(aRect2, 'SB1', 'StatusBar1', 'Trailing Label'); - Box2.AddChild(StatusBar1, nil); - aRect2.Free; + // StatusBar1 + aRect2 := BRect.Create(20, 20, 170, 200); + StatusBar1 := BStatusBar.Create(aRect2, 'SB1', 'StatusBar1', 'Trailing Label'); + Box2.AddChild(StatusBar1, nil); + aRect2.Free; - // Button 1 - aRect2 := BRect.Create(20, 60, 100, 70); - mess := BMessage.Create(MSG_BUTTON_BASE+4); - Button1 := BButton.Create(aRect2, 'Button 1', 'Inc', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - Button1.SetViewColor(rgb); - Box2.AddChild(Button1, nil); - aRect2.Free; + // Button 1 + aRect2 := BRect.Create(20, 60, 100, 70); + mess := BMessage.Create(MSG_BUTTON_BASE+4); + Button1 := BButton.Create(aRect2, 'Button 1', 'Inc', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + Button1.SetViewColor(rgb); + Box2.AddChild(Button1, nil); + aRect2.Free; - // Button 2 - aRect2 := BRect.Create(20, 60+30, 100, 70+30); - mess := BMessage.Create(MSG_BUTTON_BASE+5); - Button2 := BButton.Create(aRect2, 'Add Item', 'Dec', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - Button2.SetViewColor(rgb); - Box2.AddChild(Button2, nil); - aRect2.Free; + // Button 2 + aRect2 := BRect.Create(20, 60+30, 100, 70+30); + mess := BMessage.Create(MSG_BUTTON_BASE+5); + Button2 := BButton.Create(aRect2, 'Add Item', 'Dec', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + Button2.SetViewColor(rgb); + Box2.AddChild(Button2, nil); + aRect2.Free; - // Show text Message - aRect2:= BRect.Create(20, 120, 100, 130); - Value := BStringView.Create(aRect2,'explain','Position : ',B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - Box2.AddChild(Value, nil); - aRect2.Free; - - // Box for Alert - aRect2 := BRect.Create(220, 20, 350, 300); - Box1 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, - B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); - Box1.SetLabel('BAlert'); - Box1.SetBorder(B_FANCY_BORDER); - AddChild(Box1, nil); - aRect2.Free; + // Show text Message + aRect2:= BRect.Create(20, 120, 100, 130); + Value := BStringView.Create(aRect2,'explain','Position : ',B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + Box2.AddChild(Value, nil); + aRect2.Free; - // Button 3 - aRect2 := BRect.Create(20, 20, 100, 30); - mess := BMessage.Create(MSG_BUTTON_BASE+6); - Button3 := BButton.Create(aRect2, 'Add Item', 'Alert', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); - Button3.SetViewColor(rgb); - Box1.AddChild(Button3, nil); - aRect2.Free; + // Box for Alert + aRect2 := BRect.Create(220, 20, 350, 300); + Box1 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP, + B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER); + Box1.SetLabel('BAlert'); + Box1.SetBorder(B_FANCY_BORDER); + AddChild(Box1, nil); + aRect2.Free; + // Button 3 + aRect2 := BRect.Create(20, 20, 100, 30); + mess := BMessage.Create(MSG_BUTTON_BASE+6); + Button3 := BButton.Create(aRect2, 'Add Item', 'Alert', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE); + Button3.SetViewColor(rgb); + Box1.AddChild(Button3, nil); + aRect2.Free; end; -end. +end. \ No newline at end of file