[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Data event of TableView
[Thread Prev] | [Thread Next]
- Subject: Re: Data event of TableView
- From: Bruce Steers <bsteers4@xxxxxxxxx>
- Date: Wed, 13 Nov 2024 13:58:30 +0000
- To: user@xxxxxxxxxxxxxxxxxxxxxx
On Wed, 13 Nov 2024 at 12:21, gbWilly <gbWilly@xxxxxxxxxxxxxx> wrote: > Hi all, > > I have this form with 2 TableViews, besides each other. > > The left TableViewL holds Article number, description, current supply, > minimal supply, recommended refill (= minimal supply - current supply if > positive, else 0). > > The right TableViewR holds article number and recommeded refill. > > User only needs to click a transfer button to add the recommended refill > to current supply and form closes. This has been working like this since I > guess 2012 or 2013 (originally coded in Gambas 3.6.2) > > On request of some users, I build a button to set TableViewR > recommendations to 0, as sometimes users want to divert from the > recommendations because of changed circumstances that need human insight. > This new button works fine. > > The Data event of TableViewL does the recommendations or sets them to 0. I > use a private variable array $aRecommend to store either the recommendation > or 0. So, the button to set to 0 triggers the TableViewL data event to set > the recommendations in TableViewR to 0 (ZERO) using aRecommend. If user now > enters values to TableViewR and moves the mouse over TableViewL the data > event of TableViewL is triggered and sets all recommendations in TableViewR > to 0 again (as that is what it is coded to do), to great frustration of > user. > > Only way to prevent is NOT moving the mouse over the TableViewL, but that > is no solution for end users. I tried to disable the TableViewL after the > recommendations are set to 0 by user in TableViewR, but moving the mouse > over the disabled TableViewL still triggers Data event and next sets > TableViewR back to 0 and removes user input. Only if the mouse is moved > over TableViewL and back to TableViewR the data is set back to zero, moving > outside TableViewR elsewhere and back doesn't change the user input. > My question is simple: Is it possible to prevent the Data event of a > TableView from triggering, once it has done his job and NO new data is read > into it? > > I have no example project as this is part of a large project and all of > the above is linked to data in mariadb databases on the Debian servers. > > gbWilly > > Gambas3 for Debian <https://gitlab.com/gbWilly/gambas3-debian-repository> > I'm finding using a GridView/TableView Data event to be good for some things but just not for others. Mostly because it triggers too often, like you say, on Enter and many other instances. Much like a Controls Draw event. The more you try to do in a Data or Draw event it seems the more cpu hungry your program becomes due to the uncontrollable frequency of the event call. My latest GambasProcWatch program initially used a Data event but i found it triggered way too often, so i just converted it to not use Data event and fill the GridView manually only when i wanted it to. The traditional old loop... Inc TableViewL.Rows.Count TableViewL[TableViewL.Rows.Max,0].Text = "blah" Perhaps in this case it might be better to just not use Data event? then you are free to trigger updates when YOU want. Respects BruceS
Re: Data event of TableView | gbWilly <gbWilly@xxxxxxxxxxxxxx> |
Data event of TableView | gbWilly <gbWilly@xxxxxxxxxxxxxx> |