minor fix.
This commit is contained in:
@@ -5,4 +5,4 @@ fi
|
|||||||
|
|
||||||
ppc386 -FE./ -FU./units ./sources/main.pp -oBPDemo
|
ppc386 -FE./ -FU./units ./sources/main.pp -oBPDemo
|
||||||
mergeres ./sources/Resource.rsrc BPDemo
|
mergeres ./sources/Resource.rsrc BPDemo
|
||||||
mimeset BPCalculator
|
mimeset BPDemo
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{ BePascal - A pascal wrapper around the BeOS API
|
{ BePascal - A pascal wrapper around the BeOS API
|
||||||
Copyright (C) 2002 Olivier Coursiere
|
Copyright (C) 2002-2003 Olivier Coursiere
|
||||||
Eric Jourde
|
Eric Jourde
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
@@ -16,126 +16,119 @@
|
|||||||
License along with this library; if not, write to the Free
|
License along with this library; if not, write to the Free
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
}
|
}
|
||||||
|
unit Button_View;
|
||||||
unit button_view;
|
|
||||||
|
|
||||||
{$M+}
|
{$M+}
|
||||||
interface
|
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;
|
|
||||||
|
|
||||||
|
uses
|
||||||
|
Box, Button, GraphicDefs, InterfaceDefs, ListView, ListItem, Message,
|
||||||
|
OutlineListView, Rect, View,
|
||||||
|
Common;
|
||||||
|
|
||||||
type
|
type
|
||||||
TButton_View = class(BView)
|
TButton_View = class(BView)
|
||||||
public
|
public
|
||||||
constructor Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal);
|
constructor Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal);
|
||||||
Button1: BButton;
|
Button1: BButton;
|
||||||
Button2: BButton;
|
Button2: BButton;
|
||||||
Button3: BButton;
|
Button3: BButton;
|
||||||
|
|
||||||
ListView1 : BListView;
|
|
||||||
ItemString : BStringItem;
|
|
||||||
outlineListView : BOutlineListView;
|
|
||||||
Box1 : BBox;
|
|
||||||
Box2 : BBox;
|
|
||||||
|
|
||||||
|
ListView1 : BListView;
|
||||||
|
ItemString : BStringItem;
|
||||||
|
outlineListView : BOutlineListView;
|
||||||
|
Box1 : BBox;
|
||||||
|
Box2 : BBox;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
constructor TButton_View.Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal);
|
constructor TButton_View.Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal);
|
||||||
Var
|
var
|
||||||
aRect2 : BRect;
|
aRect2 : BRect;
|
||||||
mess : BMessage;
|
mess : BMessage;
|
||||||
rgb : RGB_color;
|
rgb : RGB_color;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
// Button 1
|
// Button 1
|
||||||
aRect2 := BRect.Create(20, 20, 100, 30);
|
aRect2 := BRect.Create(20, 20, 100, 30);
|
||||||
mess := BMessage.Create(MSG_BUTTON_BASE+1);
|
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 := BButton.Create(aRect2, 'Button 1', 'Button 1', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
||||||
Button1.SetViewColor(rgb);
|
Button1.SetViewColor(rgb);
|
||||||
AddChild(Button1, nil);
|
AddChild(Button1, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// Button 2
|
// Button 2
|
||||||
aRect2 := BRect.Create(20, 20+30, 100, 30+30);
|
aRect2 := BRect.Create(20, 20+30, 100, 30+30);
|
||||||
mess := BMessage.Create(MSG_BUTTON_BASE+2);
|
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 := BButton.Create(aRect2, 'Add Item', 'Add Item', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
||||||
Button2.SetViewColor(rgb);
|
Button2.SetViewColor(rgb);
|
||||||
AddChild(Button2, nil);
|
AddChild(Button2, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// Button 3
|
// Button 3
|
||||||
aRect2 := BRect.Create(20, 20+60, 100, 30+60);
|
aRect2 := BRect.Create(20, 20+60, 100, 30+60);
|
||||||
mess := BMessage.Create(MSG_BUTTON_BASE+3);
|
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 := BButton.Create(aRect2, 'Add Outline', 'Add Outline', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
||||||
Button3.SetViewColor(rgb);
|
Button3.SetViewColor(rgb);
|
||||||
AddChild(Button3, nil);
|
AddChild(Button3, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// Box for ListView
|
// Box for ListView
|
||||||
aRect2 := BRect.Create(120, 30, 250, 300);
|
aRect2 := BRect.Create(120, 30, 250, 300);
|
||||||
Box1 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
Box1 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
||||||
Box1.SetLabel('BListView');
|
Box1.SetLabel('BListView');
|
||||||
Box1.SetBorder(B_FANCY_BORDER);
|
Box1.SetBorder(B_FANCY_BORDER);
|
||||||
AddChild(Box1, nil);
|
AddChild(Box1, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// ListView1
|
// ListView1
|
||||||
aRect2 := BRect.Create(10, 15, 120, 250);
|
aRect2 := BRect.Create(10, 15, 120, 250);
|
||||||
ListView1 := BListView.create(aRect2,'toto',
|
ListView1 := BListView.create(aRect2,'toto', B_SINGLE_SELECTION_LIST,
|
||||||
B_SINGLE_SELECTION_LIST,
|
B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
||||||
B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
B_WILL_DRAW or B_NAVIGABLE or B_FRAME_EVENTS);
|
||||||
B_WILL_DRAW or B_NAVIGABLE or B_FRAME_EVENTS);
|
Box1.AddChild(ListView1, nil);
|
||||||
Box1.AddChild(ListView1, nil);
|
aRect2.Free;
|
||||||
aRect2.Free;
|
|
||||||
|
|
||||||
|
{
|
||||||
{ ItemString := BStringItem.create('test 1',0,true);
|
ItemString := BStringItem.create('test 1',0,true);
|
||||||
ListView1.AddItem(ItemString);
|
ListView1.AddItem(ItemString);
|
||||||
ItemString := BStringItem.create('test 2',1,true);
|
ItemString := BStringItem.create('test 2',1,true);
|
||||||
ListView1.AddItem(ItemString);
|
ListView1.AddItem(ItemString);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Box for OutLineListItem
|
// Box for OutLineListItem
|
||||||
aRect2 := BRect.Create(260, 30, 400, 300);
|
aRect2 := BRect.Create(260, 30, 400, 300);
|
||||||
Box2 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
Box2 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
||||||
Box2.SetLabel('BOutlineListView ');
|
Box2.SetLabel('BOutlineListView ');
|
||||||
Box2.SetBorder(B_FANCY_BORDER);
|
Box2.SetBorder(B_FANCY_BORDER);
|
||||||
AddChild(Box2, nil);
|
AddChild(Box2, nil);
|
||||||
aRect2.Free;
|
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.
|
end.
|
||||||
@@ -1,13 +1,16 @@
|
|||||||
unit common;
|
unit Common;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
const
|
const
|
||||||
MSG_TEST_APP_BASE = 79000;
|
MSG_TEST_APP_BASE = 79000;
|
||||||
MSG_BUTTON_BASE = MSG_TEST_APP_BASE + 100;
|
MSG_BUTTON_BASE = MSG_TEST_APP_BASE + 100;
|
||||||
MSG_CHECKBOX_BASE = MSG_TEST_APP_BASE + 200;
|
MSG_CHECKBOX_BASE = MSG_TEST_APP_BASE + 200;
|
||||||
MSG_RADIOBUTTON_BASE = MSG_TEST_APP_BASE + 300;
|
MSG_RADIOBUTTON_BASE = MSG_TEST_APP_BASE + 300;
|
||||||
MSG_STRINGVIEW_BASE = MSG_TEST_APP_BASE + 400;
|
MSG_STRINGVIEW_BASE = MSG_TEST_APP_BASE + 400;
|
||||||
MSG_MENU_BASE = MSG_TEST_APP_BASE + 500;
|
MSG_MENU_BASE = MSG_TEST_APP_BASE + 500;
|
||||||
MSG_STATUSBAR_BASE = MSG_TEST_APP_BASE + 600;
|
MSG_STATUSBAR_BASE = MSG_TEST_APP_BASE + 600;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
end.
|
end.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{ BePascal - A pascal wrapper around the BeOS API
|
{ BePascal - A pascal wrapper around the BeOS API
|
||||||
Copyright (C) 2002 Olivier Coursiere
|
Copyright (C) 2002-2003 Olivier Coursiere
|
||||||
Eric Jourde
|
Eric Jourde
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
@@ -16,8 +16,7 @@
|
|||||||
License along with this library; if not, write to the Free
|
License along with this library; if not, write to the Free
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
}
|
}
|
||||||
|
unit Edit_View;
|
||||||
unit edit_view;
|
|
||||||
|
|
||||||
{$M+}
|
{$M+}
|
||||||
interface
|
interface
|
||||||
@@ -28,128 +27,127 @@ uses
|
|||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TEdit_View = class(BView)
|
TEdit_View = class(BView)
|
||||||
public
|
public
|
||||||
constructor Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal);
|
constructor Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal);
|
||||||
|
|
||||||
aTextView : BTextView;
|
aTextView : BTextView;
|
||||||
Edit : BTextControl;
|
Edit : BTextControl;
|
||||||
|
|
||||||
afont : Bfont;
|
afont : Bfont;
|
||||||
Box1 : BBox;
|
Box1 : BBox;
|
||||||
Box2 : BBox;
|
Box2 : BBox;
|
||||||
Box3 : BBox;
|
Box3 : BBox;
|
||||||
Box4 : BBox;
|
Box4 : BBox;
|
||||||
RadioButton1,
|
RadioButton1,
|
||||||
RadioButton2 : BRadioButton;
|
RadioButton2 : BRadioButton;
|
||||||
RadioButton3,
|
RadioButton3,
|
||||||
RadioButton4 : BRadioButton;
|
RadioButton4 : BRadioButton;
|
||||||
scroll_vert :BscrollView;
|
scroll_vert : BscrollView;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
constructor TEdit_View.Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal);
|
constructor TEdit_View.Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal);
|
||||||
Var
|
var
|
||||||
aRect2,aRect3 : BRect;
|
aRect2,aRect3 : BRect;
|
||||||
mess : BMessage;
|
mess : BMessage;
|
||||||
rgb : RGB_color;
|
rgb : RGB_color;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
// Box for textview
|
// Box for textview
|
||||||
aRect2 := BRect.Create(20, 20, 200, 300);
|
aRect2 := BRect.Create(20, 20, 200, 300);
|
||||||
Box2 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
Box2 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
||||||
Box2.SetLabel('BTextView ');
|
Box2.SetLabel('BTextView ');
|
||||||
Box2.SetBorder(B_FANCY_BORDER);
|
Box2.SetBorder(B_FANCY_BORDER);
|
||||||
AddChild(Box2, nil);
|
AddChild(Box2, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// textView
|
// textView
|
||||||
aRect2 := BRect.Create(10, 15, 160, 260);
|
aRect2 := BRect.Create(10, 15, 160, 260);
|
||||||
aRect3 := BRect.Create(0, 0, 140, 500-160);
|
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);
|
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);
|
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);
|
Box2.addchild(scroll_vert,nil);
|
||||||
|
|
||||||
aTextView.setStylable(true);
|
aTextView.setStylable(true);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
aRect3.Free;
|
aRect3.Free;
|
||||||
|
|
||||||
// Box for TextControl
|
// Box for TextControl
|
||||||
aRect2 := BRect.Create(220, 20, 400, 300);
|
aRect2 := BRect.Create(220, 20, 400, 300);
|
||||||
Box1 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
Box1 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
||||||
Box1.SetLabel('BTextControl ');
|
Box1.SetLabel('BTextControl ');
|
||||||
Box1.SetBorder(B_FANCY_BORDER);
|
Box1.SetBorder(B_FANCY_BORDER);
|
||||||
AddChild(Box1, nil);
|
AddChild(Box1, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
mess := BMessage.Create(77780);
|
mess := BMessage.Create(77780);
|
||||||
aRect2 := BRect.Create(10, 15, 150, 20);
|
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:=BTextControl.Create(aRect2,' Zone_calcul',' ','',mess,B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
||||||
Edit.setdivider(0);
|
Edit.setdivider(0);
|
||||||
Edit.setalignment(B_ALIGN_LEFT,B_ALIGN_LEFT);
|
Edit.setalignment(B_ALIGN_LEFT,B_ALIGN_LEFT);
|
||||||
//Edit.SetEnabled(false);
|
//Edit.SetEnabled(false);
|
||||||
Box1.AddChild(Edit,nil);
|
Box1.AddChild(Edit,nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// Box for Textalignement
|
// Box for Textalignement
|
||||||
aRect2 := BRect.Create(10, 40, 150, 100);
|
aRect2 := BRect.Create(10, 40, 150, 100);
|
||||||
Box3 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
Box3 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
||||||
Box3.SetLabel('setalignment ');
|
Box3.SetLabel('setalignment ');
|
||||||
Box3.SetBorder(B_FANCY_BORDER);
|
Box3.SetBorder(B_FANCY_BORDER);
|
||||||
Box1.AddChild(Box3, nil);
|
Box1.AddChild(Box3, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// RadioButton1
|
// RadioButton1
|
||||||
mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 1);
|
mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 1);
|
||||||
aRect2 := BRect.Create(10, 14, 120, 24);
|
aRect2 := BRect.Create(10, 14, 120, 24);
|
||||||
RadioButton1 := BRadioButton.Create(aRect2, 'RB1', 'B_ALIGN_LEFT', mess,
|
RadioButton1 := BRadioButton.Create(aRect2, 'RB1', 'B_ALIGN_LEFT', mess,
|
||||||
B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
||||||
Box3.AddChild(RadioButton1, nil);
|
Box3.AddChild(RadioButton1, nil);
|
||||||
RadioButton1.SetValue(1);
|
RadioButton1.SetValue(1);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// RadioButton2
|
// RadioButton2
|
||||||
mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 2);
|
mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 2);
|
||||||
aRect2 := BRect.Create(10, 34, 120, 54);
|
aRect2 := BRect.Create(10, 34, 120, 54);
|
||||||
RadioButton2 := BRadioButton.Create(aRect2, 'RB2', 'B_ALIGN_RIGHT', mess,
|
RadioButton2 := BRadioButton.Create(aRect2, 'RB2', 'B_ALIGN_RIGHT', mess,
|
||||||
B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
||||||
Box3.AddChild(RadioButton2, nil);
|
Box3.AddChild(RadioButton2, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// Box for SetEnabled
|
// Box for SetEnabled
|
||||||
aRect2 := BRect.Create(10, 120, 150, 180);
|
aRect2 := BRect.Create(10, 120, 150, 180);
|
||||||
Box4 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
Box4 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
||||||
Box4.SetLabel('SetEnabled ');
|
Box4.SetLabel('SetEnabled ');
|
||||||
Box4.SetBorder(B_FANCY_BORDER);
|
Box4.SetBorder(B_FANCY_BORDER);
|
||||||
Box1.AddChild(Box4, nil);
|
Box1.AddChild(Box4, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// RadioButton3
|
// RadioButton3
|
||||||
mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 3);
|
mess := BMessage.Create(MSG_RADIOBUTTON_BASE + 3);
|
||||||
aRect2 := BRect.Create(10, 14, 120, 24);
|
aRect2 := BRect.Create(10, 14, 120, 24);
|
||||||
RadioButton3 := BRadioButton.Create(aRect2, 'RB1', 'SetEnabled(true)', mess,
|
RadioButton3 := BRadioButton.Create(aRect2, 'RB1', 'SetEnabled(true)', mess,
|
||||||
B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
||||||
Box4.AddChild(RadioButton3, nil);
|
Box4.AddChild(RadioButton3, nil);
|
||||||
RadioButton3.SetValue(1);
|
RadioButton3.SetValue(1);
|
||||||
aRect2.Free;
|
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;
|
|
||||||
|
|
||||||
|
// 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.
|
end.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{ BePascal - A pascal wrapper around the BeOS API
|
{ BePascal - A pascal wrapper around the BeOS API
|
||||||
Copyright (C) 2002 Olivier Coursiere
|
Copyright (C) 2002-2003 Olivier Coursiere
|
||||||
Eric Jourde
|
Eric Jourde
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
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
|
License along with this library; if not, write to the Free
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
}
|
}
|
||||||
|
|
||||||
program Main;
|
program Main;
|
||||||
|
|
||||||
{$M+}
|
{$M+}
|
||||||
uses
|
uses
|
||||||
beobj, application, message, _beep, roster, SysUtils,
|
Application, Message, Roster, Rect, Window,
|
||||||
archivable, handler, rect, window, view, graphicdefs, dataio,
|
Main_Window;
|
||||||
invoker, messenger, Control, Button,stringview,textcontrol,checkbox,
|
|
||||||
main_window;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
TMonApplication = class(BApplication)
|
TMonApplication = class(BApplication)
|
||||||
public
|
public
|
||||||
procedure ReadyToRun; override;
|
procedure ReadyToRun; override;
|
||||||
function QuitRequested : boolean; override;
|
function QuitRequested : Boolean; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TMonApplication.QuitRequested : Boolean;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function TMonApplication.QuitRequested : boolean;
|
|
||||||
begin
|
begin
|
||||||
Result := inherited;
|
Result := inherited;
|
||||||
be_app.Free;
|
be_app.Free;
|
||||||
@@ -59,24 +53,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
aRect : BRect;
|
aRect : BRect;
|
||||||
win : TMyWindow;
|
win : TMyWindow;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
TMonApplication.Create;
|
TMonApplication.Create;
|
||||||
try
|
try
|
||||||
aRect := BRect.Create(20, 20, 740, 500);
|
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 := 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;
|
win.Show;
|
||||||
be_app.Run;
|
be_app.Run;
|
||||||
be_app.HideCursor;
|
be_app.HideCursor;
|
||||||
be_app.ShowCursor;
|
be_app.ShowCursor;
|
||||||
finally
|
finally
|
||||||
aRect.Free;
|
aRect.Free;
|
||||||
win.Free;
|
win.Free;
|
||||||
end;
|
end;
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{ BePascal - A pascal wrapper around the BeOS API
|
{ BePascal - A pascal wrapper around the BeOS API
|
||||||
Copyright (C) 2002 Olivier Coursiere
|
Copyright (C) 2002-2003 Olivier Coursiere
|
||||||
Eric Jourde
|
Eric Jourde
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
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
|
License along with this library; if not, write to the Free
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
}
|
}
|
||||||
|
unit Main_Window;
|
||||||
unit main_window;
|
|
||||||
|
|
||||||
interface
|
interface
|
||||||
{$M+}
|
{$M+}
|
||||||
uses
|
uses
|
||||||
beobj, application, message, _beep, roster, SysUtils,appdefs,
|
SysUtils,
|
||||||
archivable, handler, rect, window, view, graphicdefs, dataio, interfacedefs,textView,alert,
|
Alert, InterfaceDefs, ListItem, Menu, Menubar, Message, Rect, StringView,
|
||||||
invoker, messenger, Control, Button,stringview,textcontrol,checkbox,TabView,listitem,
|
TabView, View, Window,
|
||||||
menu, menubar,
|
Common, Button_View, Edit_View, Other_View;
|
||||||
button_view,edit_view,common,other_view;
|
|
||||||
|
|
||||||
|
type
|
||||||
Type
|
TMyWindow = class(BWindow)
|
||||||
TMyWindow = class(BWindow)
|
|
||||||
private
|
private
|
||||||
aView : BView;
|
aView : BView;
|
||||||
TabView : BTabView;
|
TabView : BTabView;
|
||||||
Tab1 : BTab;
|
Tab1 : BTab;
|
||||||
Tab2 : BTab;
|
Tab2 : BTab;
|
||||||
|
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(aFrame : BRect; title : PChar; atype, aFlags, aWorkspaces : Cardinal); override;
|
constructor Create(aFrame : BRect; title : PChar; atype, aFlags, aWorkspaces : Cardinal); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure MessageReceived(amessage : BMessage); override;
|
procedure MessageReceived(amessage : BMessage); override;
|
||||||
VButton : TButton_View;
|
VButton : TButton_View;
|
||||||
VEdit : TEdit_View;
|
VEdit : TEdit_View;
|
||||||
Explain : BStringView;
|
Explain : BStringView;
|
||||||
VOther : TOther_View;
|
VOther : TOther_View;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Const Message1='Message : ';
|
const
|
||||||
|
Message1 = 'Message : ';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -65,88 +61,83 @@ var
|
|||||||
sepItem, sepItem2 : BSeparatorItem;
|
sepItem, sepItem2 : BSeparatorItem;
|
||||||
item : BMenuItem;
|
item : BMenuItem;
|
||||||
item1 : BMenuItem;
|
item1 : BMenuItem;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
try
|
try
|
||||||
try
|
try
|
||||||
// menu
|
// 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);
|
||||||
|
|
||||||
aRect2 := BRect.Create(0,0,300,300);
|
Menu.AddItem(item);
|
||||||
menubar := BMenuBar.Create(aRect2, 'Bonjour', B_FOLLOW_LEFT_RIGHT or B_FOLLOW_TOP, B_ITEMS_IN_COLUMN, True);
|
Menu.AddSeparatorItem;
|
||||||
AddChild(menubar, nil);
|
Menu.AddItem(item1);
|
||||||
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);
|
MenuBar.AddItem(Menu);
|
||||||
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;
|
||||||
|
|
||||||
// Create the main View
|
// Show text Message
|
||||||
aRect := BRect.Create(0, 0, 1000, 600);
|
aRect:= BRect.Create(20, 400, 200, 420);
|
||||||
aView := BView.Create(aRect, 'Test', B_FOLLOW_ALL, B_WILL_DRAW);
|
Explain := BStringView.Create(aRect,'explain','Message : ', B_FOLLOW_LEFT
|
||||||
aView.SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
||||||
self.AddChild(aView, nil);
|
aView.AddChild(Explain, nil);
|
||||||
aRect.Free;
|
aRect.Free;
|
||||||
|
|
||||||
// Show text Message
|
// TabView
|
||||||
aRect:= BRect.Create(20, 400, 200, 420);
|
aRect := BRect.Create(20, 25, 700, 400);
|
||||||
Explain := BStringView.Create(aRect,'explain','Message : ',B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
TabView := BTabview.Create(aRect,'test', B_WIDTH_AS_USUAL, B_FOLLOW_TOP,
|
||||||
aView.AddChild(Explain, nil);
|
B_FULL_UPDATE_ON_RESIZE or B_WILL_DRAW or
|
||||||
aRect.Free;
|
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;
|
||||||
|
|
||||||
// TabView
|
Tab1 := BTab.create(VButton);
|
||||||
aRect:= BRect.Create(20, 25, 700, 400);
|
Tab1.SetLabel('BButton & BListView');
|
||||||
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
|
TabView.AddTab(VButton,Tab1);
|
||||||
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);
|
// Edit
|
||||||
Tab1.SetLabel('BButton & BListView');
|
aRect := BRect.Create(0, 0, 700, 500);
|
||||||
|
VEdit := TEdit_View.Create(aRect, 'Test 1', B_FOLLOW_ALL, B_NAVIGABLE);
|
||||||
|
aRect.Free;
|
||||||
|
|
||||||
TabView.AddTab(VButton,Tab1);
|
Tab1 := BTab.create(VEdit);
|
||||||
|
Tab1.SetLabel('BeditText');
|
||||||
|
|
||||||
// Edit
|
TabView.AddTab(VEdit,Tab1);
|
||||||
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);
|
// Other
|
||||||
Tab1.SetLabel('BeditText');
|
aRect := BRect.Create(0, 0, 700, 500);
|
||||||
|
VOther := TOther_View.Create(aRect, 'Test 1', B_FOLLOW_ALL, B_NAVIGABLE);
|
||||||
|
aRect.Free;
|
||||||
|
|
||||||
TabView.AddTab(VEdit,Tab1);
|
Tab1 := BTab.create(VOther);
|
||||||
|
Tab1.SetLabel('Other');
|
||||||
|
|
||||||
// Other
|
TabView.AddTab(VOther, Tab1);
|
||||||
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);
|
|
||||||
|
|
||||||
|
TabView.Select(0);
|
||||||
finally
|
finally
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TMyWindow.Destroy;
|
destructor TMyWindow.Destroy;
|
||||||
@@ -154,66 +145,89 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure TMyWindow.MessageReceived(aMessage : BMessage);
|
procedure TMyWindow.MessageReceived(aMessage : BMessage);
|
||||||
Var S : String;
|
var
|
||||||
p : pchar;
|
S : String;
|
||||||
Alert : BAlert;
|
p : PChar;
|
||||||
|
Alert : BAlert;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
Case aMessage.what of
|
case aMessage.what of
|
||||||
MSG_BUTTON_BASE+1 : Begin
|
|
||||||
Explain.SetText(Message1+'button 1 clic');
|
MSG_BUTTON_BASE + 1 :
|
||||||
End;
|
begin
|
||||||
MSG_BUTTON_BASE+2 : Begin
|
Explain.SetText(Message1 + 'button 1 clic');
|
||||||
Explain.SetText(Message1+'button Add Item click');
|
end;
|
||||||
VButton.ItemString := BStringItem.create('new Item',0,true);
|
|
||||||
VButton.ListView1.AddItem(VButton.ItemString);
|
MSG_BUTTON_BASE + 2 :
|
||||||
End;
|
begin
|
||||||
MSG_BUTTON_BASE+3 : Begin
|
Explain.SetText(Message1 + 'button Add Item click');
|
||||||
Explain.SetText(Message1+'button Add OutlineListItem clic');
|
VButton.ItemString := BStringItem.create('new Item', 0, true);
|
||||||
VButton.ItemString := BStringItem.create('New Item',0,true);
|
VButton.ListView1.AddItem(VButton.ItemString);
|
||||||
VButton.outlineListView.AddItem(VButton.ItemString);
|
end;
|
||||||
End;
|
|
||||||
MSG_BUTTON_BASE+4 : Begin
|
MSG_BUTTON_BASE + 3 :
|
||||||
VOther.StatusBar1.Update(10, nil, nil);
|
begin
|
||||||
S:='Position: '+FloatToStr(VOther.StatusBar1.CurrentValue)+' \ '+FloatToStr(VOther.StatusBar1.MaxValue);
|
Explain.SetText(Message1 + 'button Add OutlineListItem clic');
|
||||||
p:=stralloc(length(s)+1);
|
VButton.ItemString := BStringItem.create('New Item', 0, true);
|
||||||
strpcopy(p,s);
|
VButton.outlineListView.AddItem(VButton.ItemString);
|
||||||
VOther.Value.SetText(p);
|
end;
|
||||||
strdispose(p);
|
|
||||||
End;
|
MSG_BUTTON_BASE + 4 :
|
||||||
MSG_BUTTON_BASE+5 : Begin
|
begin
|
||||||
VOther.StatusBar1.Update(-10, nil, nil);
|
VOther.StatusBar1.Update(10, nil, nil);
|
||||||
S:='Position: '+FloatToStr(VOther.StatusBar1.CurrentValue)+' \ '+FloatToStr(VOther.StatusBar1.MaxValue);
|
S := 'Position: ' + FloatToStr(VOther.StatusBar1.CurrentValue) + ' \ '
|
||||||
p:=stralloc(length(s)+1);
|
+ FloatToStr(VOther.StatusBar1.MaxValue);
|
||||||
strpcopy(p,s);
|
p := stralloc(length(s) + 1);
|
||||||
VOther.Value.SetText(p);
|
strpcopy(p,s);
|
||||||
strdispose(p);
|
VOther.Value.SetText(p);
|
||||||
End;
|
strdispose(p);
|
||||||
MSG_BUTTON_BASE+6 : Begin
|
end;
|
||||||
Alert:=BAlert.Create('Attention','You have request a alert ?','Help','Cancel','OK',B_WIDTH_AS_USUAL,B_WARNING_ALERT);
|
|
||||||
Alert.go;
|
MSG_BUTTON_BASE + 5 :
|
||||||
End;
|
begin
|
||||||
MSG_RADIOBUTTON_BASE + 1 : Begin
|
VOther.StatusBar1.Update(-10, nil, nil);
|
||||||
VEdit.Edit.setalignment(B_ALIGN_LEFT,B_ALIGN_LEFT);
|
S := 'Position: ' + FloatToStr(VOther.StatusBar1.CurrentValue) + ' \ '
|
||||||
End;
|
+ FloatToStr(VOther.StatusBar1.MaxValue);
|
||||||
MSG_RADIOBUTTON_BASE + 2 : Begin
|
p := stralloc(length(s) + 1);
|
||||||
VEdit.Edit.setalignment(B_ALIGN_RIGHT,B_ALIGN_RIGHT);
|
strpcopy(p,s);
|
||||||
End;
|
VOther.Value.SetText(p);
|
||||||
MSG_RADIOBUTTON_BASE + 3 : Begin
|
strdispose(p);
|
||||||
VEdit.Edit.SetEnabled(true);
|
end;
|
||||||
End;
|
|
||||||
MSG_RADIOBUTTON_BASE + 4 : Begin
|
MSG_BUTTON_BASE + 6 :
|
||||||
VEdit.Edit.SetEnabled(false);
|
begin
|
||||||
End;
|
Alert := BAlert.Create('Attention','You have request a alert ?','Help',
|
||||||
MSG_MENU_BASE +2 : Begin
|
'Cancel','OK', B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
||||||
quit;
|
Alert.go;
|
||||||
End;
|
end;
|
||||||
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.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{ BePascal - A pascal wrapper around the BeOS API
|
{ BePascal - A pascal wrapper around the BeOS API
|
||||||
Copyright (C) 2002 Olivier Coursiere
|
Copyright (C) 2002-2003 Olivier Coursiere
|
||||||
Eric Jourde
|
Eric Jourde
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
@@ -16,97 +16,94 @@
|
|||||||
License along with this library; if not, write to the Free
|
License along with this library; if not, write to the Free
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
}
|
}
|
||||||
|
unit Other_View;
|
||||||
unit other_view;
|
|
||||||
|
|
||||||
{$M+}
|
{$M+}
|
||||||
interface
|
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;
|
|
||||||
|
|
||||||
|
uses
|
||||||
|
Box, Button, GraphicDefs, InterfaceDefs, Message, Rect, StatusBar,
|
||||||
|
Stringview, View,
|
||||||
|
Common;
|
||||||
|
|
||||||
type
|
type
|
||||||
Tother_View = class(BView)
|
Tother_View = class(BView)
|
||||||
public
|
public
|
||||||
constructor Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal);
|
constructor Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal);
|
||||||
|
|
||||||
Box1 : BBox;
|
Box1 : BBox;
|
||||||
Box2 : BBox;
|
Box2 : BBox;
|
||||||
StatusBar1 : BStatusBar;
|
StatusBar1 : BStatusBar;
|
||||||
Button1: BButton;
|
Button1: BButton;
|
||||||
Button2: BButton;
|
Button2: BButton;
|
||||||
Button3: BButton;
|
Button3: BButton;
|
||||||
Value : BStringView;
|
Value : BStringView;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
constructor Tother_View.Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal);
|
constructor Tother_View.Create(frame : BRect; name : PChar; resizingMode, flags : Cardinal);
|
||||||
Var
|
var
|
||||||
aRect2,aRect3 : BRect;
|
aRect2, aRect3 : BRect;
|
||||||
mess : BMessage;
|
mess : BMessage;
|
||||||
rgb : RGB_color;
|
rgb : RGB_color;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
// Box for Statusbar
|
// Box for Statusbar
|
||||||
aRect2 := BRect.Create(20, 20, 200, 300);
|
aRect2 := BRect.Create(20, 20, 200, 300);
|
||||||
Box2 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
Box2 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
||||||
Box2.SetLabel('BStatusBar ');
|
Box2.SetLabel('BStatusBar ');
|
||||||
Box2.SetBorder(B_FANCY_BORDER);
|
Box2.SetBorder(B_FANCY_BORDER);
|
||||||
AddChild(Box2, nil);
|
AddChild(Box2, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// StatusBar1
|
// StatusBar1
|
||||||
aRect2 := BRect.Create(20, 20, 170, 200);
|
aRect2 := BRect.Create(20, 20, 170, 200);
|
||||||
StatusBar1 := BStatusBar.Create(aRect2, 'SB1', 'StatusBar1', 'Trailing Label');
|
StatusBar1 := BStatusBar.Create(aRect2, 'SB1', 'StatusBar1', 'Trailing Label');
|
||||||
Box2.AddChild(StatusBar1, nil);
|
Box2.AddChild(StatusBar1, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// Button 1
|
// Button 1
|
||||||
aRect2 := BRect.Create(20, 60, 100, 70);
|
aRect2 := BRect.Create(20, 60, 100, 70);
|
||||||
mess := BMessage.Create(MSG_BUTTON_BASE+4);
|
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 := BButton.Create(aRect2, 'Button 1', 'Inc', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
||||||
Button1.SetViewColor(rgb);
|
Button1.SetViewColor(rgb);
|
||||||
Box2.AddChild(Button1, nil);
|
Box2.AddChild(Button1, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// Button 2
|
// Button 2
|
||||||
aRect2 := BRect.Create(20, 60+30, 100, 70+30);
|
aRect2 := BRect.Create(20, 60+30, 100, 70+30);
|
||||||
mess := BMessage.Create(MSG_BUTTON_BASE+5);
|
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 := BButton.Create(aRect2, 'Add Item', 'Dec', mess, B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
||||||
Button2.SetViewColor(rgb);
|
Button2.SetViewColor(rgb);
|
||||||
Box2.AddChild(Button2, nil);
|
Box2.AddChild(Button2, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// Show text Message
|
// Show text Message
|
||||||
aRect2:= BRect.Create(20, 120, 100, 130);
|
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);
|
Value := BStringView.Create(aRect2,'explain','Position : ',B_FOLLOW_LEFT or B_FOLLOW_TOP, B_WILL_DRAW or B_NAVIGABLE);
|
||||||
Box2.AddChild(Value, nil);
|
Box2.AddChild(Value, nil);
|
||||||
aRect2.Free;
|
aRect2.Free;
|
||||||
|
|
||||||
// Box for Alert
|
// Box for Alert
|
||||||
aRect2 := BRect.Create(220, 20, 350, 300);
|
aRect2 := BRect.Create(220, 20, 350, 300);
|
||||||
Box1 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
Box1 := BBox.Create(aRect2, 'Box1', B_FOLLOW_LEFT or B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
B_WILL_DRAW or B_NAVIGABLE, B_PLAIN_BORDER);
|
||||||
Box1.SetLabel('BAlert');
|
Box1.SetLabel('BAlert');
|
||||||
Box1.SetBorder(B_FANCY_BORDER);
|
Box1.SetBorder(B_FANCY_BORDER);
|
||||||
AddChild(Box1, nil);
|
AddChild(Box1, nil);
|
||||||
aRect2.Free;
|
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;
|
|
||||||
|
|
||||||
|
// 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.
|
end.
|
||||||
Reference in New Issue
Block a user