big File Copy respond
Posted
#1
(In Topic #1803)
Enthusiast

system recognises App as possibly crashed
Hi again,Using an online TV Recorder I download some GB of video files per week.
After downloading the commercials are cut out and then the Gambas app
shows in a listbox the available files for sorting them in folders.
The app works as expected but the system (Ubuntu 24.04.3 LTS) is
somehow moaning if it lasts longer to copy a file it shows a message like
"App does not respond, wait or close app"
if I choose to wait and the copying is finished, all well.
Ok, I think it is not a Gambas problem (?) to report back to the system.
This waiting or closing message is somehow annoying.
So using the copy command with big files is the problem.
Any chance to get rid of this message?
I thought to make a copy sub with
and a window with progressbar etc.
That should do the trick also.
Btw. the read takes the bytes to get,
Code (gambas)
Read #src, sLine, -iBlock
Or using a value depending on the filesize to be copied?
Thanks &
Regards,
Yogi
Posted
Enthusiast

Code (gambas)
- ' Gambas class file
- '' Init
- hwin.Width = 700
- hwin.Height = 300
- p.Width = hwin.Width - 20
- p.Height = 20
- p.Top = 10
- '' Arguments Source and Target
- sLabel.Width = hwin.Width - 20
- sLabel.Height = 150
- sLabel.Top = p.Top + p.Height + 20
- sLabel.Text = "<b>Source:</b><br>" & sSource & "<br><br>" & "<b>Target:</b><br>" & sTarget
- sLabel.Border = Border.Solid
- hCancel.Text = "Cancel"
- hCancel.Top = sLabel.Top + p.Top + p.Height + 20 + 150
- hwin.Show
- 'necessary?
- iBlock = 10000
- iBlock = 100000
- iBlock = 500000
- p.Value = 0
- iAsize = 0
- iAsize += iBlock
- progress = 100 / fsize * iAsize / 100
- p.Value = progress
- Write #hTar, sBytes
- Wait 0
- hSrc.Close
- hTar.Close
- Wait 0
- lReturn = False
- lReturn = True
- Return lReturn
- bIscanceled = True
and with that copy class there is no system message "Wait or abort" or something similar.
Neither validation nor beauty of the GUI is made.
Suggestions for improvement are welcome.
Regards
Yogi
Posted
Guru

Tip: A ProgressBar.Value float Is more simply done by dividing the other way round, ie, the bytes copied divided by the total number bytes…
Ie.
progress = iAsize / fSize
Posted
Enthusiast

BruceSteers said
Cool, you got the idea.
Tip: A ProgressBar.Value float Is more simply done by dividing the other way round, ie, the bytes copied divided by the total number bytes…
Ie.
progress = iAsize / fSize
From “Post #12,306”, October 4th 2025, 4:07 PM
Yes, mathematics and I š
Thanks!
Posted
Guru

Yogi said
No worries.
Believe me I used to do exactly the same kind of thing
Your understanding of this Copy problem seems to be top notch and you pretty much answered your own questions in your first post.
So just to confirm, yes using the gambas Copy command on large files is not a great idea as your program code will be locked while it's operating that single command.
The answer as you correctly concluded was to break the command into multiple read/write pieces that allows the code to continue to run, lets the event loop cycle (using Wait) and let you do things like show progress/catch cancellations/etc.
Posted
Enthusiast

BruceSteers said
Your understanding of this Copy problem seems to be top notch and you pretty much answered your own questions in your first post.
So just to confirm, yes using the gambas Copy command on large files is not a great idea as your program code will be locked while it's operating that single command.
The answer as you correctly concluded was to break the command into multiple read/write pieces that allows the code to continue to run, lets the event loop cycle (using Wait) and let you do things like show progress/catch cancellations/etc.
From “Post #12,324”, October 5th 2025, 6:26 AM
From the beginning in 1980s I was enthusiastic to programming (VC20?, C64) till working with Clipper (dBase Compiler).
But from this time there is a little understanding for programming, but saw also that I never will do some Assembler, C,
C++, C#, Pascal etc. Using a high level language where you never get problems with memory, storage, pointers etc and
get some apps running in short time that is the point for me.
To get some things running which make day life easier is the thing today. Nice to find Gambas.
So the biggest problem is my brain forgetting things in short time - even after a view days not looking to the
source code I ask myself: what the heck have I done here? š
So good decision at the end of the 1990s to quit the profession programming (no education, just learning by doing).
Thanks and kind regards,
Yogi
Posted
Administrator

I have to 100% agree with Bruce.BruceSteers said
Your understanding of this Copy problem seems to be top notch and you pretty much answered your own questions in your first post.
From “Post #12,324”, October 5th 2025, 6:26 AM
I read your first post thinking, you already solved the problem in you head and the second post confirmed your thought pattern send you right where you needed be.
So, I saw absolute no need to react and had a smile on my face as it reminded me of my first period on the long gone gambas guru forum back in the Gambas 2 days.
So, keep on doing you, it's perfect for learning anything
I enjoy reading it
gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
Posted
Enthusiast

gbWilly said
I have to 100% agree with Bruce.BruceSteers said
Your understanding of this Copy problem seems to be top notch and you pretty much answered your own questions in your first post.
From “Post #12,324”, October 5th 2025, 6:26 AM
I read your first post thinking, you already solved the problem in you head and the second post confirmed your thought pattern send you right where you needed be.
So, I saw absolute no need to react and had a smile on my face as it reminded me of my first period on the long gone gambas guru forum back in the Gambas 2 days.
So, keep on doing you, it's perfect for learning anything![]()
I enjoy reading it![]()
From “Post #12,329”, October 5th 2025, 8:53 AM
Thanks for your kind words.
And yes, we should enjoy more. That's what I've learned through Yoga…
Kind regards,
Yogi
1 guest and 0 members have just viewed this.


