Skip to content

Commit

Permalink
Updating examples for Ext JS 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wanderlan.anjos@gmail.com committed Mar 30, 2013
1 parent 4697fe0 commit f169060
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 88 deletions.
37 changes: 36 additions & 1 deletion ExtJSWrapper/Ext.pas
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
unit Ext;

// Generated by JSToPascal v.0.9.9, at 30/03/2013 17:28:36
// Generated by JSToPascal v.0.9.9, at 30/03/2013 18:09:20
// from "\extpascal\ext-4.2.0\src

interface
Expand Down Expand Up @@ -14091,6 +14091,10 @@ TExtTip = class(TExtPanel)
property Width : Integer read FWidth write SetFWidth;
end;

// Procedural types for events TExtTabPanel
TExtTabPanelOnbeforetabchange = procedure(TabPanel : TExtTabPanel; NewCard : TExtPanel; OldCard : TExtPanel) of object;
TExtTabPanelOntabchange = procedure(TabPanel : TExtTabPanel; NewCard : TExtPanel; OldCard : TExtPanel) of object;

// Enumerated types for properties
TTabPositionEnum = (taTop, taBottom, taLeft, taRight);

Expand All @@ -14112,6 +14116,8 @@ TExtTabPanel = class(TExtPanel)
FTabBar : TExtObject;
FTabBar_ : TExtTabBar;
FTabPosition : TTabPositionEnum;
FOnbeforetabchange : TExtTabPanelOnbeforetabchange;
FOntabchange : TExtTabPanelOntabchange;
procedure SetFActiveItem(Value : Integer);
procedure SetFActiveItemString(Value : String);
procedure SetFActiveTab(Value : Integer);
Expand All @@ -14128,8 +14134,11 @@ TExtTabPanel = class(TExtPanel)
procedure SetFTabBar(Value : TExtObject);
procedure SetFTabBar_(Value : TExtTabBar);
procedure SetFTabPosition(Value : TTabPositionEnum);
procedure SetFOnbeforetabchange(Value : TExtTabPanelOnbeforetabchange);
procedure SetFOntabchange(Value : TExtTabPanelOntabchange);
protected
procedure InitDefaults; override;
procedure HandleEvent(const AEvtName: string); override;
public
function JSClassName : string; override;
{$IFDEF FPC}constructor AddTo(List : TExtObjectList);{$ENDIF}
Expand All @@ -14154,6 +14163,8 @@ TExtTabPanel = class(TExtPanel)
property TabBar : TExtObject read FTabBar write SetFTabBar;
property TabBar_ : TExtTabBar read FTabBar_ write SetFTabBar_;
property TabPosition : TTabPositionEnum read FTabPosition write SetFTabPosition;
property Onbeforetabchange : TExtTabPanelOnbeforetabchange read FOnbeforetabchange write SetFOnbeforetabchange;
property Ontabchange : TExtTabPanelOntabchange read FOntabchange write SetFOntabchange;
end;

TExtTreeViewDropZone = class(TExtViewDropZone)
Expand Down Expand Up @@ -46220,6 +46231,22 @@ procedure TExtTabPanel.SetFTabPosition(Value : TTabPositionEnum); begin
JSCode('tabPosition:"' + EnumToJSString(TypeInfo(TTabPositionEnum), ord(Value)) + '"');
end;

procedure TExtTabPanel.SetFOnbeforetabchange(Value : TExtTabPanelOnbeforetabchange); begin
if Assigned(FOnbeforetabchange) then
JSCode(JSName+'.events ["Onbeforetabchange"].listeners=[];');
if Assigned(Value) then
AddListener('Onbeforetabchange', Ajax('Onbeforetabchange', ['TabPanel', '%0.nm','NewCard', '%1.nm','OldCard', '%2.nm'], true));
FOnbeforetabchange := Value;
end;

procedure TExtTabPanel.SetFOntabchange(Value : TExtTabPanelOntabchange); begin
if Assigned(FOntabchange) then
JSCode(JSName+'.events ["Ontabchange"].listeners=[];');
if Assigned(Value) then
AddListener('Ontabchange', Ajax('Ontabchange', ['TabPanel', '%0.nm','NewCard', '%1.nm','OldCard', '%2.nm'], true));
FOntabchange := Value;
end;

function TExtTabPanel.JSClassName : string; begin
Result := 'Ext.tab.Panel';
end;
Expand Down Expand Up @@ -46264,6 +46291,14 @@ destructor TExtTabPanel.Destroy; begin
inherited;
end;

procedure TExtTabPanel.HandleEvent(const AEvtName : string); begin
inherited;
if (AEvtName = 'Onbeforetabchange') and Assigned(FOnbeforetabchange) then
FOnbeforetabchange(TExtTabPanel(ParamAsObject('TabPanel')), TExtPanel(ParamAsObject('NewCard')), TExtPanel(ParamAsObject('OldCard')))
else if (AEvtName = 'Ontabchange') and Assigned(FOntabchange) then
FOntabchange(TExtTabPanel(ParamAsObject('TabPanel')), TExtPanel(ParamAsObject('NewCard')), TExtPanel(ParamAsObject('OldCard')));
end;

procedure TExtTreeViewDropZone.SetFAllowContainerDrop(Value : String); begin
FAllowContainerDrop := Value;
JSCode('allowContainerDrop:' + VarToJSON([Value]));
Expand Down
4 changes: 2 additions & 2 deletions ExtJSWrapper/ExtFixes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ ExtProgressWaitConfig, text, string, false, true,
ExtProgressWaitConfig, fn, ExtFunction, false, true,
ExtProgressWaitConfig, scope, ExtObject, false, true,

ExtTabPanel, beforetabchange, Event, tabPanel, ExtTabPanel, newCard, ExtPanel, oldCard, ExtPanel
ExtTabPanel, tabchange, Event, tabPanel, ExtTabPanel, newCard, ExtPanel, oldCard, ExtPanel


*ExtBoxComponent, region, (rgCenter, rgNorth, rgEast, rgSouth, rgWest)
*ExtComponent, xtype, (xtBox, xtButton, xtButtonGroup, xtColorPalette, xtComponent, xtContainer, xtCycle, xtDataView, xtDatePicker, xtEditor, xtEditorGrid, xtFlash, xtGrid, xtListView, xtPaging, xtPanel, xtProgress, xtPropertyGrid, xtSlider, xtSpacer, xtSplitButton, xtStatusBar, xtTabPanel, xtTreePanel, xtViewPort, xtWindow, xtToolbar, xtTBButton, xtTBFill, xtTBItem, xtTBSeparator, xtTBSpacer, xtTBSplit, xtTBText, xtMenu, xtColorMenu, xtDateMenu, xtMenuBaseItem, xtMenuCheckItem, xtMenuItem, xtMenuSeparator, xtMenuTextItem, xtForm, xtCheckBox, xtCheckBoxGroup, xtCombo, xtDateField, xtDisplayField, xtField, xtFieldSet, xtHidden, xtHTMLEditor, xtLabel, xtNumberField, xtRadio, xtRadioGroup, xtTextArea, xtTextField, xtTimeField, xtTrigger, xtChart, xtBarChart, xtCartesianChart, xtColumnChart, xtLineChart, xtPieChart)
*ExtContainer, defaultType, (ExtComponentXType)
*ExtDomElement, defaultUnit, (CSSUnit)
Expand Down
72 changes: 36 additions & 36 deletions ExtJSWrapper/ExtToPascal.dsk
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,29 @@ File_14=TSourceModule,'E:\extpascal\ext-4.1.1a\src\window\MessageBox.js',0,1,867

[Modules]
Module0=A:\ExtPascal\ExtJSWrapper\ExtToPascal.dproj
Module1=A:\ExtPascal\ExtJSWrapper\ExtFixes.txt
Module2=A:\ExtPascal\ExtJSWrapper\Ext.pas
Module1=A:\ExtPascal\ExtPascal.pas
Module2=A:\ExtPascal\ExtJSWrapper\ExtFixes.txt
Module3=A:\ExtPascal\ExtJSWrapper\ExtFixes3.txt
Module4=A:\ExtPascal\ExtPascal.pas
Module4=A:\ExtPascal\ExtJSWrapper\Ext.pas
Module5=A:\ExtPascal\ExtPascalUtils.pas
Count=6
EditWindowCount=1

[A:\ExtPascal\ExtJSWrapper\ExtToPascal.dproj]
ModuleType=TBaseProject

[A:\ExtPascal\ExtJSWrapper\ExtFixes.txt]
ModuleType=TSourceModule

[A:\ExtPascal\ExtJSWrapper\Ext.pas]
[A:\ExtPascal\ExtPascal.pas]
ModuleType=TSourceModule
FormState=0
FormOnTop=0

[A:\ExtPascal\ExtJSWrapper\ExtFixes.txt]
ModuleType=TSourceModule

[A:\ExtPascal\ExtJSWrapper\ExtFixes3.txt]
ModuleType=TSourceModule

[A:\ExtPascal\ExtPascal.pas]
[A:\ExtPascal\ExtJSWrapper\Ext.pas]
ModuleType=TSourceModule
FormState=0
FormOnTop=0
Expand Down Expand Up @@ -76,9 +76,9 @@ BorlandEditorCodeExplorer=BorlandEditorCodeExplorer@EditWindow0
TopPanelSize=0
LeftPanelSize=0
RightPanelSize=0
BottomPanelSize=1578
BottomPanelSize=1600
BottomPanelClients=DockSite1,MessageView
BottomPanelData=0000080001000100000009000000446F636B5369746531724500000000000000E5090000000000000100000000724500000F0000004D65737361676556696577466F726DFFFFFFFF
BottomPanelData=0000080001020100000009000000446F636B536974653172450000000000000240060000000000000100000000724500000F0000004D65737361676556696577466F726DFFFFFFFF
BottomMiddlePanelSize=0
BottomMiddlePanelClients=DockSite0,GraphDrawingModel
BottomMiddelPanelData=0000080001020200000009000000446F636B536974653010000000477261706844726177696E67566965779A1D00000000000002F206000000000000FFFFFFFF
Expand All @@ -87,7 +87,7 @@ TabDockLeftClients=DockSite2=0
[View0]
CustomEditViewType=TEditView
Module=A:\ExtPascal\ExtJSWrapper\ExtToPascal.dpr
CursorX=1
CursorX=3
CursorY=15
TopLine=1
LeftCol=1
Expand All @@ -98,9 +98,9 @@ EditViewName=A:\ExtPascal\ExtJSWrapper\ExtToPascal.dpr
[View1]
CustomEditViewType=TEditView
Module=A:\ExtPascal\ExtJSWrapper\ExtFixes.txt
CursorX=25
CursorY=77
TopLine=62
CursorX=1
CursorY=89
TopLine=84
LeftCol=1
Elisions=
Bookmarks=
Expand All @@ -109,9 +109,9 @@ EditViewName=A:\ExtPascal\ExtJSWrapper\ExtFixes.txt
[View2]
CustomEditViewType=TEditView
Module=A:\ExtPascal\ExtJSWrapper\ExtFixes3.txt
CursorX=1
CursorY=73
TopLine=51
CursorX=27
CursorY=93
TopLine=76
LeftCol=1
Elisions=
Bookmarks=
Expand Down Expand Up @@ -169,19 +169,19 @@ State=0
Left=0
Top=0
Width=3825
Height=1044
Height=1067
MaxLeft=-1
MaxTop=-1
ClientWidth=3825
ClientHeight=1044
ClientHeight=1067
TBDockHeight=211
LRDockWidth=13600
Dockable=1
StayOnTop=0

[Breakpoints]
Count=1
Breakpoint0='E:\extpascal\ExtJSWrapper\ExtToPascal.dpr',747,'',0,1,'',1,0,0,'',1,'','','',0,''
Breakpoint0='E:\extpascal\ExtJSWrapper\ExtToPascal.dpr',750,'',0,1,'',1,0,0,'',1,'','','',0,''

[EmbarcaderoWin32Debugger_AddressBreakpoints]
Count=0
Expand Down Expand Up @@ -237,12 +237,12 @@ State=0
Left=0
Top=23
Width=10000
Height=1322
Height=1344
MaxLeft=-1
MaxTop=-1
ClientWidth=10000
ClientHeight=1322
TBDockHeight=1322
ClientHeight=1344
TBDockHeight=1344
LRDockWidth=2769
Dockable=1
StayOnTop=0
Expand Down Expand Up @@ -297,11 +297,11 @@ State=0
Left=0
Top=0
Width=3825
Height=1044
Height=1067
MaxLeft=-1
MaxTop=-1
ClientWidth=3825
ClientHeight=1044
ClientHeight=1067
TBDockHeight=411
LRDockWidth=4950
Dockable=1
Expand All @@ -316,11 +316,11 @@ State=0
Left=0
Top=0
Width=3825
Height=1044
Height=1067
MaxLeft=-1
MaxTop=-1
ClientWidth=3825
ClientHeight=1044
ClientHeight=1067
TBDockHeight=211
LRDockWidth=7406
Dockable=1
Expand All @@ -339,11 +339,11 @@ State=0
Left=0
Top=0
Width=3825
Height=1044
Height=1067
MaxLeft=-1
MaxTop=-1
ClientWidth=3825
ClientHeight=1044
ClientHeight=1067
TBDockHeight=1533
LRDockWidth=3481
Dockable=1
Expand All @@ -358,11 +358,11 @@ State=0
Left=0
Top=0
Width=3825
Height=1044
Height=1067
MaxLeft=-1
MaxTop=-1
ClientWidth=3825
ClientHeight=1044
ClientHeight=1067
TBDockHeight=2056
LRDockWidth=3481
Dockable=1
Expand Down Expand Up @@ -595,11 +595,11 @@ State=0
Left=0
Top=0
Width=3825
Height=1044
Height=1067
MaxLeft=-1
MaxTop=-1
ClientWidth=3825
ClientHeight=1044
ClientHeight=1067
TBDockHeight=1544
LRDockWidth=8744
Dockable=1
Expand Down Expand Up @@ -688,12 +688,12 @@ State=0
Left=0
Top=23
Width=3825
Height=1322
Height=1344
MaxLeft=-1
MaxTop=-1
ClientWidth=3825
ClientHeight=1322
TBDockHeight=1322
ClientHeight=1344
TBDockHeight=1344
LRDockWidth=3825
Dockable=1
StayOnTop=0
Expand Down
18 changes: 8 additions & 10 deletions ExtPascalSamples/AdvancedTabs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@ constructor TAdvancedTabs.Create;
Handler := Ajax(AddTab);
OnClick := HandleExtButtonClick; // Delphi style event handler
end;
RenderTo := 'body';
ActiveTabNumber := 0;
ResizeTabs := true; // turn on tab resizing
MinTabWidth := 115;
TabWidth := 135;
Width := 600;
Height := 150;
Defaults := JSObject('autoScroll:true');
EnableTabScroll := true;
RenderTo := 'body';
ActiveTab := 0;
Resizable := true; // turn on tab resizing
MinTabWidth := 115;
Width := 600;
Height := 150;
AutoScroll := true;
if Tabs = 0 then
Tabs := 7
else
Expand All @@ -71,7 +69,7 @@ constructor TAdvancedTabs.Create;
SelfSession.AddShowSourceButton(Buttons, 'AdvancedTabs');
end;

procedure TAdvancedTabs.HandleExtButtonClick(This: TExtButton; E: TExtEventObjectSingleton); begin
procedure TAdvancedTabs.HandleExtButtonClick(This: TExtButton; E: TExtDirectEvent); begin
ExtMessageBox.Alert('alert', 'event handled successfully');
end;

Expand Down
Loading

0 comments on commit f169060

Please sign in to comment.