Toon posts:

[VB6] achterhalen trigger

Pagina: 1
Acties:

Verwijderd

Topicstarter
Hoi,

Een vraag die ik hier een tijdje geleden stelde, heeft een staartje.
[url= [rml][ VB6] unloaden uit ControlArray[/rml]]dit is een link naar de eerdere vraag [/url]
In een groot aantal events kun je geen controls uit een ControlArray unoaden. (zie onder)

De vraag:
Is er een manier om te detecteren of een van die events op het moment afgehandeld wordt?

Even een voorbeeld, want dit was wel erg compact geformuleerd:
Ik heb een Sub die controls unload.
Die Sub kan aangeroepen worden vanuit allerlei plekken in mijn script, waaronder een ComboBox_Click event (Dat mag dus niet).
Kan ik nu in mijn sub detecteren of er een ComboBox_Click event afgehandeld wordt, zodat ik een fout kan voorkomen?

Met een gefundeerd "nee" ben ik ook blij.

Wilde_Bill


'--------------hier de gevallen waarin je niet mag unloaden---------------------------
In some situations you are not allowed to unload a form or a control on a form. This error has the following causes and solutions:

There is an Unload statement in the Paint event for the form or for a control on the form that has the Paint event.
Remove the Unload statement from the Paint event.

There is an Unload statement in the Change, Click, or DropDown events of a ComboBox.
Remove the Unload statement from the event.

There is an Unload statement in the Scroll event of an HScrollBar or VScrollBar control.
Remove the Unload statement from the event.

There is an Unload statement in the Resize event of a Data, Form, MDIForm, or PictureBox control.
Remove the Unload statement from the event.

There is an Unload statement in the Resize event of an MDIForm that is trying to unload an MDI child form.
Remove the Unload statement from the event.

There is an Unload statement in the RePosition or Validate event of a Data control.
Remove the Unload statement from the event.

There is an Unload statement in the ObjectMove event of an OLE Container control.
Remove the Unload statement from the event.
'--------------------------------------

  • P_de_B
  • Registratie: Juli 2003
  • Niet online
Ik mis denk ik helemaal je punt, maar als je niet wilt dat een sub vanuit een bepaalde event aangeroepen wordt zet je de aanroep naar die sub niet in dat event?

Oops! Google Chrome could not find www.rijks%20museum.nl


  • glashio
  • Registratie: Oktober 2001
  • Laatst online: 07:46

glashio

C64 > AMIGA > PC

Verduidelijk het met wat Sample Code.

Je kan idd niet DIT doen :
Visual Basic .NET:
1
2
3
Private Sub ImageCombo1_Click()
  ImageCombo1 = vbNothing
End Sub

[ Voor 6% gewijzigd door glashio op 09-06-2004 16:51 . Reden: K*t weer een TYPO |:( ]

> Google Certified Searcher
> Make users so committed to Google that it would be painful to leave
> C64 Gospel
> [SjoQ] = SjoQing


Verwijderd

Topicstarter
Nou ik zopu graag zo iets willen doen: (deze code is reine fantasie:))

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Private Declare Function ComboBox_Click_Being_Executed (ByVal hwnd as Long) As Boolean

Public Sub UpdateControls (ControlArray as Object)

dim chk as CheckBox

'--first, unload controls, then load new ones where needed.--
If ComboBox_Click_Being_Executed then
    for each chk in ControlArray
        chk.Tag = c_sUnloadTag
        chk,Visible = False
    next chk
Else  '--no ComboBox.Click Event, i can unload--
    for each chk in ControlArray
        unload chk
    next chk
End If

'...

End Sub


Hopelijk is het zo te begrijpen?

  • nescafe
  • Registratie: Januari 2001
  • Laatst online: 24-05 21:00
Kun je niet aan het begin van een sub een boolean op True zetten en aan het eind deze weer op False?

Deze boolean (of array van booleans) buiten de sub declareren en dan kun je in elk event deze boolean checken.

Of denk ik te simpel?

* Barca zweert ook bij fixedsys... althans bij mIRC de rest is comic sans


Verwijderd

Topicstarter
Inderdaad!
Dat is een goed idee.
Kost wel wat werk, maar ja, zonder werk krijg je weinig gedaan.

Bedankt, soms is de oplossing zo dichbij dat je er voorbij zit te staren...

:)

Wilde_bill
Pagina: 1