Create a classe named Timer in your project and just add this line in it : Public Tag as Variant
So you now have a tag in timer class. Le 5 juil. 2013 09:04, "Bruce" <[email protected]> a écrit : > On Thu, 2013-07-04 at 11:33 +0200, Benoît Minisini wrote: > > Le 04/07/2013 10:14, Tobias Boege a écrit : > > > On Thu, 04 Jul 2013, Bruce wrote: > > >> Hi folks, > > >> > > >> I have a form ("FSummary") that basically opens a variable number of > > >> other forms. This action is controlled by the user. > > >> > > >> Each other form is an instance of a single form/class, say "FDetail". > > >> Each and any of these could be closed by the user at any time. Also, > > >> when the FSummary form is closed, any remaining FDetail forms need to > be > > >> automatically closed. > > >> > > > > You have to set Application.MainWindow with FSummary. When the > > application main window is closed, all opened windows are closed > > automatically. > > > > Thanks to both of you. I have taken Benoît's approach and it is succint > and much tidier than what I was trying. But also to Tobias because you > have solved another problem ahead of time! ( I need to recognise an > event raised in the FDetail instances and refresh the summary form.) > > Sigh! But nothing is ever simple :-( > > In the FDetails form instances I need to create a variable number of > timers ... no it's probably easier to explain what the real goal is. > FSummary displays a list of auctions that are to be held this day. The > user selects one or more of these auctions that they have an interest in > and thus show a new form (FDetail) listing the lots (horses) on offer at > that auction. The user can then mark one or more lots that they are > specifically interested in and the goal is to "wake up" the relevant > FDetail instance several minutes before the live on-line sale of that > lot and the user can view and/or bid on the lot. (These live sales are > very live by the way and are more like feed lot sales if that means > anything and not like ebay sales.) Previously, we did this by loading > and watching every sale at every scheduled auction in a set of tabs. > This was OK while there were a limited number of online auctions per day > but now the amount of both auctions and lots has increased to the extent > that our old approach is getting slow and somewhat succeptible to timing > errors. So the new approach is just (at the client end) to attach to > the auctions and lots that they are interested in. > So much for the explanation. > > The new problem is this. I can create (I believe) a set of timers and > set their delays so that their Timer event will fire a set number of > minutes before the sale of the lot opens. But the Timer event does not > seem to fire (or I am not creating the Timers and event handlers > properly!). > > Here's the timer creation code (simplified somewhat to make the time > profiling easier to understand): > > ----------------------------------------------------------------------------- > Private Sub ResetTimers(cLot As Lot, iLotRNo As Integer) > > ' cLot as Lot ' The Lot object > ' iLotRNo As Integer ' The registered lot number (just in case we > need it later...) > > Dim iDelta As Integer ' Minutes difference between Now() and > scheduled sale start > Dim rTimer As Timer ' The timer for this Lot > > Debug cLot.LotNo, iLotRNo > > rTimer = New Timer As "UpdateTimer" > iDelta = DateDiff(Now, cLot.LocalStartTime, gb.Minute) > > Select iDelta > Case -999999 To -10 > rTimer.Delay = 1000 * 60 * 15 ' Lot has expired, just track > every 15 minutes in case of post sale changes/notices > Case -9 To -5 > rTimer.Delay = 1000 * 60 * 1 ' Lot is closed, check for sale > closure every minute > Case -4 To 0 > rTimer.delay = 1000 * 60 * 0.5 ' Lots is closed, check for finals > every 30 seconds > Case 0 To 5 > rTimer.Delay = 500 ' Lot is active, check every 1/2 > second > Case 6 To 10 > rTimer.Delay = 1000 * 60 * 0.25 ' Hot presale, check every 15 > seconds > Default > rTimer.Delay = 1000 * 60 * 5 ' Presale, check every 5 minutes > End Select > ' rTimer.Tag = rno > rTimer.Start > > End > > ---------------------------------------------------------------------------- > > and here's the event handler > > ---------------------------------------------------------------------------- > Public Sub UpdateTimer_Timer() > > Debug Last.Name > > For Each $auction.Lots > ' Locate the correct lot. Then send the XML request, grab > ' the result and do lots of stuff depending on the reply... > Next > > End > > ---------------------------------------------------------------------------- > > > That Debug never occurs! > > Any idea where I am going wrong? > > tia > Bruce > > p.s. By the way, is it possible to have a Tag property in the Timer > control. It would save me having to locate the correct lot via a > sequential search? > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > Gambas-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
