Diu King,Tiong
|
|
Group: Forum Members
Posts: 43,
Visits: 264
|
Hi Trent,
Thanks for your help and your solution did solved my problem.
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
I have had some of the same frustrations with combos in the past as well. At present, we inherit from the standard .NET combo and then have enhanced it. However, one thing that is difficult for a combo is the read-only state. By default, as you well know, there is not a read-only state like there is a textbox. This is something that is high on my list to change in a future release. There is one option for you, though, that could get you going today. You can OwnerDraw the combo. This really isn't as hard as it sounds. I would do the following: - Create your own ComboBox class
- Inherit from MicroFour.StrataFrame.UI.Windows.Forms.ComboBox
- Add a "ReadOnly" property
- When this property is set to True at run-time you could then OwnerDraw the combo
At present, this is really the only sure way to get it working the way that you like. Your scenario is something that I ran into recently myself and is something that is already on the "to-do" list for a future SF release.
|
|
|
Diu King,Tiong
|
|
Group: Forum Members
Posts: 43,
Visits: 264
|
Hi Greg,
I want is when BO is edited, combobox in disabled mode. Combobox just will enabled and editable when BO in new row record added.
For example:
Private Sub MaintenanceFormToolStrip1_ItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MaintenanceFormToolStrip1.ItemClicked If e.ClickedItem.Text = "Edit" Then Textbox25.ReadOnly = True
*** I want combobox become disable when ItemClicked = Edit is clicked**********
'ComboBox11.DropDownStyle = ComboBoxStyle.DropDownList 'ComboBox12.DropDownStyle = ComboBoxStyle.DropDownList 'ComboBox12.Enabled = False End If End Sub
Regards
|
|
|
Greg McGuffey
|
|
Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
Ah, didn't understand that part. Well, then you need a combo. I'm not quite sure how what you want is different than what a combobox normally does. Normally, if you allow the BO to manage the UI, it is disabled until the BO is edited. When disabled it shows whatever value is currently selected. When edited, the drop down now works and the user can enter values into the control. How is what you want different than this?
|
|
|
Diu King,Tiong
|
|
Group: Forum Members
Posts: 43,
Visits: 264
|
Hi Greg,
How if i only want my combobox to be read-only when my menutoolstrip's itemclicked = Edit? But when menutoolstrip's itemclicked is not equal to Edit, i still allow user to choose item at combobox.
regards
|
|
|
Greg McGuffey
|
|
Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
A better choice might be to not use a combo, but rather to use a text box. There are several options, from easy/ugly to elegant with some work - Hide the combo, drop a text box on, and in the navigated event of the form, set the text boxes text to that of the Text of the combo. - Add a custom bindable field to the BO for the text shown in the combo (I can help you with this if you need it), then bind this custom field to the textbox on the form. - Create a custom control that can be filled like a combo, but only shows the text of the bound ID. This would be some work, but very cool.
|
|
|
Diu King,Tiong
|
|
Group: Forum Members
Posts: 43,
Visits: 264
|
Hi Greg,
I want my combobox just for display record only (read-only). Users are not allow to input any text and not able to drop it down.
regards
|
|
|
Greg McGuffey
|
|
Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
Just to be clear, you want to select the text in the box and also be able to drop it down?
|
|
|
Diu King,Tiong
|
|
Group: Forum Members
Posts: 43,
Visits: 264
|
Hi Trent,
Yes, I just want combobox a read-only look while not being editable. I did tried on enabled property but it not work.
Please advice
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
I assume that the Enabled property does not meet your needs? If not, is it because you just want a read-only look while not being editable?
|
|
|