Author Topic: Open a project with global variable(s)  (Read 5964 times)

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Open a project with global variable(s)
« on: January 01, 2006, 07:17:54 pm »
Hello,

I have remarked a potential "issue" with C::B and the global variables. I have downloaded the wxAUI example of tiwag and opened it with C::B (Therion's SVN binary snapshot - rev1578). As I do not have the wx global variable defined, C::B displayed a warning message and opened the Global Variable Editor to let me define wx. The problem was if I pressed cancel, C::B displayed the warning message again and then opened the Editor. This has occurred 3 times, before C::B finally finished to load the project.

Is this a "bug" to continue asking the user to define a global variable even if she/he pressed cancel, or it is a desired behaviour?

Thank you very much.

Best wishes,
Michael

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Open a project with global variable(s)
« Reply #1 on: January 01, 2006, 07:20:24 pm »
It is not strictly a bug, although it is annoying.

While the project is being loaded, the global variable is referenced three times, and the global variables manager finds it undefined every time, so you are prompted three times. There is no easy workaround for this at the present time, sorry.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Open a project with global variable(s)
« Reply #2 on: January 01, 2006, 07:29:04 pm »
It is not strictly a bug, although it is annoying.

While the project is being loaded, the global variable is referenced three times, and the global variables manager finds it undefined every time, so you are prompted three times. There is no easy workaround for this at the present time, sorry.

Thank you for your reply. I thought it was just 3 times for a global variable instead of 1 time per reference. It is just a bit annoying (especially if you have several references of a same variable). Anyway, I find helpful to ask the user to define missing global variables instead of let her/him discover it at builing time.

Michael

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Open a project with global variable(s)
« Reply #3 on: January 01, 2006, 07:57:42 pm »
Oh yes, if you have many references to a variable, then you may be prompted 30 times, too... I know it is annoying, but there is really no easy workaround for that.

During build, this behaviour is necessary because you cannot build without having the variable defined. For project loading, however, it is annoying if you do not want to define the variable at that time.
We would need something like Freeze() and Thaw(), so all missing variables are recorded in a list between those two calls, and the user is prompted exactly once for all of them afterwards. But it is not quite so easy either, because the dialog is not very fit for that purpose - the user won't know he needs to enter several variables (or which ones).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Open a project with global variable(s)
« Reply #4 on: January 01, 2006, 08:07:44 pm »
May be a quick&dirty solution could be when C::B finds a missing reference to ask the user if she/he would like to define now the missing global variables or later. If the user says, e.g., now, then C::B will behave as it does actually, but if the user says later, then C::B will skip the whole process (and simply open the project).

Michael

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Open a project with global variable(s)
« Reply #5 on: January 02, 2006, 11:50:50 pm »
Oh yes, if you have many references to a variable, then you may be prompted 30 times, too... I know it is annoying, but there is really no easy workaround for that.

During build, this behaviour is necessary because you cannot build without having the variable defined. For project loading, however, it is annoying if you do not want to define the variable at that time.
We would need something like Freeze() and Thaw(), so all missing variables are recorded in a list between those two calls, and the user is prompted exactly once for all of them afterwards. But it is not quite so easy either, because the dialog is not very fit for that purpose - the user won't know he needs to enter several variables (or which ones).

How about a GlobalVarsManager (or something), which would be nothing but a map<wxString> ?

Offline balgior

  • Multiple posting newcomer
  • *
  • Posts: 24
Re: Open a project with global variable(s)
« Reply #6 on: March 23, 2006, 01:44:31 am »
Hello,

I just wanted to remind "us" of this issue, cause it's been nearly 4 months since first post...
Of course this is nothing of great importance but it's still annoying.
Maybe i could give it a try to find a workaround but i'm afraid i'll be messing up the code  :twisted:... and we wouldn't want that, would we?  :roll:

I'll give it a try, though, to get inspired of a solution!  :)