Jump to content


Photo

Event OnAfterMoveTab


  • Please log in to reply
11 replies to this topic

#1 mcinternet

mcinternet
  • Members
  • 101 posts
  • Gender:Male

Posted 05 August 2019 - 06:40 PM

Hi,

 

Is it possible to make an event which is fired after a tab is moved?

 

I only need the info, where to place that. I think I can implement it by myself, if I know where.

 

 

kind regards

 

mcinternet

 



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 05 August 2019 - 06:51 PM

Hi,

I will try to add it. It should be easy.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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 mcinternet

mcinternet
  • Members
  • 101 posts
  • Gender:Male

Posted 05 August 2019 - 06:55 PM

Hi,

I will try to add it. It should be easy.

Can you pls. post it here? - I need it really urgent.

 

thx in adv

 

kind regards

 

Jörg alias mcinternet



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 06 August 2019 - 04:17 PM

Hi,

 

You can add it to 

 

procedure TNxPageControl6.SetMoving(const Value: Boolean);
begin
  if Value <> FMoving then
  begin
    FMoving := Value;
    if FMoving then Screen.Cursor := crDrag
      else Screen.Cursor := crDefault;
    DoAfterTabMode; // <--- call to the event
  end;
end;

boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 06 August 2019 - 04:36 PM

It's actually not a good place. It should be inside MouseMove method of PageControl.

 

There is a line:

          ActivePage.Index := NearestTab.Index;
 
I believe this is a place where the event should be.

 


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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.

#6 mcinternet

mcinternet
  • Members
  • 101 posts
  • Gender:Male

Posted 06 August 2019 - 04:52 PM

Hi Boki,

 

I did it here, that´s not good!

 

procedure TNxPageControl6.MouseMove(Shift: TShiftState; X, Y: Integer);
var
  NearestTab: TNxPageSheet6;
begin
  inherited;

  { Ignore while in design state }
  if not (csDesigning in ComponentState) then
  begin

    { Tab Moving code }
    if Assigned(PressedPageTab) and TabMoving then
    begin
      { Already Moving }
      if FMoving then
      begin
        NearestTab := GetTabAtPos(Point(X, Y));
        if NearestTab <> nil then
        begin
    //        WritelnDebug(IntToStr(NearestTab.Index));
          ActivePage.Index := NearestTab.Index;
          DoAfterTabMode;     // Hier eingefügt JB
        end;
        Exit;
      end;

Always, if you move the mouse (pressed), the event pops up

 

regards

 

Jörg alias mcinternet



#7 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 06 August 2019 - 04:58 PM

Hi,

Maybe you can add checking to see if value is the same? Oldindex := ActivePage.Index and NewIndex := NearestTab.Index. I will try to do it also.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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.

#8 mcinternet

mcinternet
  • Members
  • 101 posts
  • Gender:Male

Posted 06 August 2019 - 05:08 PM

I just made tests with new and old index - no successfull results. The event must be fired AFTER moving, when the mousebutton goes up.

 

Regards

 

Jörg alias mcinternet



#9 mcinternet

mcinternet
  • Members
  • 101 posts
  • Gender:Male

Posted 06 August 2019 - 05:41 PM

That seems not to be the right place ?

 

Regards

 

Jörg alias mcinternet



#10 mcinternet

mcinternet
  • Members
  • 101 posts
  • Gender:Male

Posted 06 August 2019 - 05:56 PM

Got it!!!

 

under private:

 

    FAfterTabMoving : TNotifyEvent;
    FOldInt : Integer;
    FNewInt : Integer;
 
Published:
 
property OnAfterTabMoving : TNotifyEvent read FAfterTabMoving write FAfterTabMoving;
 
 
procedure TNxPageControl6.MouseMove(Shift: TShiftState; X, Y: Integer);
var
  NearestTab: TNxPageSheet6;
begin
  inherited;

  { Ignore while in design state }
  if not (csDesigning in ComponentState) then
  begin

    { Tab Moving code }
    if Assigned(PressedPageTab) and TabMoving then
    begin

      { Already Moving }
      if FMoving then
      begin
        NearestTab := GetTabAtPos(Point(X, Y));
        if NearestTab <> nil then
        begin
         // WritelnDebug(IntToStr(NearestTab.Index));
          FNewInt := NearestTab.Index;
          ActivePage.Index := NearestTab.Index;
        end;
        Exit;
      end;

and:

procedure TNxPageControl6.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
  Y: Integer);
begin
  inherited;

  { Change cursor back }
  Moving := False;
  if FOldInt <> FNewInt then DoAfterTabMode;
  FOldInt := 0;
  FNewInt := 0;

For completing this Code (public)

 

procedure TNxPageControl6.DoAfterTabMode;
begin
  if Assigned(FAfterTabMoving) then FAfterTabMoving(self);
end;
 
 
Kind regards
 
Jörg alias mcinternet
 
 
@Boki: pls. implement this property so as it is in the next release  :rolleyes:


#11 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 06 August 2019 - 06:23 PM

Hi Jörg,

 

Problem is that tab is moved even after you don't raise mouse button. Only dragging is stopped after you mouse up.

 

I can have for example 2 events, one when tab is moved and one when moving is done.

 

This will be more correct approach.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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.

#12 mcinternet

mcinternet
  • Members
  • 101 posts
  • Gender:Male

Posted 06 August 2019 - 06:25 PM

oh, then do so  :)

 

many thx

 

Kind Regards

 

Jörg






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users