Jump to content
Xtreme .Net Talk

liquid8

Avatar/Signature
  • Posts

    31
  • Joined

  • Last visited

Everything posted by liquid8

  1. Well, I did a seperate test adding the controls dynamically, then attaching the events, and it works fine, so I will just have to bang my head against the wall till i figure out what in my code is causing the prob ;) I will post when I figure out what I'm doing wrong.. Just a note, I am not using a seperate class for the handlers on the test, so somethings going on in there.. liquid8 ********** Found It ********** It was getting incorrect values from the XML. Anyways, my coding was incorrect for searching the XML, and it was basically retrieving the same information for every event.. thereby it was doing everything, just not changing.. Thanks guys, liquid8
  2. Ive run all the way through many times and it seems to be getting the correct values for the 2nd control that is added, I see no difference between that and the 1st one. I think it has something to do with the sender but i just can't figure it out.... an important bit of info i left out, the SkinnedItem class adds a Label to itself (i needed to use a panel for certain reasons, but I also needed to change the offset of the label from the panels BG image... best way i could figure to do it) anyways.. so maybe the sender is confusing the two... still, I had that problem before, and all it did was just change the properties of the Label to the SkinnedItems properties.. that being said, when i break on the mouse event, it is showing that the sender is SkinnedItem, so I dunno... thanks guys, liquid8
  3. ItemCollection is a collection of strings with names for a new control, newPage is a Form, and SkinnedItem is a Class which inherits a panel, and has a few extra properties Here is the initial adding of the controls Dim strInfo As String 'Add each Item to the page For Each strInfo In itemCollection Dim newItem As New SkinnedItem() 'Set Item Properties newItem.Name = strInfo newItem.SetItemProps(newItem, strInfo) newItem.Initialize 'Add the Button newPage.Controls.Add(newItem) Next This is the code in the initialize method for a SkinnedItem which attaches the events Public Sub Initialize() AddHandler Me.MouseEnter, AddressOf Mouse_Enter AddHandler Me.MouseLeave, AddressOf Mouse_Leave AddHandler Me.MouseUp, AddressOf Mouse_Up AddHandler Me.MouseDown, AddressOf Mouse_Down End Sub Here is the SetItemProps method Public Sub SetItemProps(ByVal Item As Object, ByVal ItemName As String, optional EventName as string) Select Case EventName Case "onmouseenter" Item.BackgroundImage = Image.FromFile("C:\temp\image1.jpg") End Select End Sub And here is the Event Code Public Sub Mouse_Enter(ByVal sender As Object, ByVal e As System.EventArgs) If sender.GetType.Name.ToString = "SkinnedItem" Then SetItemProps(sender, sender.name, "onmouseenter") End If End Sub I had to simplify some of the code, to make it understandable as I am reading all the properties for each event from an xml file, but if you don't see anything in this... I could attach the project. Thanks a bunch, liquid8
  4. This one is really baffling me.. My project adds controls in a For Next loop at startup, each control when added has AddHandlers specified to link the mouse events to that control. I then pass the event that is called to a function which sets the properties of that control.. so now I can change the image or text properties for each event. Here's the problem. I call the Setproperties function when the control is originally created, and then each time an event is called. The first control that is added works fine, it responds to all events, and sets the properties for each. Every control after that, when it is originally added it sets the properties, but does not set them when the events occur. The events are however firing, it's just not setting the properties for the event. Any ideas as to why this might be happening? I am sure this might be confusing, and I can add the code when I get home, but it's been bothering me all day! :) Thanks in advance, liquid8
  5. looks a bit more difficult than i thought.. i'll look more into the collectionbase.. thanks for steering me in the right direction. LiQuiD8
  6. I have been trying to find out how exactly you can embed classes/methods to get the following line to be processed: Pages(1).Buttons(1).Add How would a basic class look for this? Or would you have to create a Namespace? I was trying to do something like: Class Pages Class Buttons Property Add() End Property End Buttons End Class But I don't see a way or can't pass an index to a Class, can I? Basically, I want properties within properties or methods within methods.. Thanks in advance, liquid8
×
×
  • Create New...