Custom Possizer - Keep checkbox checked
Author: llhk
Creation Date: 8/7/2012 10:51 PM
profile picture

llhk

#1
I am writing my own possizer, now I got a problem that my value in the textbox is keeping the same when i revisit this possizer, but the checkbox isn't. I found that the official Possizer, e.g "Position Options", the <max open positions> button (checkbox) keeps checked once clicked.

May I ask how to do so? As I don't want to re-check the box every time for just changing part of the value in my possizer.

Thanks
profile picture

Eugene

#2
Check out the API Guide on creating PosSizers, and you shall find the answer under "Persisting Custom Settings".

Make sure you downloaded the MS123.PosSizers demo solution from the Wiki that demonstrates how to use ICustomSettings to persist the state of all GUI input elements.
profile picture

llhk

#3
Yes, I did see this part and edited my own which bases on the demo. Here are the code:

CODE:
Please log in to see this code.


this._max_open_checked is the bool which holds the value for the checkbox. And my possizer inherits from "BasicPosSizer".

But only the textbox value is kept, not the checkbox.
profile picture

Eugene

#4
Keep in mind that this is just a part of the puzzle.

Like the included ScriptBasedPctEq.cs class illustrates, your PosSizerSettingsBase (when your PosSizer derives from BasicPosSizer) or your UserControl (when inheriting from PosSizer) must have a property to set/get the checkbox state.
profile picture

llhk

#5
Yes, I successfully did it as you told me, thank you Eugene.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).