FLTK logo

RE: [fltk.general] Use worker thread to call Fl_Window and Fl_run - [General Use]

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

RE: Use worker thread to call Fl_Window and Fl_run - [General Use] "'MacArthur, Ian (Leonardo, UK)' via fltk.general" Oct 01, 2020  
 

From: fltkgeneral@googlegroups.com <fltkgeneral@googlegroups.com> On Behalf Of anmol....@gmail.com
Sent: 01 October 2020 10:08
To: fltk.general <fltkgeneral@googlegroups.com>
Subject: Re: [fltk.general] Use worker thread to call Fl_Window and Fl_run

> Forking a new process may be a bit heavyweight for my needs.
> Its more intensive on Windows than on *NIX.

Yes, and not necessary in this case anyway, I suggest.


<snip>

// Loop
AEC_progress = (int)(i * mult);
        Fl::check();
// End Loop


That's effectively Fl::run()... I'd have a little delay in that tight loop, if it were me, though!


> This works well with the bar indicator, but the text shows some junk.

Yes, it would do.
Your label is stored in a stack-automatic variable "char percent[10] = { "" };" and is going out of scope before it is used, so you get garbage.
If you know your label store is of transient persistence, as here, you should probably use copy_label() rather than label().



> Also, this window goes to the background.

> Any suggestions to force this window to the top of all other windows? My GUI (code that I cannot
> change) may be pushing a cmd window to the top as I am using popen/pclose and windows starts a cmd
> window when you use pipes.

OK - that's hard, since fltk is not in control of the z-order in your case... You could *try* calling show() on your window each time you check() it, but that might just cause hideous flickering as the windows fight over who is on top.

The alternative, if you are prepared to use platform specific code, is to modify the window attributes to make it always on top, but non-modal so it does not prevent events passing to your other windows (using the Windows terminology for this) and see if that helps. But that will not be portable of course.

Also, you can tell windows not to throw the CMD window at all for the pipe, though off-hand I can’t remember the magical invocation for that. It's a linker option though, IIRC. might be "-mwindows" with gcc, can't recall what VS uses...





Leonardo MW Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

-- 
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/e4779a9cf6b14af98f394b6e9b04049c%40leonardocompany.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.