Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WebDev Solutions
Beiträge im Thema:
2
Erster Beitrag:
vor 4 Jahren, 11 Monaten
Letzter Beitrag:
vor 7 Monaten, 4 Wochen
Beteiligte Autoren:
Allard, Piet van Zanten

WB 17: Splitter

Startbeitrag von Piet van Zanten am 04.02.2013 13:59

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

Antworten:

Do you still have the splitter? The link doesnot work anymore


regards

Allard

von Allard - am 23.05.2017 20:36
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.