erich.wanker Posted August 21, 2013 Posted August 21, 2013 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" ? Quote
Semper Posted August 22, 2013 Posted August 22, 2013 Hi, Maybe it helps http://forums.unigui.com/index.php?/topic/3214-scrolling-the-scroll-box/?hl=scrollbox&do=findComment&comment=14919 Regards Quote
erich.wanker Posted August 22, 2013 Author Posted August 22, 2013 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 Quote
erich.wanker Posted August 22, 2013 Author Posted August 22, 2013 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 ? Quote
Sherzod Posted August 23, 2013 Posted August 23, 2013 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 ... Quote
Sherzod Posted August 23, 2013 Posted August 23, 2013 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 Quote
erich.wanker Posted August 23, 2013 Author Posted August 23, 2013 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 Quote
Sherzod Posted August 23, 2013 Posted August 23, 2013 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 Quote
erich.wanker Posted August 23, 2013 Author Posted August 23, 2013 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 Quote
Sherzod Posted August 24, 2013 Posted August 24, 2013 Hi Erich.Sorry, I think, here again the same error on copy / pasteDelete 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... 1 Quote
erich.wanker Posted August 25, 2013 Author Posted August 25, 2013 PERFECT!!! ...it works fine... thank you very much :-) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.