ComboBox and Drawing buttons causing program to lock

  • Thread starter Thread starter Stu
  • Start date Start date
S

Stu

Hi all,

VS.NET 2003, CF SP2, Dell Axim X5 (PPC2002, WM2003) 300Mhz

In my project, I've found several points where I get fairly constant
lockups during execution. The first is when drawing buttons (color buttons
in SP2, custom class defined for this in SP1 - same results), if I do them
one at a time with a forced pause of about a second between each one, I
never see the lockup, but when allowing the program to run at normal speeds,
I get a program lockup nearly every time after the first button has been
drawn or refreshed.

I have also found that while scrolling a list of items in the combo box I
get the same lockup nearly 80% of the time. I've tried limiting the number
of characters displayed with no effect (other than having shorter text
strings in the combo box list).

The only thing I've found that these two items have in common, is that
they are both placed inside of panels rather than directly on the form.
Should they be referenced differently because of this? I can post some
generic code specifics, but I'm not trying to do anything fancy or out of
the norm, especially with the combo boxes.

Thanks much! This one has all of us stumped.

Stu Wells
 
You're not doing any GUI updates from a different thread
by any chance are you?

-Alex
 
Alex,

Not at all. All the GUI functions happen in the main thread. There is a
TCP/IP listen thread that's started when these are happening, but commenting
out that thread has no effect on the problem.

Stu
 
Could you show some code?

-Alex
-----Original Message-----
Alex,

Not at all. All the GUI functions happen in the main thread. There is a
TCP/IP listen thread that's started when these are happening, but commenting
out that thread has no effect on the problem.

Stu



.
 
Here is the relivant code for the combo boxes including how they are defined
and placed in the Windows Form Designer Code. :-) Thanks! :-)

#Region " Windows Form Designer generated code "
....snip..
Friend WithEvents cmbDefect As System.Windows.Forms.ComboBox
Friend WithEvents cmbFix As System.Windows.Forms.ComboBox
Private Sub InitializeComponent()
....snip...
Me.pnlClose = New System.Windows.Forms.Panel
Me.cmbFix = New System.Windows.Forms.ComboBox
Me.cmbDefect = New System.Windows.Forms.ComboBox
Me.pnlClose.Controls.Add(Me.cmbFix)
Me.pnlClose.Controls.Add(Me.cmbDefect)
'cmbFix
'
Me.cmbFix.Location = New System.Drawing.Point(8, 96)
Me.cmbFix.Size = New System.Drawing.Size(208, 22)
Me.cmbFix.Visible = False
'
'cmbDefect
'
Me.cmbDefect.Location = New System.Drawing.Point(8, 32)
Me.cmbDefect.Size = New System.Drawing.Size(208, 22)
Me.cmbDefect.Visible = False
....snip...
Public Sub parse(ByVal data As String)
Dim message() As String = Split(data, "|")
'Data is a retun list of commands and info from a server
Case "DLIST"
Dim Index As Int16
Dim list As String = ""
cmbDefect.Items.Clear()
cmbFix.Items.Clear()
cmbDefect.Enabled = False
For Index = 1 To Up
cmbDefect.Items.Add(Mid(message(Index), 1, 25))
Next
lblDefect.Visible = True
cmbDefect.Visible = True
lblStatus.Text = "Got Defect List, Please select defect"
cmbDefect.Enabled = True
Case "FLIST"
cmbFix.Enabled = False
cmbFix.Items.Clear()
Dim Index As Int16
For Index = 1 To Up
cmbFix.Items.Add(Mid(message(Index), 1, 25))
Next
lblrepair.Visible = True
cmbFix.Enabled = True
cmbFix.Visible = True

....snip...
 
So, where's your "parse" method is called from?
And what exactly the place your program "locks"?

-Alex
 
Alex,

"parse" is called from the TCP/IP Listen thread when data from the server
comes in, with the message being an array of items split from the datastring
recieved from the serve.

The program locks when trying to select an item in the cmbFix or
cmbDefect, opening or scrolling down the list of items to be precise. If
you get as far as selecting an item, that combo box goes on to do it's
thing. I'm almost convinced that this is something to do with a bug in the
system regarding drawing to the screen, but then again, I truly am a newbe
with VS.NET for CF.

Stu
 
Stu

I'm 99.9% convinced that your problem is what I asked you in the very first question. "TCP/IP Listen thread" is still a different from UI thread you MUST use Control.Invoke to update it

HTH... Ale


----- Stu wrote: ----

Alex

"parse" is called from the TCP/IP Listen thread when data from the serve
comes in, with the message being an array of items split from the datastrin
recieved from the serve

The program locks when trying to select an item in the cmbFix o
cmbDefect, opening or scrolling down the list of items to be precise. I
you get as far as selecting an item, that combo box goes on to do it'
thing. I'm almost convinced that this is something to do with a bug in th
system regarding drawing to the screen, but then again, I truly am a newb
with VS.NET for CF

St
 
Alex,

I've concentrated on the combo boxes since I found a work around for the
lockups that happens when the buttons are drawn or redrawn, and I have
verifed that removing the listen thread code shows no improvment on those.
That being said, can you point me to a FAQ or HOW TO on threading and
Control.Invoke? I have to admit I'm rather new to manually contolling
threads and will be happy to give anything a try.

Thanks again!

Stu
Alex Yakhnin said:
Stu,

I'm 99.9% convinced that your problem is what I asked you in the very
first question. "TCP/IP Listen thread" is still a different from UI thread
you MUST use Control.Invoke to update it.
 
Alex,

Seems that you were correct! Wish the reference manuals I had on CF were
correct for the usage of Control.Invoke, but a google of this newsgroups
archives answered my questions.

Thanks for your help, sorry I misunderstood your question the first time
around, would of saved us both a bit of time. I'm sure that as this and
other PPC projects come up, I'll have more questions.

Stu

Alex Yakhnin said:
Stu,

I'm 99.9% convinced that your problem is what I asked you in the very
first question. "TCP/IP Listen thread" is still a different from UI thread
you MUST use Control.Invoke to update it.
 
Back
Top