Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Can ComboBox be setted as readonly?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-24-2007, 11:39 AM
Junior Member
 
Join Date: Jun 2007
Posts: 16
Default Can ComboBox be setted as readonly?

I need a readonly ComboBox(user can select items,but can not edit or del the word),is it possible?
Reply With Quote
  #2 (permalink)  
Old 10-24-2007, 11:46 AM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default

I was under the impression that the combobox is read-only?
See this post...
http://www.basic4ppc.com/forum/showt...light=combobox

Regards,
RandomCoder.
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #3 (permalink)  
Old 10-24-2007, 01:19 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by RandomCoder View Post
I was under the impression that the combobox is read-only?
Yes but it is a bit messy as you can type into the ComboBox and doing so resets SelectedIndex.

However (he said with an appropriate flourish!) with my ControlEvents library http://www.basic4ppc.com/forum/additional-libraries/934-controlevents-library.html and an undocumented Text property of the ComboBox

Code:
Sub Globals
    
'Declare the global variables here.    
    CB1index = -1
End Sub

Sub App_Start
    Form1.Show
    CbEvents.New1(
"ComboBox1")
End Sub

Sub ComboBox1_SelectionChanged(I, v)
     CB1index = ComboBox1.SelectedIndex
End Sub

Sub CbEvents_TextChanged
     
If CB1Index >= 0 Then ' AND ComboBox1.SelectedIndex = -1  Then
        ' the user has typed into a selection and so unset SelectedIndex so reset it
        ComboBox1.SelectedIndex = CB1index
        ComboBox1.Text = ComboBox1.Item(ComboBox1.SelectedIndex)
    
Else    
        
' the useR is trying to type into the empty combobox - don't let him!
        ComboBox1.Text = ""
    
End If
End Sub
Reply With Quote
  #4 (permalink)  
Old 10-24-2007, 03:14 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 1,057
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Everyone should remember that the combobox has a different behaviour on the desktop and on the device.
- on the desktop, you are able to write free text into a combobox so that the selectedIndex returns -1
- on the device, it is not possible to "edit" the combobox

This seems to be a difference between .Net and .Net CF.


specci48
Reply With Quote
  #5 (permalink)  
Old 10-24-2007, 03:15 PM
Junior Member
 
Join Date: Jun 2007
Posts: 16
Default

It's a good idea, Thanks a lot.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox Readonly IansResearch Questions (Windows Mobile) 12 12-22-2008 03:12 PM
ComboBox ceaser Questions (Windows Mobile) 2 08-25-2008 03:52 PM
ComboBox Raytracer Italian Forum 3 04-15-2008 04:15 PM
Textbox with ReadOnly,IgnoreKey,TextAlignment Filippo Basic4ppc Wishlist 0 11-17-2007 08:23 PM
Readonly property in the Textbox control bidibulle Basic4ppc Wishlist 14 11-16-2007 08:19 AM


All times are GMT. The time now is 05:38 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0