IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1822.20 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-06-15
Pages: < Prev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Next >
[17:00]<svzz[wjzc]> goddamn i HATE the .NET Comboboxes... why aren't they as simple as VB6's
[17:01]<mjzymygo>because VB6's were based on a technology called thunderforms and were not real windows combo box's.
[17:01]<svzz[wjzc]>i don't find how to fill them with item while preserving the combobox empty (text==""), and because of that i don't find a suitable event that will trigger then the user click an item or writes the item and press enter
[17:01]<mjzymygo>.NET's are more powerful and sit on top of real MFC based combo's
[17:02]<mjzymygo>Staz: download reflector disassemble it and examine how the code works. you may be suprised
[17:02]<svzz[wjzc]>about what?
[17:03]<mjzymygo>By examining the code, you will learn how the combo box's work internally which in turn could make your ife easier.
[17:03]<mjzymygo>you have been in this room so often about combo box's that I am supried you haven't triedto figure out by now why the combo works in the manner it does.
[17:03]<svzz[wjzc]>it's the third time i ask about em!
[17:04]<mjzymygo>exactly ;) *grins* so they must be really frustrating you to all hell...
[17:04]<mjzymygo>by now i'd have torn the object appart
[17:04]<mjzymygo>but then, I ain't that patient
[17:04]<svzz[wjzc]>well personnally i don't see ANY logical reason why "filling" a combox Items collection would change the SelectedValue
[17:05]<mjzymygo>you would find out if you looked at the code that generates it
[17:05]<drdyrrrq>looking at the code in reflector won't tell you much about the combo box... or indeed much about winforms.
[17:05]<drdyrrrq>being that they are thin wrappers over the win32 api
[17:06]<mjzymygo>damieng: in this case it would.
[17:07]<drdyrrrq>it doesn't sit on top of mfc
[17:08]<mjzymygo>damieng: I know it doesn't... I was over simplying =)
[17:08]<mjzymygo>wrongly perhaps
[17:08]<mjzymygo>but either way, this line in in the COmboBox's Text property: string text1 = base.GetItemText(this.SelectedItem);
[17:09]<mjzymygo>so reset the items would wipe the selecteditem value. which is why Staz is having the problem
[17:09]<svzz[wjzc]>nope
[17:09]<mjzymygo>(in part)
[17:09]<svzz[wjzc]>the object is newly created it does not have a value
[17:09]<svzz[wjzc]>if it had a value and i was clearing the items collection i would understand
[17:09]<svzz[wjzc]>but now the value is null, so i don'T
[17:09]<bfjrvnmup>is a Hashtable With Function Pointers Better than a Switch ?!
[17:09]<mjzymygo>staz: ..."well personnally i don't see ANY logical reason why "filling" a combox Items collection would change the SelectedValue"
[17:10]<mjzymygo>because it wipes it...
[17:10]<svzz[wjzc]>yeah... sorry, should have specified that filling and refilling are different :P
[17:10]<svzz[wjzc]>what do you mean it wipes ?
[17:11]<jjxgdjn1o9>Hey guys, I'm having a weird "protection level" issue
[17:11]<mjzymygo>all the 'selected' info gets wiped
[17:11]<jjxgdjn1o9>I've got a private struct defined inside a class
[17:11]<jjxgdjn1o9>I have a private method trying to return a new instance of the struct in that class
[17:11]<jjxgdjn1o9>but it's not letting me do it?
[17:11]<mjzymygo>thats because the struct is private
[17:11]<jjxgdjn1o9>" is inaccessible due to its protection level"
[17:11]<jjxgdjn1o9>yes, but so is the method ?
[17:11]<svzz[wjzc]>Moridin8 but why does it get wiped, and what does get wiped since all the "selected" info is completely inexistant since it has been set yet
[17:11]<mjzymygo>and the code outside has no idea what your trying to feed it
[17:12]<mjzymygo>Staz; no idea, but the answer is in the code ;)
[17:12]<mjzymygo>that level of info is in the code anyway.
[17:12]<jjxgdjn1o9>Am I just confusing access here, doesn't private struct mean accessible only inside the namespace declared in?
[17:13]<mjzymygo>JohnDoe... post up an example in pastbin or nomorepasting or something ;)
[17:13]<jjxgdjn1o9>ok one sec
[17:14]<drdyrrrq>if you want to re-load or preserve selection then just record the text/item/ before loading and restore the text or item selection post load. end of story. whats the big deal.
[17:14]<mjzymygo>damieng: yeh... good point...
[17:14]<drdyrrrq>we've got plenty of code here that just does a;
[17:14]<jjxgdjn1o9>http://pastebin.com/710743
[17:14]<drdyrrrq>object previousSelectedItem = combo.SelectedItem;
[17:14]<mjzymygo>Staz: whats stopping you from inheriting combo and hiding the functionality that keeps the values you require
[17:15]<drdyrrrq>combo.Items.Clear();
[17:15]<drdyrrrq>foreach(Blah blah in blahCollectoin) { combo.Items.Add(blah); }
[17:15]<drdyrrrq>if (blahCollection.Contains(previousSelectedItem) combo.SelectedItem = previousSelectedItem;
[17:15]<mjzymygo>JohnDoe: and the error occurs where?
[17:16]<jjxgdjn1o9>line 49
[17:16]<vxyzmly2z>what's the difference between txtTOEStd.Text and base.txtTOEStd.Text
[17:16]<jjxgdjn1o9>thirdLibr: the former will try to call the method from the subclass first
[17:16]<drdyrrrq>base will get the property from the base class instead of it's own
[17:16]<mjzymygo>John: the structs ctor: public StandardResponse(ushort commandId, byte[] payload)
[17:16]<mjzymygo> {
[17:16]<mjzymygo>=O)
[17:17]<jjxgdjn1o9>Moridin8: huh?
[17:17]<mjzymygo>third: saves a heap call
[17:17]<vxyzmly2z>hmm
[17:17]<mjzymygo>JohnDoe... make the structs contructor public
[17:17]<jjxgdjn1o9>Moridin8: i never had to write public in friont of a ctor before
[17:17]<mjzymygo>really?
[17:17]<drdyrrrq>JohnDoe "internal" is per the assembly "private" is within it's containing class
[17:18]<vxyzmly2z>but the txtTOEFire is defined in the same class. is it still more efficient?
[17:18]<jjxgdjn1o9>well in a class anyways.. good call man
[17:18]<jjxgdjn1o9>damieng2: heh thats what i thought, problem was the ctor didnt have public
[17:18]<jjxgdjn1o9>thanks!! it compiles now
[17:18]<mjzymygo>well, considering C# defaults everything to private, i am suprised
[17:18]<drdyrrrq>yeah but it won't go much further.
[17:18]<drdyrrrq>nothing will be able to call ReceiveStandard because a. It's private and b. It returns a private struct
[17:18]<drdyrrrq>(well, apart from other methods in LJhelper)
[17:19]<jjxgdjn1o9>when you're returning a struct is it correct to use "new" ? I thought that allocated memory from the heap
[17:19]<mjzymygo>a struct is technically a heap object... it inherits ValueObject behind the scenes
[17:19]<jjxgdjn1o9>damieng2: if you had noticed, it is returning raw byte data.. it will be used inside of my class by other public methods to parse it into something more useful
[17:19]<drdyrrrq>no, a struct is a stack object.
[17:19]<drdyrrrq>a class is a heap object.
[17:19]<jjxgdjn1o9>so how come i am using "return new..." instead of "return ..."
[17:20]<vxznrm_>what's the normal english word used for online shops: shopping cart, shopping basket, .. ?
[17:20]<drdyrrrq>because what 'new' does is dependent on whether it's a reference (class) or value (struct) type.
[17:20]<jjxgdjn1o9>thread_: shopping cart
[17:20]<vxznrm_>thanks
[17:20]<mjzymygo>Damieng: I treats structs and classes no differently.
[17:20]<drdyrrrq>if it's a reference type, runtime heap allocation. if it's a value type then compile-time stackframe allocation.
[17:20]<mjzymygo>I = IL
[17:21]<jjxgdjn1o9>damieng2: but thats so counterintuitive.. if its on the stack already, why use "new" ? "new" is traditionally for allocating memory
[17:21]<mjzymygo>John: .class public auto ansi sealed beforefieldinit ArgIterator
[17:21]<mjzymygo> extends System.ValueType
[17:21]<mjzymygo>
[17:21]<jjxgdjn1o9>Moridin8: doesnt matter, the fact that its a value type means its stored on the stack
[17:21]<mjzymygo>all a struct is in an object that inherits ValueType. so it would require new and is IS placed on the heap
[17:22]<jjxgdjn1o9>btw im just complaining about syntax dont mistake me for not understand the difference
[17:22]<mjzymygo>only system native types defined within the CLR are not







