' LblDblClk is a Door library Event
LblDblClk.New1(Label.Control,"DoubleClick")
...
Sub LblDblClk_NewEvent
Msgbox("Double Click")
End Sub
Sorry, sloppy phraseology. I meant that an external objects with an event added by the Door library they can't be identified in that event except by the name of the new event.You say that "In general you do need a separate event Sub for each LinkLabel because they are external library objects." I guess you are referring to the new event (doubleclick).
No. I'm afraid this is getting a bit complicated for a simple brief explanation but you got the right idea below. If a control already supports an event then you can always identify the control as it raises the event itself and correctly sets Sender even if you wire several to a common event using AddEvent instead of the normal automatic event Sub assignment. If you add a "missing" event with the Door library you can't identify the control by Sender (except by association with the new event object) as it is the new event object that raises the event and sets Sender.Also implicit in your quote is that I could use just one sub for ordinary labels - correct? If so, that still doesn't solve the problem of identifying the sending label.
Nice idea! I overlooked that possibility.Using linklabel's click event I can set a global variable (CurLabel) equal to the sender, and then retrieve that information in the new double click event.
That is the behaviour I would expect because you are reusing the same event object each time. On NEW it should be disposed and recreated. That looks a bit like a bug in IDE, I'll point Erel at it.but when compiled only the last control activates the double click event.
I think it is telling you to use thisLLDblClick1.New1(Control("Label1","LinkLabel").Control,"DoubleClick")
etc. This works fine in the IDE, but when attempting to compile, I get an error "Unknown control type. Use Control("_main_lldblclick1,Type) instead."
That's a bug in LinkLabel (which I didn't writeIf the single click event is not created, when compiled I get an "Unhandled exception" error when a label is clicked.
Sub App_Start
For i = 1 To 3
AddObject("Label" & i,"LinkLabel")
Control("Label" & i,"LinkLabel").New1("Form1",35,45*i,33,33)
Control("Label" & i,"LinkLabel").BackColor = cWhite
Control("Label" & i,"LinkLabel").fontsize = 6
Control("Label" & i,"LinkLabel").text = "Lbl " & i
Control("Label" & i,"LinkLabel").underline = False
AddEvent ("Label" & i,Click,"LLclick")
If i > 1 Then LLDblClick.Dispose
AddObject("LLDblClick","Event")
LLDblClick.New1(Control("Label" & i,"LinkLabel").Control,"DoubleClick")
Next i
Form1.Show
End Sub
Sub App_Start
For i = 1 To 3
AddObject("Label" & i,"LinkLabel")
Control("Label" & i,"LinkLabel").New1("Form1",35,45*i,33,33)
Control("Label" & i,"LinkLabel").BackColor = cWhite
Control("Label" & i,"LinkLabel").fontsize = 6
Control("Label" & i,"LinkLabel").text = "Lbl " & i
Control("Label" & i,"LinkLabel").underline = False
AddEvent ("Label" & i,Click,"LLclick")
AddObject("LLDblClick" & i,"Event")
Control("LLDblClick" & i, Event).New1(Control("Label" & i,"LinkLabel").Control,"DoubleClick")
AddEvent("LLDblClick" & i, NewEvent, "LLDblClick_NewEvent")
Next i
Form1.Show
End Sub
I like that :icon_clap:Control("tree" & i, TreeView).Node will be equal to:
TreeView("tree" & i).Node
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?