Need another approach for program
Posted
#1
(In Topic #1320)
Enthusiast

MakeTmr(Cmpr as string, TimeInt as integer, CompareType as string, CompareValue as string, TShell as string, FShell as string)
Cmpr is a name of a shell script that will return a value. This is run when the timer triggers.
TimeInt is the delay for the timer in milliseconds (it will execute the Cmpr script every TimeInt)
CompareType is the way comparison is done (not relevant for this)
CompareValue is what the result is compared to (not relevant for this)
TShell is another shell script that is run if the condition is true
FShell is another shell script that is run if the condition is false or if not present will reset the timer delay and repeat
The timers will be created as needed. so there could be 2 of these running, none running or 50 of them running. I can create the timers on the fly as needed but the issue is when they go off, I can't tell which one is triggered so the correct shell scripts can execute. I have buttons made this way but I can control the name and tag of the buttons and use them to figure out what to do. The timer has no name or tag when I create it so I have no way of telling what to run when it triggers nor any of the information from when it was created. I am considering using Settings= to store information just never execute the settings.save so nothing is written to disk and setting are only used in the program then lost. Since more than one copy of the program can be running at a time this should keep information to the individual running programs without cross contamination. But I still can't tell which information to grab for each timer because I can't differentiate them from each other yet.
I could use some ideas on how to make this happen.
Posted
Enthusiast

I had an idea but not sure it can be done. Is it possible to wrap a control like the timer control in Gambas? The purpose would be to attach and expose the name and tag properties for a timer so I can detect which one is triggered and the tag to tell me what should be run.
So any info anywhere on how to do this?
Posted
Guru

Posted
Guru

Posted
Enthusiast

BruceSteers said
You are on the right track for what I need. I tried to put this in the main class up in the beginning but the tag property is not added and the export word causes an error. "unexpected export" so I do not think I have the quite right but yes adding the tag to the timer would solve the issue entirely. I know I need to put this into its own class but the export still fouls me up.
Posted
Enthusiast

cogier said
I don't know if I fully understand your request, but have a look at the attached program.
Timers-0.0.1.tar.gz
Off topic on that reply. I am looking to create multiple timers programatically. each with different times and each needs to be able to be identified when it triggers so proper code can execute. There can be 2 timers running or 102 timers running concurrently. If the name and tag properties were available it would work perfect. However they are not.
Posted
Guru

Then it auto inherits Timer.class and adds the Tag property to all timers.
Check this s post out…
Gambas One - Gambas ONE
In the first comment I explain it all and show how to also show Tag in the IDE property list <EMOJI seq="1f60e" tseq="1f60e">😎</EMOJI>
Posted
Enthusiast

Posted
Guru

$ because it is a global Private variable
v because it's a Variant type
Tag is the name
So $vTag
Following the convention (it's Benoits not mine) you would use
$sName for a string type property called Name
But you can use whatever you like
The Use keyword just makes the property use that variable so you don't need the property read and write methods
Posted
Guru

Property Name As String
And with the cursor at the end of the line I press LeftAlt-Shift-Return and it automatically adds Use $sName to the line
Posted
Enthusiast

Posted
Regular

I have a code snippet "pru" that inserts a proper Property line here. It is
<COLOR color="#FF0000">Everyone should know how to use snippets!</COLOR> If not check here: /ide/idesnippets - Gambas Documentation
b
Posted
Guru

I found the function that auto prints the properties Read/Write methods and made some mods
If i type
Property Name As String
Pressing LAlt-Shift-Return does this…
Pressing LAlt-Return does all this… (minus my comments)
Hehe
Step 1: Start compiling and installing gambas from source not packages.
Step 2: Realize the IDE is written in gambas and is an editable project you can load into the gambas IDE.
Step 3: Study the code till your eyes hurt. walk through it like a human debugger on step mode.
Step 4: Make your IDE do all kinds of things that you personally want it to without having to hassle Benoit
God I love gambas
But apologies for the misguided key code suggestion. I though the lalt-shift one was Bens code, i guess not.
Posted
Enthusiast

1 guest and 0 members have just viewed this.


