Hello,
I don't need code, just an info: Let's say I have a StringGadget which is used for filtering a list. Now, I don't want to update the list on every edited character, but let's say one second after the last change was made. Naturally I would start a timer when something changes (and restart it, if it was already started), then process it after it fires. So far so good (and easy).
But, just out of curiosity, is there a better way to do it? Or some different approach, that's more efficient?
How to deal with wanted delay on a string gadget?
How to deal with wanted delay on a string gadget?
Last edited by jacdelad on Mon May 22, 2023 5:03 pm, edited 1 time in total.
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Re: How to deal with wanted dealy on a string gadget?
I would probably do it the same way....
1. Start timer with EventType Focus
2. count up counter variable, or reset if EventType Change
3. when count is reached, update the list
4. end timer with EventType LostFocus
maybe a bit different, but probably not more efficient
Waiting inside a thread and then a PostEvent() is probably not much better
1. Start timer with EventType Focus
2. count up counter variable, or reset if EventType Change
3. when count is reached, update the list
4. end timer with EventType LostFocus
maybe a bit different, but probably not more efficient
Waiting inside a thread and then a PostEvent() is probably not much better
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Re: How to deal with wanted dealy on a string gadget?
If it's not absolutely essential, I'd rather not overload the system, so I don't do it by time, I just do it when the return button is pressed or when StringGadget losses focus.
Re: How to deal with wanted delay on a string gadget?
Thanks you both.
@Caronte3D' Yes, that would be another way to do it. I am just curious about the specific problem I described. Like when showing tooltips, you don't to push a button for that.
@Caronte3D' Yes, that would be another way to do it. I am just curious about the specific problem I described. Like when showing tooltips, you don't to push a button for that.
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD