git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2391 8e941d3f-bd1b-0410-a28a-d453659cc2b4

This commit is contained in:
dopi 2012-04-19 15:49:51 +00:00
parent ff6f4c52a7
commit a4c4e60de5
5 changed files with 69 additions and 47 deletions

View File

@ -12,7 +12,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="36" Y="18"/> <CursorPos X="36" Y="18"/>
<UsageCount Value="84"/> <UsageCount Value="86"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
@ -23,7 +23,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="10" Y="8"/> <CursorPos X="10" Y="8"/>
<UsageCount Value="84"/> <UsageCount Value="86"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
<Filename Value="uform1.pas"/> <Filename Value="uform1.pas"/>
@ -34,9 +34,9 @@
<UnitName Value="uForm1"/> <UnitName Value="uForm1"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="24"/> <TopLine Value="40"/>
<CursorPos X="15" Y="35"/> <CursorPos X="60" Y="67"/>
<UsageCount Value="84"/> <UsageCount Value="86"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
</Unit2> </Unit2>
@ -46,27 +46,27 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="uMainForm"/> <UnitName Value="uMainForm"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="29"/> <TopLine Value="90"/>
<CursorPos X="23" Y="36"/> <CursorPos X="17" Y="105"/>
<UsageCount Value="42"/> <UsageCount Value="43"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
<Filename Value="..\tdiclass.pas"/> <Filename Value="..\tdiclass.pas"/>
<UnitName Value="TDIClass"/> <UnitName Value="TDIClass"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="2"/> <EditorIndex Value="2"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="237"/> <TopLine Value="219"/>
<CursorPos X="18" Y="249"/> <CursorPos X="51" Y="233"/>
<UsageCount Value="42"/> <UsageCount Value="43"/>
<Bookmarks Count="3"> <Bookmarks Count="3">
<Item0 X="17" Y="728" ID="3"/> <Item0 X="17" Y="728" ID="3"/>
<Item1 X="1" Y="687" ID="1"/> <Item1 X="3" Y="649" ID="2"/>
<Item2 X="3" Y="649" ID="2"/> <Item2 X="68" Y="227" ID="1"/>
</Bookmarks> </Bookmarks>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit4> </Unit4>
@ -99,7 +99,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="23" Y="5"/> <CursorPos X="23" Y="5"/>
<UsageCount Value="26"/> <UsageCount Value="27"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit8> </Unit8>
<Unit9> <Unit9>
@ -166,7 +166,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="17" Y="9"/> <CursorPos X="17" Y="9"/>
<UsageCount Value="39"/> <UsageCount Value="40"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit15> </Unit15>
<Unit16> <Unit16>
@ -424,7 +424,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="697"/> <TopLine Value="697"/>
<CursorPos X="3" Y="708"/> <CursorPos X="3" Y="708"/>
<UsageCount Value="13"/> <UsageCount Value="14"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit48> </Unit48>
<Unit49> <Unit49>
@ -497,7 +497,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="132"/> <TopLine Value="132"/>
<CursorPos X="1" Y="154"/> <CursorPos X="1" Y="154"/>
<UsageCount Value="12"/> <UsageCount Value="13"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
</Unit57> </Unit57>
@ -526,7 +526,7 @@
<General> <General>
<ActiveWindowIndexAtStart Value="0"/> <ActiveWindowIndexAtStart Value="0"/>
</General> </General>
<JumpHistory Count="25" HistoryIndex="24"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="..\tdiclass.pas"/> <Filename Value="..\tdiclass.pas"/>
<Caret Line="606" Column="1" TopLine="594"/> <Caret Line="606" Column="1" TopLine="594"/>
@ -627,6 +627,26 @@
<Filename Value="umainform.pas"/> <Filename Value="umainform.pas"/>
<Caret Line="40" Column="48" TopLine="29"/> <Caret Line="40" Column="48" TopLine="29"/>
</Position25> </Position25>
<Position26>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="244" Column="27" TopLine="237"/>
</Position26>
<Position27>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="210" Column="70" TopLine="196"/>
</Position27>
<Position28>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1" Column="1" TopLine="40"/>
</Position28>
<Position29>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="227" Column="73" TopLine="214"/>
</Position29>
<Position30>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="721" Column="17" TopLine="706"/>
</Position30>
</JumpHistory> </JumpHistory>
</ProjectSession> </ProjectSession>
</CONFIG> </CONFIG>

View File

@ -48,8 +48,8 @@ procedure TForm1.Edit2Exit(Sender : TObject) ;
begin begin
if Edit2.Text = '' then if Edit2.Text = '' then
begin begin
Label1.Caption := 'Edit2 cant be empty'; Label1.Caption := 'Edit2 cannot be empty';
ShowMessage( 'Edit2 cant be empty' ); ShowMessage( 'Edit2 cannot be empty' );
Edit2.SetFocus; Edit2.SetFocus;
end ; end ;
end; end;
@ -65,7 +65,7 @@ begin
if Edit2.Text = '' then if Edit2.Text = '' then
begin begin
CanClose := False; CanClose := False;
ShowMessage( 'Remember... Edit2 cant be empty' ); ShowMessage( 'Remember... Edit2 cannot be empty' );
Edit2.Text := 'Ok, fixed'; Edit2.Text := 'Ok, fixed';
end ; end ;
fMainForm.mEvents.Lines.Add( 'Form1.CloseQuery: '+BoolToStr(CanClose,'True','False') ); fMainForm.mEvents.Lines.Add( 'Form1.CloseQuery: '+BoolToStr(CanClose,'True','False') );

View File

@ -32,13 +32,13 @@ object fMainForm: TfMainForm
Top = 0 Top = 0
Width = 587 Width = 587
TabStop = False TabStop = False
ActivePage = TabSheet2 ActivePage = TabSheet1
Align = alClient Align = alClient
Constraints.MinHeight = 300 Constraints.MinHeight = 300
Constraints.MinWidth = 500 Constraints.MinWidth = 500
Images = ImageList1 Images = ImageList1
MultiLine = True MultiLine = True
TabIndex = 1 TabIndex = 0
TabOrder = 1 TabOrder = 1
OnChange = TDINoteBook1Change OnChange = TDINoteBook1Change
Options = [nboShowCloseButtons, nboMultiLine, nboKeyboardTabSwitch, nboShowAddTabButton] Options = [nboShowCloseButtons, nboMultiLine, nboKeyboardTabSwitch, nboShowAddTabButton]
@ -2277,8 +2277,8 @@ object fMainForm: TfMainForm
end end
object MainMenu1: TMainMenu object MainMenu1: TMainMenu
Images = ImageList1 Images = ImageList1
left = 206 left = 504
top = 69 top = 400
object MenuItem1: TMenuItem object MenuItem1: TMenuItem
Caption = 'Forms' Caption = 'Forms'
object miForm1: TMenuItem object miForm1: TMenuItem
@ -2298,8 +2298,8 @@ object fMainForm: TfMainForm
end end
end end
object ImageList1: TImageList object ImageList1: TImageList
left = 320 left = 416
top = 72 top = 400
Bitmap = { Bitmap = {
4C69060000001000000010000000000000000000000000000000000000000000 4C69060000001000000010000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000

View File

@ -16,6 +16,7 @@
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<Version Minor="1"/>
<Files Count="3"> <Files Count="3">
<Item1> <Item1>
<Filename Value="tdiclass.pas"/> <Filename Value="tdiclass.pas"/>

View File

@ -207,8 +207,8 @@ begin
end end
else else
begin begin
{ No LastActiveControle ? Ok, if current Screen control isn't on Tab, { No LastActiveControle ? Ok, if current Screen control isn't in TabSheet,
go to first Control on Tab... } go to first Control on TabSheet... }
if not Self.ContainsControl( Screen.ActiveControl ) then if not Self.ContainsControl( Screen.ActiveControl ) then
Self.SelectNext( Self, True, True); Self.SelectNext( Self, True, True);
end end
@ -224,7 +224,7 @@ begin
// Adjusting AForm Border Style and Align // // Adjusting AForm Border Style and Align //
fsFormInPage.BorderStyle := bsNone ; fsFormInPage.BorderStyle := bsNone ;
//fsFormInPage.Align := alClient ; //fsFormInPage.Align := alClient ; // This will be done in OnResizeTDIPage
// Change Form Parent to the Page // // Change Form Parent to the Page //
fsFormInPage.Parent := Self; fsFormInPage.Parent := Self;
@ -233,7 +233,7 @@ begin
// Show the Form // // Show the Form //
fsFormInPage.Visible := True ; fsFormInPage.Visible := True ;
// Saving the ActiveControl on the Form // // Saving the current ActiveControl in the Form //
fsLastActiveControl := fsFormInPage.ActiveControl; fsLastActiveControl := fsFormInPage.ActiveControl;
end ; end ;
@ -242,17 +242,15 @@ procedure TTDIPage.Notification(AComponent : TComponent ; Operation : TOperation
begin begin
inherited Notification(AComponent, Operation) ; inherited Notification(AComponent, Operation) ;
if (fsFormInPage <> nil) and if (Operation = opRemove) and (AComponent = fsFormInPage) then
(Operation = opRemove) and fsFormInPage := nil;
(AComponent = fsFormInPage) then
fsFormInPage := nil;
end ; end ;
procedure TTDIPage.OnResizeTDIPage(Sender : TObject) ; procedure TTDIPage.OnResizeTDIPage(Sender : TObject) ;
begin begin
if not Assigned(fsFormInPage) then exit ; if not Assigned(fsFormInPage) then exit ;
{ If Form has MaxConstrains and doesn't fit all the Screen, Centralize on { If Form has MaxConstrains and doesn't fill all the Screen, Centralize on
TabSheet } TabSheet }
if (fsFormInPage.Width < Width) and (fsFormInPage.Height < Height) then if (fsFormInPage.Width < Width) and (fsFormInPage.Height < Height) then
begin begin
@ -287,7 +285,7 @@ begin
FTabsMenuItem := nil; FTabsMenuItem := nil;
FTDIActions := TTDIActions.Create; FTDIActions := TTDIActions.Create;
{ This is ugly, I know... but I didn't find a best solution to restore Last { This is ugly, I know... but I didn't found a best solution to restore Last
Focused Control of TDIPage } Focused Control of TDIPage }
FTimerRestoreLastControl := TTimer.Create(Self); FTimerRestoreLastControl := TTimer.Create(Self);
FTimerRestoreLastControl.Enabled := False; FTimerRestoreLastControl.Enabled := False;
@ -300,7 +298,7 @@ begin
if Assigned( FCloseBitBtn ) then if Assigned( FCloseBitBtn ) then
FCloseBitBtn.Free ; FCloseBitBtn.Free ;
{ // Don't Destroy MenuItens... They will be destroyed by MainMenu // { // Don't Destroy Menu Items... They will be destroyed by MainMenu //
if Assigned( FCloseMenuItem ) then if Assigned( FCloseMenuItem ) then
FCloseMenuItem.Free ; FCloseMenuItem.Free ;
@ -345,7 +343,7 @@ begin
if Self.Owner is TWinControl then if Self.Owner is TWinControl then
FCloseBitBtn.Parent := TWinControl(Self.Owner) ; FCloseBitBtn.Parent := TWinControl(Self.Owner) ;
// Seting Image to FCloseBitBtn //; // Setting Image to FCloseBitBtn //;
if Assigned( Images ) and (FTDIActions.CloseTab.ImageIndex > -1) then if Assigned( Images ) and (FTDIActions.CloseTab.ImageIndex > -1) then
begin begin
Images.GetBitmap( FTDIActions.CloseTab.ImageIndex, FCloseBitBtn.Glyph ); Images.GetBitmap( FTDIActions.CloseTab.ImageIndex, FCloseBitBtn.Glyph );
@ -441,6 +439,9 @@ procedure TTDINoteBook.SetBackgroundImage(AValue : TImage) ;
begin begin
if FBackgroundImage = AValue then Exit ; if FBackgroundImage = AValue then Exit ;
FBackgroundImage := AValue ; FBackgroundImage := AValue ;
if Visible then
DrawBackgroundImage;
end ; end ;
procedure TTDINoteBook.SetBackgroundCorner(AValue : TTDIBackgroundCorner) ; procedure TTDINoteBook.SetBackgroundCorner(AValue : TTDIBackgroundCorner) ;
@ -501,7 +502,7 @@ begin
Visible := (PageCount > 0); Visible := (PageCount > 0);
// Checking for Close Buttom visibility // // Checking for Close Button visibility //
if (FCloseTabButtom <> tbNone) then if (FCloseTabButtom <> tbNone) then
begin begin
if Visible then if Visible then
@ -514,7 +515,7 @@ begin
if FTabsMenuItem <> nil then if FTabsMenuItem <> nil then
FTabsMenuItem.Visible := Visible ; FTabsMenuItem.Visible := Visible ;
// Drawing Back ground Image // // Drawing Background Image //
if Visible then if Visible then
DrawBackgroundImage; DrawBackgroundImage;
end ; end ;
@ -617,7 +618,7 @@ Var
I : Integer ; I : Integer ;
NewMenuItem : TMenuItem ; NewMenuItem : TMenuItem ;
begin begin
// Removing MenuItens until find Separator '-' // // Removing Menu Items until find Separator '-' //
NewMenuItem := FTabsMenuItem.Items[0] ; NewMenuItem := FTabsMenuItem.Items[0] ;
while (NewMenuItem.Caption <> '-') do while (NewMenuItem.Caption <> '-') do
begin begin
@ -626,7 +627,7 @@ begin
NewMenuItem := FTabsMenuItem.Items[0] ; NewMenuItem := FTabsMenuItem.Items[0] ;
end ; end ;
// Inserting on MenuItens existing Tabs // // Inserting on Menu Items for existing Tabs //
for I := PageCount-1 downto 0 do for I := PageCount-1 downto 0 do
begin begin
NewMenuItem := TMenuItem.Create(FTabsMenuItem); NewMenuItem := TMenuItem.Create(FTabsMenuItem);
@ -678,7 +679,7 @@ begin
control focus. This may occurs in TWinControl.OnExit Validation } control focus. This may occurs in TWinControl.OnExit Validation }
Self.SetFocus; Self.SetFocus;
{ If steel on same ActiveControl, maybe Focus Control was traped on { If still on same ActiveControl, maybe Focus Control was trapped on
some OnExit Validation } some OnExit Validation }
Result := ( AWinControl <> Screen.ActiveControl ); Result := ( AWinControl <> Screen.ActiveControl );
end ; end ;
@ -699,13 +700,13 @@ begin
CheckInterface; CheckInterface;
{ {
// This doesn't work on Win32, Focus Control always go to first control on Page // // This doesn't work on Win32, Focus always go to first control on Page //
if FRestoreActiveControl then if FRestoreActiveControl then
if (ActivePage is TTDIPage) then if (ActivePage is TTDIPage) then
TTDIPage( ActivePage ).RestoreLastFocusedControl; TTDIPage( ActivePage ).RestoreLastFocusedControl;
} }
// This is a ulgy work around.. but it works :) // // This is a ugly workaround.. but it works :) //
FTimerRestoreLastControl.Enabled := True; FTimerRestoreLastControl.Enabled := True;
end ; end ;