Enable/Disable a Main Menu
Moderator: Rathinagiri
Re: Enable/Disable a Main Menu
Ah! Thank you, Andy!
INKEY(nSeconds) as the trigger to end the wait state! I didn't think of trying that!
I'm going to try it using a single window, with the end of each proc making the next labels visible.
Thanks again.
Regards,
CalScot
INKEY(nSeconds) as the trigger to end the wait state! I didn't think of trying that!
I'm going to try it using a single window, with the end of each proc making the next labels visible.
Thanks again.
Regards,
CalScot
Re: Enable/Disable a Main Menu
Thanks again for the all info, suggestions and code. My application is now not only running perfectly, but involves much less code then the workaround I described before.
(I’ve been working on this project very late at night, and I think that my first, short version may have worked but that I was putting “Enabled” instead of “Visible” and was just too tired to notice my mistake.)
Now I have yet another problem / question: Some of the processes behind the labels take up to 60 seconds to complete, and Id like to have each label’s text blink until it’s completed, to show the user that the process hasn’t frozen.
I’ve been able to compile and run everything I can find on blinking text, but it all seems to be tightly tied to making a single label blink. I’m having a tough time writing a generic version that I can easily apply to the 8-10 labels that I want to blink as each of their underlying processes run.
(It would be so good to be able to just write:
Maybe that could be put on the wish list to be considered for future implementation?)
In the meantime, if anyone has a blink function that can be turned on and off for multiple labels in sequential order, I would really appreciate hearing the details or seeing the code.
Thank you.
CalScot
(I’ve been working on this project very late at night, and I think that my first, short version may have worked but that I was putting “Enabled” instead of “Visible” and was just too tired to notice my mistake.)
Now I have yet another problem / question: Some of the processes behind the labels take up to 60 seconds to complete, and Id like to have each label’s text blink until it’s completed, to show the user that the process hasn’t frozen.
I’ve been able to compile and run everything I can find on blinking text, but it all seems to be tightly tied to making a single label blink. I’m having a tough time writing a generic version that I can easily apply to the 8-10 labels that I want to blink as each of their underlying processes run.
(It would be so good to be able to just write:
Code: Select all
Form_1.Label_5.Blink := .T.
In the meantime, if anyone has a blink function that can be turned on and off for multiple labels in sequential order, I would really appreciate hearing the details or seeing the code.
Thank you.
CalScot
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Enable/Disable a Main Menu
Label + Blink ? This culd be implemented thru a timer changing colors to transparent.CalScot wrote:It would be so good to be able to just write:Maybe that could be put on the wish list to be considered for future implementation?Code: Select all
Form_1.Label_5.Blink := .T.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: Enable/Disable a Main Menu
Hi, Pablo.
I started out by trying SetBlink() and SetColor() with the magic asterisk from the old Clipper days . They did compile, but...
The examples I found use a timer to set Visible to .T. or .F., and I can make that work to make a single label blink, but I'm trying to have several labels in the same window blink at different times, and that's where I'm getting stuck.
The timer always seems to be tied to a single label/object. I could always set up 8 or 10 timers with their related function calls, but that's a lot of code. I'm hoping to get a single function group that can be applied to multiple labels. (Which is why .Blink := .T. seemed so appealing!)
Tks.
CalScot
I started out by trying SetBlink() and SetColor() with the magic asterisk from the old Clipper days . They did compile, but...
The examples I found use a timer to set Visible to .T. or .F., and I can make that work to make a single label blink, but I'm trying to have several labels in the same window blink at different times, and that's where I'm getting stuck.
The timer always seems to be tied to a single label/object. I could always set up 8 or 10 timers with their related function calls, but that's a lot of code. I'm hoping to get a single function group that can be applied to multiple labels. (Which is why .Blink := .T. seemed so appealing!)
Tks.
CalScot
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Enable/Disable a Main Menu
CalScot wrote:I started out by trying SetBlink() and SetColor() with the magic asterisk from the old Clipper days
You can enable/disable the timer at time the goal form is open and you can set for several labels at same time changing color properties.The timer always seems to be tied to a single label/object.
Yeah, I think is the only way...I could always set up 8 or 10 timers with their related function calls, but that's a lot of code. I'm hoping to get a single function group that can be applied to multiple labels.
I understand, but in GUI world is different behaviour.Which is why .Blink := .T. seemed so appealing!
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
-
- Posts: 245
- Joined: Sat Aug 02, 2008 5:03 pm
Re: Enable/Disable a Main Menu
hICalScot wrote: The examples I found use a timer to set Visible to .T. or .F., and I can make that work to make a single label blink, but I'm trying to have several labels in the same window blink at different times, and that's where I'm getting stuck.
The timer always seems to be tied to a single label/object. I could always set up 8 or 10 timers with their related function calls, but that's a lot of code. I'm hoping to get a single function group that can be applied to multiple labels. (Which is why .Blink := .T. seemed so appealing!)
This is a simple way to make something similar to the property :blink()
Selecting the label by the name and with the property enabled, start-stop the timer
Code: Select all
#include "hmg.ch"
STATIC lOnOff := .T.
STATIC cLabel := "Label_1"
Function Main
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 400 ;
TITLE 'Blink Test' ;
MAIN
@ 10,10 LABEL Label_1 VALUE "blinking 1" WIDTH 200
@ 50,10 LABEL Label_2 VALUE "blinking 2" WIDTH 200
DEFINE TIMER Timer_1 ;
INTERVAL 1000 ;
ACTION ( Blink(), lOnOff := ! lOnOff )
DEFINE TIMER Timer_2 ;
INTERVAL 5000 ;
ACTION ( cLabel := "Label_2" )
END WINDOW
Form_1.Center
Form_1.Activate
RETURN
/*-----------------------------------------------------------------*/
PROCEDURE Blink()
Form_1.&( cLabel ).Visible := lOnOff
RETURN
Regards/Saludos, Carlos (bcd12a)
Re: Enable/Disable a Main Menu
Thank you, Carlos.
Your code worked instantly and was exactly what I was looking for, but when I tried to implement it in my program, I can't get it to work.
Below is my adapted version of your code.
Sorry that it's a bit messy with embedded comments, but that seemed easier than trying to explain it outside of the code.
Any help that anyone can give; this is driving me crazy!!!
Thanks again.
CalScot
Your code worked instantly and was exactly what I was looking for, but when I tried to implement it in my program, I can't get it to work.
Below is my adapted version of your code.
Sorry that it's a bit messy with embedded comments, but that seemed easier than trying to explain it outside of the code.
Code: Select all
#include "hmg.ch"
Static lOnOff := .T.
Static cLabel := "Label_1"
***************
Function Main
// Window (Form_1.fmg) defined in IDE using the following parameters:
// DEFINE WINDOW Form_1 AT 0,0 WIDTH 400 HEIGHT 200 TITLE 'Blink Test' MAIN
// @10,10 LABEL Label_1 VALUE "Process 1 under way..." WIDTH 150
// @10,170 LABEL Label_2 VALUE "Completed!" WIDTH 100
// @50,10 LABEL Label_3 VALUE "Process 2 under way..." WIDTH 150
// @50,170 LABEL Label_4 VALUE "Completed!" WIDTH 100
// DEFINE TIMER Timer_1 INTERVAL 400 ACTION ( Blink(), lOnOff := ! lOnOff )
// END WINDOW
// NOTE: Form_1.fmg has ONINIT F1Procs() + Labels 2,3 & 4 are VISIBLE := .F.
Load Window Form_1
Center Window Form_1
Activate Window Form_1
Return && With these 3 lines & the ONINIT removed, Label_1 blinks but
***************** && the process stops. Left in, the process runs to the end,
Function F1Procs() && but neither Label_1 nor Label_3 blinks.
InKey(5) && Simulates running Process 1
// Process 1 complete: Turn off Label_1 blink, Show Label_2, Turn on blinking Label_3
BlinkOff()
Form_1.Label_2.Visible := .T.
cLabel := "Label_3"
Form_1.Timer_1.Enabled := .T.
Form_1.Label_3.Visible := .T.
InKey(5) && Simulates running Process 2
// Process 2 complete: Turn off Label_3 blink, Show Label_4, End.
BlinkOff()
Form_1.Label_4.Visible := .T.
RETURN
*******************
PROCEDURE Blink()
Form_1.&( cLabel ).Visible := lOnOff
RETURN
**********************
PROCEDURE BlinkOff()
Form_1.Timer_1.Enabled := .F.
Form_1.&( cLabel ).Visible := .T.
RETURN
*******
Thanks again.
CalScot
-
- Posts: 245
- Joined: Sat Aug 02, 2008 5:03 pm
Re: Enable/Disable a Main Menu
HiCalScot wrote: Any help that anyone can give; this is driving me crazy!!!
I'm not sure but seems to be the timer events are fired after the on init events. I don't know too much about the hmg core, maybe somebody can help and tell us if this is correct or could be changed.
Regards/Saludos, Carlos (bcd12a)
- serge_girard
- Posts: 3167
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Enable/Disable a Main Menu
Calscot,
If you can provide the rest of the code (Form_1.fmg ....) and can also take a look.
Greetings,
Serge
If you can provide the rest of the code (Form_1.fmg ....) and can also take a look.
Greetings,
Serge
There's nothing you can do that can't be done...
Re: Enable/Disable a Main Menu
Thank you Carlos.
Thanks again.
CalScot
I'll keep on playing around with it, and try triggering FProc1() from a second timer instead of from OnInit. There must be a way!!seems to be the timer events are fired after the on init events
Thanks again.
CalScot