Jump to content

TuniScrollbox -> ScrollTo -> howto in TuniFrame?


erich.wanker

Recommended Posts

Hello ..

if i put a TuniScrollbox on Mainform - i can scrollto TOP with Javascript very simple ... 

UniSession.AddJS(uniScrollbox.JSName+'.getTargetEl().scrollTo(''Top'', 0, true);');

but if the scrollbox is in a TuniFRAME ???  how can i do that ?

 

 

  • on Mainform - i have a TuniContainerpanel.name = display  (as area for the TuniFrames)
  • the frame is             Tf_start = class(TUniFrame)
  • in the frame i have the uniscrollbox called :  groundscroller

 

 

i tested a lot of combinations IN TF_START  .. but no luck :-(

procedure Tf_start.starte_animation;
begin

//UniSession.AddJS(groundscroller.JSName+'.getTargetEl().scrollTo("top");');
//UniSession.AddJS('f_start.'+groundscroller.JSName+'.getTargetEl().scrollTo("left");');
//UniSession.AddJS('MainForm.'+groundscroller.JSName+'.getTargetEl().scrollBy(0,0, false);');
//UniSession.AddJS('MainForm.display.'+groundscroller.JSName+'.getTargetEl().scrollTo(''Top'', 0, true);');

 

i show a frame with:

procedure TMainForm.InsertFrame1(Name: string); // NAVIGATION
begin
  if FFrameName1 <> '' then
    FreeAndNil(FCurrentFrame1);
  FFrameName1 := Name;
  FCurrentFrame1 := TUniFrameClass(FindClass(Name)).Create(self);
  FCurrentFrame1.Align := alClient;
  FCurrentFrame1.Parent := display;
end;

 

  • Like 2
Link to comment
Share on other sites

Hello Sherzod ... found the solutio... ThanX for offer for  help...

Hello mikromundo ...

nice greetings from Austria.

2 Things:

1. nice UI .. what Font do you use?

2. I found the solution:

In Mainform i use now:  if FFrameName1 = 'Tf_start' then UniSession.AddJS((MainForm.FCurrentFrame1 as Tf_start).groundscroller.JSName+'.getTargetEl().scrollTo(''Top'', 0, true);');
 

in Frame - i have a TUniScrollBox .. Align = alClient ... Margins.Right = 20

all components are on this TUniScrollBox  ...in some situations (resolution change, screen orientation change..) i must refresh the TUniScrollBox ... and in this case where is a Scrollto TOP  VERY important .. and now it works..

 

Nice to hear from you about your used Fontname ;-)

ThanX

Erich

Link to comment
Share on other sites

4 minutes ago, erich.wanker said:

Olá  Sherzod  ... encontrei a solutio ... ThanX para oferta de ajuda ...

Olá  mikromundo  ...

boas saudações da Áustria.

2 coisas:

1. boa interface do usuário .. o tipo de letra que você usa?

2. Eu encontrei a solução:

Em Mainform eu uso agora: if FFrameName1 = 'Tf_start' então UniSession.AddJS ((MainForm.FCurrentFrame1 como Tf_start) .groundscroller.JSName + '. GetTargetEl (). ScrollTo (' 'Top' ', 0, true);');
 

no quadro - eu tenho um TUniScrollBox .. Alinhar = alClient ... Margins.Right = 20

todos os componentes estão neste TUniScrollBox ... em algumas situações (mudança de resolução, mudança de orientação da tela ..) devo atualizar a TUniScrollBox ... e neste caso onde é um Scrollto TOP MUITO importante .. e agora funciona ..

 

É bom saber de você sobre o seu Fontname usado ;-)

ThanX

Erich

I'm interested, can you give me an example?

Link to comment
Share on other sites

Hello eduardo ..

 

This is a demo User-Interface

Works on Desktop, Tablet, mobile...

The basic is the Mainform ... and in this form i show a lot of different TuniFrames..

Call a Frame:

procedure TMainForm.InsertFrame1(Name: string); // NAVIGATION
begin
  if FFrameName1 <> '' then
    FreeAndNil(FCurrentFrame1);
  FFrameName1 := Name;
  FCurrentFrame1 := TUniFrameClass(FindClass(Name)).Create(self);
  FCurrentFrame1.Align := alClient;
  FCurrentFrame1.Parent := display;
end;

in the TuniFrame i use a TuniSrollbox as parent for all controls.. if i resize the Browser - i start:

procedure TMainForm.starte_animation;

begin

if FFrameName1 = 'Tf_start' then
begin
(MainForm.FCurrentFrame1 as Tf_start).mein_display.height := 0;
UniSession.AddJS((MainForm.FCurrentFrame1 as Tf_start).groundscroller.JSName+'.getTargetEl().scrollTo(''Top'', 0, true);');
end;

...


and the animation of the used Panels (Array of Panels) i made with:

    unisession.AddJS(meine_panels[x].JSName + '.animate({  duration: ' + inttostr(speed) + ', to: { x: ' + inttostr(tx) + ', y: ' + inttostr(ty) + '}});');

 

Thats all :-)

 

HTH

Erich

  • Upvote 2
Link to comment
Share on other sites

Yes - i can 

.. but i hope (all users who use this...) are also sharing additional ideas, better coding and other functions ;-) .... i suggest this Tread for updates and uploads...

 

Full Version:  mo2020.zip

 

Additional Informations:

in this version - where is a " new BroadcastChannel" - idea embeeded .. :blink2:      (i am very proud!) :rolleyes:

I use this technic to communicate between Android-App and UNIGUI .... 

A Simple Android App (with just a TWebbrowser to show my UniGui-dll) sends - if the user clicks on AndroidHardwareBack - a information via BroadcastChannel to the UniGui-BrowserApp ... the Browser App converst the BroadcastChannel-Information into a Ajax-Event .. and the UniGui reacts on the Ajax-Event

Demonstation:

The Android App calls my UniGui-dll ... shows it in a TWebBrowser ... and if user clicks on "AndroidHardwareBack" - the uniGui reacts ...

(the last click in the video at 0:10  is the "AndroidHardwareBack"-click..)

 

 

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...