On 18.01.2011, at 17:11, Albrecht Schlosser wrote:

> On 18.01.2011, at 15:14, Paul R wrote:
> 
>> The program only runs from args when a file is double clicked or if the user 
>> know about such things 'dragged and dropped' onto the exe,
>> both of which things result in argc = 2, any higher and i have fails in 
>> place, argc = 1 is ignored as i am using the GetModuleFileName (i think
>> thats what it was called) now.
>> 
>> The thing is aside from the error pop up, using show->(argc, argv) threw
>> up a bug regarding file loading or memeory allocation (based on file
>> data loaded) somwhere in the program, which i was about to trace until
>> i found that it was due to ->show(argc,argv).
>> i say 'due to' i mean that all my file loading and parsing is now
>> structured without those parameters in mind directly so i will have to
>> go and rewind the command line stuff a-g-a-i-n if i include it!
>> either that or risk no icons i suppose.
> 
> There are also other reasons to use show(argc,argv) for the *first*
> window shown, e.g. loading of system colors and such.
> 
> But (and this is untested) you can always show your first window
> with
> 
>   win->show(1, argv); // note: argc is 1

That is correct.

You see the erroro message because FLTK finds an argument in the list that is 
not supported by FLTK's default arguments interpreter. 

So the cheapest way out is the one solution above. You should still interpret 
the arguments elsewhere, and your user loses the ability to change the color 
scheme or theme.

The first alternative is to make a copy of argv (you know how long it is using 
argc) and then removing entries that your application understands (filename frm 
a dnd operation on the icon, etc.). You then call show(myArgc, myArgv)... .

The second alternative uses Fl::arg(int, char **, int &, Fl_Args_Handler *) 
which calls your handler before handing an argument to FLTK.

<http://www.fltk.org/doc-1.3/classFl.html#1576b8c9ca3e900daaa5c36ca0e7ae48>


_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to