Welcome! Log In Create A New Profile

Advanced

WB 17: Splitter

Posted by Piet van Zanten 
Piet van Zanten
WB 17: Splitter
February 04, 2013 02:59PM
Hi,

As an addition to the little splitter project Michael Drechsler initiated, there's now a possibility to store the splitter position. You can download it here.
Because the splitting is all done in browser code the server does not "know" what position the splitter has.
So we need some Ajax to pass it to the server.
I created a server procedure, Ajax enabled, as follows:
PROCEDURE Save_SplitterPos(nPos)
INIWrite("store","splitter",NumToString(nPos),fExeDir()+"\settings.ini")
The storing is done in an ini file for simplicity reasons, but you may want to change that to a database or any other more convenient way.
When the page is closed, we call this Ajax procedure in the browser Unload (on unload) code:
AJAXExecute(Save_SplitterPos,BTN_Splitter..X)
When the page is called we need to read (in the page global declarations or initialization code) the last position of the splitter:
nSplitterPos=Val(INIRead("store","splitter","0",fExeDir()+"\settings.ini"))
nSplitterPos is a global int.
Now in the onload (browser) code of the page we set the splitterpos and do a call to the Move_Splitter procedure:
IF nSplitterPos<>0 THEN
   bMoving=True  //set the global boolean to true to enable the move
   Move_Splitter(nSplitterPos)  //do the move
   bMoving=False //reset the global boolean to false to stop move mode.
END
CELL_Left..Height=ZONE_Body..Height-10
CELL_Right..Height=ZONE_Body..Height-10
CELL_Right..Width=ZONE_Body..Width-CELL_Left..Width-50
That's it, happy developping,

Piet



Edited 1 time(s). Last edit at 02/05/2013 12:44AM by Piet van Zanten.
Allard
Re: WB 17: Splitter
May 23, 2017 10:36PM
Do you still have the splitter? The link doesnot work anymore


regards

Allard
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: