Opened 19 months ago

Last modified 19 months ago

#14743 confirmed enhancement

Add wxBusyInfo::UpdateText()

Reported by: ghostvoodooman Owned by:
Priority: low Milestone:
Component: GUI-all Version: stable-latest
Keywords: wxBusyInfo progressbar percent simple Cc:
Blocked By: Blocking:
Patch: no

Description

I am using wxBusyInfo.

I have code like (pseudo code)

wxBusyInfo* busy=new wxBusyInfo( text representing "initializing 0.000%" );

while(...) {
    if( old_time!=time(NULL) ) {
        delete busy;
        busy=new wxBusyInfo( text representing `all/100.0F*progress` "%" );
        old_time=time(NULL);
    }
    do_expensive_work();
}

delete busy;

to display information message of the progress in percent's.

This is leading to flickering wxBusyInfo. There is no big deal, I don't mind.

I'd like to have in constructor of wxBusyInfo flag like "bool no_text_but progress_bar = false".

When the coder instantiate this flag with "true", it will ignore the text displayed, but will show progress bar (optionally under progress bar to display the text), and the progress bar could be update-able via function like

update_progress(const float progress); // progress in range 0.0F to 1.0F

Side note: It would be nice to call function like:

update_busy_text("100%. Please, wait, finishing.");

to update the wxBusyInfo's text w/o re-creating the wxBusyInfo class instance.

I know I could make a custom window/frame/panel that would show progress bar, but this improvement would make wxBusyInfo much more convenient and much more simple for wxWidgets user to use.

I have googled for "wxbusyinfo progressbar" (w/o quotes), but I have only found this site: http://www.blitzbasic.com/Community/posts.php?topic=87606 which is actually telling nothing about such improvement/patch/code.

On Windows Vista, there are in system utilities progress bars that are showing moving green bar from left to right and cycling this animation indefinitely, until operation is done. Here, I am speaking of "real" progress bar, that displays real progress in percent's, visually.

Change History (3)

comment:1 follow-up: Changed 19 months ago by vadz

  • Keywords simple added; pregress bar removed
  • Milestone 3.0 deleted
  • Status changed from new to confirmed
  • Summary changed from Improve wxBusyInfo to show progress bar instead of text (add bool flag to constructor?) to Add wxBusyInfo::UpdateText()

It's, of course, a bad idea to recreate wxBusyInfo. Instead, you should create a small frame like this class does and update the text it displays. I think it could be useful to add wxBusyInfo::UpdateText() message to allow doing it easily but if you need anything else, you really should be using your own class. In particular, I strongly object to adding progress bars and what not to this class, either use wxProgressDialog or make your own.

comment:2 in reply to: ↑ 1 Changed 19 months ago by ghostvoodooman

Replying to vadz:

It's, of course, a bad idea to recreate wxBusyInfo.

yes, it's indeed a bad idea, only a workaround.

Instead, you should create a small frame like this class does and update the text it displays. I think it could be useful to add wxBusyInfo::UpdateText() message to allow doing it easily but if you need anything else, you really should be using your own class.

I agree, since wxBusyInfo usage is extremely simple to use, so I spirit of simplicity, it should have wxBusyInfo::UpdateText().

In particular, I strongly object to adding progress bars and what not to this class, either use wxProgressDialog or make your own.

Oh, my err, I never heard of this class, I will look at the docs, how to use it and what it provides. The name of it is telling that it is what I need. I do not want my own wxFrame-derived class, and then wxPanel class, since it would be odd complex solution to a simple problem.

comment:3 Changed 19 months ago by ghostvoodooman

Much of thanks to all those implemented class wxProgressDialog, which I was not aware of! Under Vista, I see native implementation (what is wxWidgets all-time wish), with arrow down button to show details, like "elapsed", "estimated", and "remaining" times, though computed statistically, and not displaying real-world times...; though, it is okay.

This is much better than my old implementation with wxBusyInfo recreation every while/second in my case.

But still wxBusyInfo class should have wxBusyInfo::UpdateText() method, as I and Vadim suggested.

Note: See TracTickets for help on using tickets.