Jump to content

Recommended Posts

Posted

Hello,

 

a litte problem in WebMode ;-)

 

i need the height of the top-located "not visible area" of the scrollbox, when i scroll down ..

 

As Example: 

If i scroll 200 Pixles in the Scrollbox down - where can i find the value "200" ?

 

 

 

 

 

 

 

Posted

Hello. Semper,

 

thanx for your answer... with the suggested script, i can scroll the Scrollbox ..

 

BUT i need the possition of the scrollable area IN the scrollbox ;-)

 

As example:

 

  • Mainform with uniScollbox1.align = alClient
  • in the uniScrollbox1 - i have a uniPanel.height:= 3000; (top and left are 0 referenced to the scrollbox
  • in uniPanel i have a uniButto.

 

If i want to showmodal a small form on the left side of the uniButton -  i need the coordinate of the Button

 

myUniForm.top:=  uniScrollbox1.top + uniButton1.top + uniButton1.height is WRONG... this works just correct, if the scrollbox is scrolled to the top ...

 

i must subtract the scroled area ... but where can i find the value ?

 

Thanx

Posted

Can anyone tell me, how i can use this information ...

 

 

element.scrollTop - is the pixels hidden in top due to the scroll. With no scroll its value is 0.

element.scrollHeight - is the pixels of the whole div.

element.clientHeight - is the pixels that you see in your browser.

 

 

 

the value of scrollTOP is the value i need (i hope)   ..  my uniScrollbox is named: "hauptscrollbox" and it is on my MainForm

 

how can i do this in delphi ?

Posted
Hi Erich.
 
Try this method:
 
.... uses uniGUIApplication, ....
 
1. Create a global variable or local... :  ( or you can, not use a variable. Further in the post StrToInt(Params.Values['Top']); )
 
scrTop: Integer;
2. In the event onClick button write code like this:
    ...my uniScrollbox is named: "hauptscrollbox"...

 

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  // Here should be only a line of code:
  UniSession.AddJS ('ajaxRequest (' + UniButton1.JSName + ','' scrollboxTop'', ['' Top ='' + document.getElementById ("' + hauptscrollbox.JSName + '_id-body").scrollTop]);' );
end;
3. In the event onAjaxEvent button write the following code:
 
procedure TMainForm.UniButton1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TStrings);
begin
  // All logic, onclick button
  if (EventName = 'scrollboxTop') Then begin
    scrTop := StrToInt(Params.Values['Top']);
    ShowMessage(IntToStr(scrTop));
  end;
end;
 
Sincerely ...
Posted

error when copy / paste

 

incorrect:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
// Here should be only a line of code:
UniSession.AddJS ('ajaxRequest (' + UniButton1.JSName + ','' scrollboxTop'', ['' Top ='' + document.getElementById ("' + hauptscrollbox.JSName + '_id-body"). ScrollTop]);' );
end;

 

correct:

procedure TMainForm.UniButton1Click(Sender: TObject);

begin
// Here should be only a line of code:
UniSession.AddJS ('ajaxRequest (' + UniButton1.JSName + ','' scrollboxTop'', ['' Top ='' + document.getElementById ("' + hauptscrollbox.JSName + '_id-body").scrollTop]);' );
end;

 

corrected: ScrollTop --- scrollTop

Posted

Hello duser ...:-)  thank you very very much for your help .

 

i have a litte Problem with the ajaxEvent  ... it would be very nice if you can take an eye on  following code :-)

 

the Showmessage -> Error in Browser:  "undefined" is not a valid integer

 

the html code of the scrollbox:

O20=new Ext.Panel({id:"O20_id",layout:"absolute",bodyBorder:false,header:false,border:0,width:800,height:2000,x:0,y:0,autoScroll:true,bodyStyle: "background-color:#C0C0C0",style:"border:none;"});O20.nm="O20";_cdo_("hauptscrollBox",O20,null,MainForm);O10.add(O20);

Browser debugging text 1:

ajaxRequest (O7A,'scrollboxTop', ['Top='+document.getElementById("O20_id-body").ScrollTop]);

Browser debugging text 2:

Ajax=1&IsEvent=1&Obj=O7A&Evt=click&This=O7A&E=undefined&_S_ID=RGf8YKY7deYcLv8&_seq_=4

the OnClick code:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  // Here should be only a line of code:
  UniSession.AddJS ('ajaxRequest (' + UniButton1.JSName + ',''scrollboxTop'', [''Top=''+document.getElementById("'+hauptscrollbox.JSName+'_id-body").ScrollTop]);' );
end;

 

the AjaxEvent code:

procedure TMainForm.UniButton1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TStrings);
begin
  // All logic, onclick button
  if (EventName = 'scrollboxTop') Then begin
    //ShowMessage(Params.Values['Top']);
    unimainmodule.scrTop := StrToInt(Params.Values['Top']);
    ShowMessage(IntToStr(unimainmodule.scrTop));
  end;
end;

thnak you very much for your engage

 

nice greetings from Salzburg

Erich

Posted

error when copy / paste

 

incorrect:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
// Here should be only a line of code:
UniSession.AddJS ('ajaxRequest (' + UniButton1.JSName + ','' scrollboxTop'', ['' Top ='' + document.getElementById ("' +hauptscrollbox.JSName + '_id-body"). ScrollTop]);' );
end;

 

correct:

procedure TMainForm.UniButton1Click(Sender: TObject);

begin
// Here should be only a line of code:
UniSession.AddJS ('ajaxRequest (' + UniButton1.JSName + ','' scrollboxTop'', ['' Top ='' + document.getElementById ("' + hauptscrollbox.JSName + '_id-body").scrollTop]);' );
end;

 

corrected: ScrollTop --- scrollTop

Posted

Hello duser,

 

thanx .. now the error didn't come ... but (sorry) i get always "0" as value .. i can scroll up and down - always "0" ... any suggestions ?

 

Thank you

Erich

Posted

Hi Erich.

Sorry, I think, here again the same error on copy / paste

Delete all the spaces inside the quotes!

UniSession.AddJS ('ajaxRequest (' + UniButton1.JSName + ','' scrollboxTop'', ['' Top ='' + document.getElementById ("' + hauptscrollbox.JSName + '_id-body"). scrollTop]) ; ')

1. '' scrollboxTop'' = ''scrollboxTop''
2. '' Top ='' = ''Top=''

correct:
UniSession.AddJS ('ajaxRequest (' + UniButton1.JSName + ',''scrollboxTop'', [''Top='' + document.getElementById ("' + hauptscrollbox.JSName + '_id-body").scrollTop]) ; ')


best regards...

  • Upvote 1

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...