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

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

Code Samples & Tips Share your recent discoveries and ideas with other users.

Enhanced ComboBox / Listbox

Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 02-10-2009, 07:33 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Hi Rioven,

Thank's for the bug report.

I modified the btnInsert_Click routine that way:
Code:
<font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Sub </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">btnInsert_Click</font></font>
</font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">If</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2"> SelI=-</font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">1 </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">Then</font></font></font></font></font></font></font></font></font>
<font size=
"2"><font face="Courier New"><font size="2"><font face="Courier New">SelI=</font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">0</font></font></font>
</font></font></font></font></font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">End </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">If</font></font></font>
</font></font></font></font></font></font><font face=
"Courier New"><font size="2"><font face="Courier New"><font size="2">cbxTest.Insert(SelI,txtTest.Text)</font></font>
<font size=
"2"><font face="Courier New">lbxTest.Insert(SelI,txtTest.Text)</font></font>
<font size=
"2"><font face="Courier New">cbxTest.SelectedIndex=SelI</font></font>
<font size=
"2"><font face="Courier New">lbxTest.SelectedIndex=SelI</font></font>
</font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">End Sub</font></font></font></font></font></font></font></font></font>
Attached the modified code.

Besr regards.

EDIT: Removed code, new one in post #15.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide

Last edited by klaus : 02-20-2009 at 10:03 AM.
Reply With Quote
  #12 (permalink)  
Old 02-19-2009, 04:03 PM
Newbie
 
Join Date: Jan 2009
Location: Switzerland
Posts: 1
Default Entering text in combo boxes

Entering text in combo boxes is not supported. Using the Door library this can be achieved. Here is the code:

ocmb.New1(False)
ocmb.FromControl("cmbCategory")
ocmb.SetProperty("DropDownStyle", "DropDown")

That's it.
Rainer
Reply With Quote
  #13 (permalink)  
Old 02-19-2009, 04: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 Rainer View Post
Entering text in combo boxes is not supported. Using the Door library this can be achieved
I never thought of that! I wonder why the default is different on the desktop and the device?
Reply With Quote
  #14 (permalink)  
Old 02-19-2009, 04:55 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

To make it really useful lets add some events. Obj1 is a Door library Object, cboKeyPress and cboTextChanged are Door library events
Code:
    Obj1.FromControl("Combobox1")
Obj1.SetProperty(
"DropDownStyle""DropDown")
cboKeyPress.New1(Obj1.Value, 
"KeyPress")
cboTextChanged.New1(Obj1.Value, 
"TextChanged")

Sub cboKeyPress_NewEvent
Obj1.Value = cboKeyPress.Data
keychar = Obj1.GetProperty(
"KeyChar")
'Msgbox(keychar, "Key press")
If Asc(keychar) = 13 Then
    Obj1.FromControl(
"Combobox1")
         
Msgbox(Obj1.GetProperty("Text"), "Enter!")
End If    
End Sub

Sub cboTextChanged_NewEvent
Obj1.FromControl(
"Combobox1")
combotext = Obj1.GetProperty(
"Text")
End Sub
Reply With Quote
  #15 (permalink)  
Old 02-20-2009, 08:42 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Hallo Rainer,
Very good !
I remembered that in VB there was a choice for ComboBox styles, but didn't find your 'trick'.

Hello Andrew,
I am also wondering why the default style is different between desktop and device.

Just as a reminder, the ComboBox.Text property does exist in Basic4PPC even though it is not listed in the help file. Even in DropDownList style it is redable in on both desktop and device.

I have updated the example code, with the choice of the 2 styles.

Best regards.
Attached Files
File Type: zip ComboBoxTest.zip (2.0 KB, 68 views)
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
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
Enhanced form controls digitaldon37 Questions (Windows Mobile) 1 11-21-2008 07:17 AM
Listbox and enter key tsteward Questions (Windows Mobile) 2 10-14-2008 06:30 AM
How to fix ListBox Items? Stellaferox Questions (Windows Mobile) 12 02-22-2008 09:50 AM
Listbox difficulties. dan kabestan Questions (Windows Mobile) 2 12-15-2007 06:24 PM
listbox = arraylist ? sloopa Questions (Windows Mobile) 1 05-07-2007 12:38 PM


All times are GMT. The time now is 10:25 PM.


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