Jump to content


Photo

PageControl with tab-moving


  • Please log in to reply
12 replies to this topic

#1 MasterEvil

MasterEvil
  • Members
  • 104 posts
  • Location:Germany

Posted 21 April 2006 - 11:26 AM

Hello Boki,

I really miss the option to change the tab order at runtime.
The user needs to drag&drop tabs to a different location.

Would be great to have that wink.gif

greetz
Steffen

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,757 posts
  • Gender:Male

Posted 21 April 2006 - 02:48 PM

Hello Steffen,

I will add this for surre smile.gif

regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 MasterEvil

MasterEvil
  • Members
  • 104 posts
  • Location:Germany

Posted 26 March 2007 - 11:10 PM

Hello Boki,

just wanting to ask for the status on that.
Would be a really nice thing! wink.gif

greetz
Steffen

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,757 posts
  • Gender:Male

Posted 27 March 2007 - 05:38 PM

Hello Steffen,

It is still in progress, I hope that I will finish it soon.

regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 26 June 2007 - 05:56 PM

Try this code:

CODE
procedure TfrmMain.NxPageControl1MouseDown(Sender: TObject;  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if NxPageControl1.GetTabAtPos(X, Y) <> nil then // <---- added by Boki
  begin
    if Button = mbLeft then NxPageControl1.BeginDrag(false, 5);
  end;
end;

procedure TfrmMain.NxPageControl1DragDrop(Sender, Source: TObject; X,   Y: Integer);
var
  ts: TnxTabSheet;
begin
  if (Sender = Source) then
  begin
    ts := TNxPageControl(Sender).GetTabAtPos(X, Y);
    if Assigned(ts) then // <--- added by Boki
      if (ts.PageIndex >= 0) and (ts.PageIndex < TNxPageControl(Sender).PageCount) then
        TNxPageControl(Sender).ActivePage.PageIndex := ts.PageIndex;
  end
end;

procedure TfrmMain.NxPageControl1DragOver(Sender, Source: TObject; X,   Y: Integer; State: TDragState; var Accept: Boolean);
begin
   Accept := Source is TNxPageControl;
end;


#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,757 posts
  • Gender:Male

Posted 12 July 2007 - 01:18 PM

Hello Aim,

I have do some modifications in your code. I hope that now all work fine. Thank you again.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#7 AIM

AIM

    Senior Member

  • Honorable Members
  • PipPip
  • 202 posts

Posted 12 July 2007 - 02:22 PM

I can confirm that your changes fixed the problem. Tab moving works perfectly well now smile.gif

Thanks...

#8 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 04 August 2007 - 04:50 PM

i need it too but prefer it as a built in, in a final release
when will it be?

#9 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 07 August 2007 - 04:40 PM

will this be in the next release?
bcoz i dont see this change in the live update post

#10 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,757 posts
  • Gender:Male

Posted 07 August 2007 - 05:00 PM

Hello Emailaya,

I will not be added yet. Internaly this will be done without standard Drag & Drop.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#11 emailaya

emailaya

    Master Member

  • Members
  • PipPipPipPipPip
  • 984 posts

Posted 07 August 2007 - 05:18 PM

so how will it be?

#12 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,757 posts
  • Gender:Male

Posted 07 August 2007 - 05:25 PM

Hello Emailaya,

It will act similar but without using Drag & Drop, it will draw arrows instead similar to NextGrid columns moving.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#13 bion

bion
  • Members
  • 20 posts
  • Gender:Male

Posted 29 January 2014 - 03:14 PM

Hello Boki,

//Using D2007 and NextSuite 5 1.2014
//Can't find option tab-moving in NxPageControl
//Based on above Drag & Drop suggestion, here is a method for tab-moving with visual feedback of the tab...
//-----------------
//2 global var needed
//first tab is on the form, new tabs are created at runtime (based on count of files...)
var
iLDownMB: integer;
iLDraggingMB : integer;
//-----------------
procedure FocusFirstEntryControl(ContainerToFocus : TWinControl) ;
var
i : integer;
begin
for i := 0 to ContainerToFocus.ControlCount - 1 do
begin
if (ContainerToFocus.Controls[i] is TWinControl) then
begin
TWinControl(ContainerToFocus.Controls[i]).SetFocus;
Break;
end;
end;
end;
//-----------------
procedure TfrmMain.NxPageControl1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
iLDownMB:= 0;
iLDraggingMB := 1;
if (Button = mbLeft) then
begin
iLDownMB:= 1;
iLDraggingMB := 0;
end
else
begin
if (Button = mbRight) then
begin
iLDownMB:= 0;
iLDraggingMB := 1;
end;
end;
end;
//-----------------
procedure TfrmMain.NxPageControl1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (Button = mbLeft) then
begin
iLDownMB:= 0;
iLDraggingMB := 1;
case NxPageControl1.ActivePageIndex of
0 :
begin
// custom code for the first tab ...
end;
else
begin
//focus on the other tabs created at runtime
FocusFirstEntryControl(NxPageControl1.ActivePage);
end;
end;
end;
if (Button = mbRight) then
begin
iLDownMB:= 0;
iLDraggingMB := 1;
// a popup comes here for example
end;
end;
//-----------------
procedure TfrmMain.NxPageControl1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if (NxPageControl1.PageCount > 1) then // do nothing for the first tab = no moving allowed
begin
if (iLDownMB = 1) then
begin
if (iLDraggingMB = 0) then
begin
iLDraggingMB := 1;
case NxPageControl1.ActivePageIndex of
0 :
begin
//
end;
else
begin
if NxPageControl1.GetTabAtPos(X, Y) <> nil then // <---- added by Boki
begin
NxPageControl1.BeginDrag(false, 5);
end;
end;
end;
end;
end;
end;
//-----------------
procedure TfrmMain.NxPageControl1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
var
ts: TnxTabSheet;
begin
//Source = NxPageControl1 --> several PageControls on the form
if (Source = NxPageControl1) and (Sender = Source) then
begin
case TNxPageControl(Sender).ActivePageIndex of
0 :
begin
//nothing allowed for the first tab
Accept := False;
end;
else
begin
Accept := True;
ts := TNxPageControl(Sender).GetTabAtPos(X, Y);
if Assigned(ts) then // <--- added by Boki
if (ts.PageIndex > 0) and
(ts.PageIndex < TNxPageControl(Sender).PageCount) and
(ts.PageIndex <> TNxPageControl(Sender).ActivePage.PageIndex) then
begin
TNxPageControl(Sender).ActivePage.PageIndex := ts.PageIndex;
end;
end;
end;
end
else
begin
//another drag & drop from another component
if (Source = NextGrid1) then
begin
//
end;
end;
end;
//-----------------
procedure TfrmMain.NxPageControl1lDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
if (Source = NxPageControl1) and (Sender = Source) then
begin
case TNxPageControl(Sender).ActivePageIndex of
0 :
begin
//custom method for the first tab
end;
else
begin
FocusFirstEntryControl(NxPageControl1.ActivePage);
end;
end;
end
else
begin
//another drag & drop from another component
if (Source = NextGridMB) then
begin
//
end;
end;
end;
//-----------------

Regards,

Jan Maryssael




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users