Forum > LCL
[SOLVED] Custom TPanel bar
Pe3s:
Hello forum users, it is possible to add properties similar to trackbar or progressbar
Min, Max and Position ?
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Panel2MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);var NewX, Max: Integer;begin if not(ssLeft in Shift) then Exit; NewX := X + Panel2.Left; Max := Panel1.ClientWidth - Panel2.Width; if NewX < 0 then NewX := 0; if NewX > Max then NewX := Max; Panel2.Left := NewX;end;
KodeZwerg:
You can add anything as a property, your class need to take care of that of course.
Pe3s:
One more question how do I have to modify the code to move the slider to the end to 100%
KodeZwerg:
I do not know your class code of that custom panel thingy.
When you adding properties for min/max/position, than the position setter should calculate the sliders left drawing position,
root of calculation would be "client width (where the slider is drawn into) - slider width = 100%"
Based on that you know where "Position" is inside the min/max range.
Pe3s:
These are two TPanel objects, the code is in the first post, how do I correct the code to add Min, Max and Position
Navigation
[0] Message Index
[#] Next page