PDA

View Full Version : FlowLayoutPanel scoll limitation?


PEN
09-11-2009, 07:39 PM
So I have a FlowLayoutPanel that has a label in it. This label can get very very long. We are talking 100,000 pixels wide. Now as it gets wider I can horizontally scroll the FLP up until a point. At a certain point, not sure where that is yet, the scroll bar stops getting smaller and I can't scroll the bar far enough to be able to get to the end of the label. Any idea if I can over ride this?

PEN
09-11-2009, 08:06 PM
And here is something else that is wacky. I just went back to that simple example of the gantt chart that I posted. It uses a label and it works where the flowLayoutPanel fails. How ever, when I drag my mouse along on of the labels that I'm using as a row and get the value of the position of the mouse in x it returns the values up to 32,767 and then become -32,768 and starts to go down as I continue to move to the right. It is like there is a limit to the position of what the mouse will return.

Any solution?

PEN
09-11-2009, 08:45 PM
Just did a test on the first issue and it tied to the second issue. I just set up a mouseMove eventHandler on the label that I'm scaling up to 100000 pixels. And where the scroll bar is stoping is at 32,767 when I place my mouse over the most right side of the label that I can scroll to.

So is this a 32 bit limit? Would 64 get me further? And as it turns on in my simple test I am using a FLP and it is allowing me to scroll all the way to the end. How ever I'm setting it up differently. It is being added directly to a rollout using dotNetControl and not being created as a dotNetObject and added to a tab panel as it is in my final example.

I'll I'm getting is issues with this project. Killing me. I need a C# or VB programmer that can help me out here and some how get past these limits for me. Any takers? as I don't have time to learn it well enough.

MarcoBrunetta
09-11-2009, 08:53 PM
rollout testRoll "TEST" width:520
(
dotNetControl flp_testFLP "flowLayoutPanel" width:500 height:100

ON testRoll OPEN DO
(
flp_testFLP.autoScroll = true

local theLabel = dotNetObject "Windows.Forms.Label"
theLabel.width = 100000
theLabel.backColor = (dotNetClass "System.Drawing.Color").goldenRod
flp_testFLP.controls.add theLabel

fn printMousePos =
(
print (flp_testFLP.controls.item[0].pointToClient flp_testFLP.mousePosition).x
)

dotNet.addEventHandler theLabel "mouseMove" printMousePos
)
)
createDialog testRoll


That works as expected over here, the listener prints out 100000 when I get to the end of the label. I'm on Vista 64 bits and tried with max 2009 and 2010. However doing a quick search on google I found this:

http://www.eggheadcafe.com/forumarchives/NETFrameworkNETWindowsFormscontrols/Oct2005/post24408825.asp

PEN
09-11-2009, 09:12 PM
That is the end of the label not the position of the mouse over the label.
I think it has some thing to do with unitConvertions.

MarcoBrunetta
09-11-2009, 09:20 PM
That is the end of the label not the position of the mouse over the label.
I think it has some thing to do with unitConvertions.

Well... the event is called when I move the mouse over the label, and it prints out the coordinates of the mouse in relation to the label control. It goes all the way from 1 to 100000 as I traverse the label.
The pointToClient method "Computes the location of the specified screen point into client coordinates".

PEN
09-11-2009, 09:31 PM
Ah, I didn't look that close, it must be doing the conversion differently. Works here as well in 32bit. Thanks. I'm thinking that I can do it using the getProperty asDotNetObject:true as well and do the conversion to a long but I haven't quite got that working yet.

PEN
09-11-2009, 09:33 PM
Now the next problem, the scroll bar will not work correctly in my case as the FLP is not a dotNetControl but a dotnetObject that has been added to a splitContainer that is in another flp.

Any solutions to that?

PEN
09-11-2009, 09:43 PM
I'm not having any luck converting the value, complains that the value is to small when I'm in the negative.

PEN
09-11-2009, 10:27 PM
Well this just isn't getting better.

I'm adding a label into the label that we are clicking on. If I set the bounds and then add the label all is fine and it is added any where you click. If I try to move the new label I can't move it past 32767 again and any that are created past that value will pop back to it as soon as you try to set the value. I have tried bounds and location. Interesting thing is you can set the size without a problem.

Any ideas?

Try and move it afterwards by setting the location property on it to a number higher then 32767


rollout testRoll "TEST" width:520
(
dotNetControl flp_testFLP "flowLayoutPanel" width:500 height:100

ON testRoll OPEN DO
(
flp_testFLP.autoScroll = true

theLabel = dotNetObject "Windows.Forms.Label"
theLabel.width = 100000
theLabel.backColor = (dotNetClass "System.Drawing.Color").goldenRod
flp_testFLP.controls.add theLabel

fn printMousePos =
(
print (flp_testFLP.controls.item[0].pointToClient flp_testFLP.mousePosition).x
)
fn mouseDown sender arg=
(
lb=dotNetObject "label"
lb.backColor=(dotNetClass "system.drawing.color").red
-- lb.size=dotNetObject "System.Drawing.Size" 10 10
-- lb.location=dotNetObject "system.drawing.point" (flp_testFLP.controls.item[0].pointToClient flp_testFLP.mousePosition).x 1
lb.bounds=dotNetObject "system.drawing.rectangle" (flp_testFLP.controls.item[0].pointToClient flp_testFLP.mousePosition).x 1 10 10
flp_testFLP.controls.item[0].controls.add lb
)

dotNet.addEventHandler theLabel "mouseMove" printMousePos
dotNet.addEventHandler theLabel "mouseDown" MouseDown
)
)
createDialog testRoll

--Use after clicking and adding a label in the yellow label.
testRoll.flp_testFLP.controls.item[0].controls.item[0].location.x=35000
print testRoll.flp_testFLP.controls.item[0].controls.item[0].location.x

MarcoBrunetta
09-11-2009, 10:53 PM
Damn I'm stucked too. The only think I can think off would be to take a "virtual" approach and create/remove controls within the limited space giving the impression of a larger flowLayoutPanel. Of course just thinking about that gives me nightmares.

PEN
09-12-2009, 03:12 PM
What a pain. Well I might be able to scale and slide the positions of the bars based on a scroll bars position. So I use a scroll bar control instead of the one in the FLP and then just move the bars as I need them. This is way more of a pain but possible. I would also have to store the real values of the bars in the tag property as once they get over 32767 they would not be correct any more. So if I just slide and don't try and add, remove that might work a bit easier. What an incredible pain in the butt. What I have going already works so well and looks so cool and now I have to rip the guts out of it for about the eighth time.

denisT
09-12-2009, 04:42 PM
Just did a test on the first issue and it tied to the second issue. I just set up a mouseMove eventHandler on the label that I'm scaling up to 100000 pixels. And where the scroll bar is stoping is at 32,767 when I place my mouse over the most right side of the label that I can scroll to.

So is this a 32 bit limit? Would 64 get me further? And as it turns on in my simple test I am using a FLP and it is allowing me to scroll all the way to the end. How ever I'm setting it up differently. It is being added directly to a rollout using dotNetControl and not being created as a dotNetObject and added to a tab panel as it is in my final example.

I'll I'm getting is issues with this project. Killing me. I need a C# or VB programmer that can help me out here and some how get past these limits for me. Any takers? as I don't have time to learn it well enough.

32767 (short) is a limit for width and height of controls in Windows. It's not a NET issue. 64-bits will not help you. C# or VB will not help you either. You have to work around. Create a new control with location or size over 32767, copy any properties from old to new, delete old, and add new. It's only one way that I see.

PEN
09-12-2009, 05:11 PM
Thanks Denis, I know that it is a short problem just odd they way we can over ride it one way and not another.

So does any one know how to get a ScrollableControl worked correctly?
First off it will not retain the position that you set it at. It just pops back to the start position. Most mouse events (mouseUp) don't appear to work. I can see that when I first create it that the value goes from 0 to 100 but if I set autoScroll to false set the horizontal min and max values really high then I get something different. First when I touch and slide I get the 0 to 100 value but as soon as I let go the slider changes size and I now get the value going from the min to the max. I can't see a way to set it to do one other other how ever.

My current work around is to use some other control and enable the scroll on it and use the width of the control to set the scale of it.


scrollBar=dotNetObject "system.windows.forms.ScrollableControl"
scrollBar.HorizontalScroll.visible=true
scrollBar.HorizontalScroll.enabled=true
scrollBar.bounds=dotNetObject "system.drawing.rectangle" 0 (splitContainer.panel2.height-20) splitContainer.panel2.width 20
scrollBar.dock=scrollBar.dock.bottom
scrollBar.autoScroll=true

PEN
09-12-2009, 05:25 PM
I see the idea. Just struck me as I was setting up the work around. You have to have a control added to it. I can just stick a label in it and use the width of the label to get the scroll to work as I need.

PEN
09-12-2009, 05:31 PM
Mouse events still don't work correctly:S

denisT
09-12-2009, 05:52 PM
I see the idea. Just struck me as I was setting up the work around. You have to have a control added to it. I can just stick a label in it and use the width of the label to get the scroll to work as I need.

yes, you can change size of a control if it's not higher then 32767, but you can't change a position over 32767... Probably it will be better to have universal method for both move and scale operations.

denisT
09-12-2009, 05:54 PM
Mouse events still don't work correctly:S

what do you use as UI holder? max dialog, rollout floater? net form?

denisT
09-12-2009, 07:18 PM
So does any one know how to get a ScrollableControl worked correctly?


Sorry I missed a point. Why do you prefer to use other ScrollableControl as a replacement for the FlowLayoutPanel's one?

PEN
09-12-2009, 09:22 PM
I need to fake the scrolling as I need to go way past 32767. So now I'm just trying to slide every thing into the visible area as needed. Another problem still remains, when I first launch the UI the scroll bar will set it self at the correct size and allow for scrolling way past that value. I'm doing that by setting a label in the ScrollableControl at the length that I need. I can set the width of that label as wide as I like. If I try and change the width in any way it reverts back to 32767 or under.

So, now I delete the label and readd it ever time I want to scale the time line:S

CGTalk Moderation
09-12-2009, 09:22 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.