Page 1 of 1 1
Topic Options
#197585 - 2010-01-29 11:26 PM My ComboBoxes are killing me...
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
 Code:
;~~< OCComboBox >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim $OCComboBox
$OCComboBox = $Panel1.Controls.ComboBox()
$OCComboBox.Size = 173, 21
$OCComboBox.SelectedIndex = -1
$OCComboBox.Location = 496, 35

...

	
	$cmdtxt = "select distinct OrgCode from dbo.SDEUserData"
	$cmd.commandtext = $cmdtxt $rs.open($cmd)
	$rs.MoveFirst
	While Not $rs.eof
		$OC = Trim($rs.fields.item("OrgCode").value)
		If $oc > ''
			$OCComboBox.Items.Add($oc)
		EndIf
		$rs.moveNext
	Loop
	$rs.close
$cn.close


The ComboBox REFUSES to add the items, even though I copied the code from another working script... the output goes to the console instead (I have tried just dumping a dumb value and the same thing happens, so it isn't the data (I assume).

I have 2 and they both do the same thing
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#197586 - 2010-01-30 02:57 AM Re: My ComboBoxes are killing me... [Re: Radimus]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Since this is two distinct snippets of code, I assume they are within the same logical block? You Dim the object, so OCComboBox needs to be relative to the scope of where it's used.

I usually declare these objects as global so I can access them from other functions (data scopes). Just a thought..

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#197587 - 2010-01-30 03:56 AM Re: My ComboBoxes are killing me... [Re: Glenn Barnas]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Originally they were dim'ed, then I globalled them, then I moved them into the same code block... same results.

I'll try them in a seperate script just to see if I'm losing my mind (even more)

I'd paste the whole script but all the form objects would be cumbersome and it reads from a sql DB so it wouldn't work for anyone else regardless.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#197588 - 2010-01-30 10:39 AM Re: My ComboBoxes are killing me... [Re: Radimus]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Rad, in my scripts I do this:
 Code:
$=$OCComboBox.Items.Add($oc)

Because else I also get the output to console.
But this works for me.

Top
#197589 - 2010-01-30 01:21 PM Re: My ComboBoxes are killing me... [Re: Arend_]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
We're back online, so I could check my project code - it uses a loop with
 Code:
$cboTask.AddItem($Val)
to set the values. KF Klassic, but the latest version (2.47.5.0). I get no screen output.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#197590 - 2010-01-30 02:39 PM Re: My ComboBoxes are killing me... [Re: Glenn Barnas]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Glenn, Rad's code is for KixForms .Net.
If not, then thats the reason it doesn't work for him ;\)

Top
#197591 - 2010-01-30 04:15 PM Re: My ComboBoxes are killing me... [Re: Arend_]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Still doesn't work... Gets the screen output

 Code:
;~~< Form1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim $Form1
$Form1 = $System.Form()
$Form1.Size = 407, 395
$Form1.Text = "Form1"
;~~< ComboBox1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim $ComboBox1
$ComboBox1 = $Form1.Controls.ComboBox()
$ComboBox1.Size = 121, 21
$ComboBox1.SelectedIndex = -1

For $a = 1 to 10
	$ = $Combobox1.items.add($a)
Next

$Form1.Show
While $Form1.Visible
	$=Execute($System.Application.DoEvents)
Loop
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#197592 - 2010-01-30 04:22 PM Re: My ComboBoxes are killing me... [Re: Radimus]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
if I do Additem, it works...

$System = CreateObject("KiXtart.System")


(dammit, 3 hours on this and it was something stupid)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#197593 - 2010-01-31 09:32 AM Re: My ComboBoxes are killing me... [Re: Radimus]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
So it was actually "My KiXforms versions are killing me..." ;\)
Top
#197594 - 2010-01-31 02:54 PM Re: My ComboBoxes are killing me... [Re: Arend_]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I had assumed that ASE was doing KF.NET...

That is what I get for ASSUMING
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#197597 - 2010-02-01 09:42 AM Re: My ComboBoxes are killing me... [Re: Radimus]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
For KiXforms.Net I'd suggest to use Benny's KiXforms Designer .Net.
It's free and the best design studio for KiXforms .Net \:\)

Top
#197607 - 2010-02-01 11:29 PM Re: My ComboBoxes are killing me... [Re: Arend_]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
ok... another issue that refuses to work..
 Code:
;~~< ListView3 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Global $ListView3
$ListView3 = $Panel4.Controls.ListView()
$ListView3.Size = 873, 396
$ListView3.View = 1
;~~< ListView3.Columns >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ColCheckBox = $ListView3.Columns.Add
$ColCurrentUser = $ListView3.Columns.Add
$ColCurrentUser.Width = 112
$ColCurrentUser.Text = "Current User"
$ColSerno = $ListView3.Columns.Add
$ColSerno.Width = 115
$ColSerno.Text = "SerialNumber"
$ColModel = $ListView3.Columns.Add
$ColModel.Width = 138
$ColModel.Text = "Model"
$ColAssigned = $ListView3.Columns.Add
$ColAssigned.Width = 115
$ColAssigned.Text = "Assigned To"
$ColOrgCode = $ListView3.Columns.Add
$ColOrgCode.Width = 114
$ColOrgCode.Text = "Assigned OrgCode"
$CoLocation = $ListView3.Columns.Add
$CoLocation.Width = 124
$CoLocation.Text = "Equipment Location"
$ColInvDate = $ListView3.Columns.Add
$ColInvDate.Width = 101
$ColInvDate.Text = "InvDate"
$ListView3.Text = "ListView3"
$ListView3.Location = 0, 0
$ListView3.GridLines = -1
$ListView3.FullRowSelect = -1
$ListView3.CheckBoxes = -1
$ListView3.Dock = 5

...

$count = $ListView3.SelectedItems.Count
	For Each $item in $ListView3.SelectedItems
		;$test = $items.SubItems(1).Text
		$test = $items.SubItems.item(1).Text
	Next


the commented out line will crash if I try using it
The second line "works" but returns nothing
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#197615 - 2010-02-02 01:22 PM Re: My ComboBoxes are killing me... [Re: Radimus]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
 Code:
For Each $Item in $ListView3.SelectedItems
   $test = $Item.SubItems(0).Text
   $=Form1.MsgBox($test,"")
Next

Should work for KiXforms Classic.
Just tested with my own Form.

The 2nd line is for KiXforms .Net.
Which version of KiXforms Classic are you using ?

Top
#197657 - 2010-02-03 10:07 PM Re: My ComboBoxes are killing me... [Re: Arend_]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
ok, next one.. ;\)

How you lengthen the dropdown on a combobox?

Global $ComboBox4
$ComboBox4 = $Panel2.Controls.ComboBox()
$ComboBox4.Size = 121, 21
$ComboBox4.SelectedIndex = -1
$ComboBox4.Location = 162, 37
$ComboBox4.Sorted = -1
$ComboBox4.DropDownStyle = 2
$ComboBox4.DropDownWidth = 120

It only shows about 5 selections, I'd like about 6-10 (there are 20+ items in the list)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#197660 - 2010-02-04 12:09 AM Re: My ComboBoxes are killing me... [Re: Radimus]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Where's Shawn and Benny when you need em? \:\(
Top
#197666 - 2010-02-04 09:36 AM Re: My ComboBoxes are killing me... [Re: Radimus]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Hi Rad,

I used this in the past (thanks to Benny and Shawn) and worked just fine.

 Code:
$ComboBox.MaxDropDownItems = Ubound($array) + 2


I set it to the Ubound of an array of items I want in the ComboBox + 2 because the array start at 0 and I want a blank line at the top. If I set it hardcoded to 20 and there are just 10 items to add in the array then all I get is 12 lines. It does not add the extra blank lines.


Edited by Mart (2010-02-04 09:37 AM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#197672 - 2010-02-04 03:47 PM Re: My ComboBoxes are killing me... [Re: Mart]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
That must be for kf.net, but it did lead me to: http://www.kixforms.org/forum/viewtopic.php?p=3537&highlight=#3537

Damn Canadian Beavers...

Thanks Mart
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#197673 - 2010-02-04 04:00 PM Re: My ComboBoxes are killing me... [Re: Radimus]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Thought you are doing KF.net
It's kinda confusing KF classic or KF.net. I do everything in .net so my classic skills are fading.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#197674 - 2010-02-04 04:12 PM Re: My ComboBoxes are killing me... [Re: Mart]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
So did I, I'm using ASE to build it and by the time I noticed it was in classic it was too much to rebuild it
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1188 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.15 seconds in which 0.082 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org