Search found 12 matches

by droadje
Fri Apr 05, 2019 7:08 pm
Forum: Coding Questions
Topic: Variable by name question
Replies: 3
Views: 801

Re: Variable by name question

Thanks guys,

Your examples are working, now i understand that i have to go a different path....
by droadje
Fri Apr 05, 2019 6:23 pm
Forum: Coding Questions
Topic: Variable by name question
Replies: 3
Views: 801

Variable by name question

Been looking for hours, but cannot find it:

The button is defined with #PB_Any and referenced by variable Button1_0
As i have many buttons, i would like to be able to play around with the names chosen.

Difficult to explain, but how can i use the integer variable name (Button1_0) from a string.
So ...
by droadje
Sun Mar 31, 2019 12:18 am
Forum: Coding Questions
Topic: wat is the best way to store static data
Replies: 8
Views: 1444

Re: wat is the best way to store static data

Ok, played with your examples, but find it complex for a beginner.

Think i go with this as i can find de string (1 to 6 ) in the name ( Buton1_4 = on string one)

NewMap Fret.s()
#String1
Fret("Button1_0") = "E"
Fret("Button1_1") = "F"
Fret("Button1_2") = "F#"
Fret("Button1_3") = "G"
Fret("Button1 ...
by droadje
Sat Mar 30, 2019 10:59 pm
Forum: Coding Questions
Topic: wat is the best way to store static data
Replies: 8
Views: 1444

Re: wat is the best way to store static data

Or, when it fits your problem, use a map with the note as key
and store the string and the button in a structure of a list below.
Then you can find the note element and use foreach for all pressed keys.


Structure StringButtonStructure
String.i
Button.i
EndStructure

Structure NoteMapStructure ...
by droadje
Sat Mar 30, 2019 9:49 pm
Forum: Coding Questions
Topic: wat is the best way to store static data
Replies: 8
Views: 1444

Re: wat is the best way to store static data

So, like this?
Structure Fretboard
String.i
Button.i
Note.s
EndStructure

Dim Guitar.Fretboard(60)

Guitar(0)\String = 1
Guitar(0)\Button = Button1_0
Guitar(0)\Note = "E"

Guitar(1)\String = 1
Guitar(1)\Button = Button1_1
Guitar(1)\Note = "F"


(edit , was wrong...)
by droadje
Sat Mar 30, 2019 9:30 pm
Forum: Coding Questions
Topic: wat is the best way to store static data
Replies: 8
Views: 1444

Re: wat is the best way to store static data

GetGadgetText() :?:

If you can not use this I would use a list or an array.
A map makes no sense, since you don't have a meaningfull key.

But I have to say that I not really understand what you want to achieve.

And your shown procedure set the text to "" when it is already "".
This makes no ...
by droadje
Sat Mar 30, 2019 8:48 pm
Forum: Coding Questions
Topic: wat is the best way to store static data
Replies: 8
Views: 1444

wat is the best way to store static data

Hi,
What is the best way to solve my situation:
I have created a guitar fretboard with buttons.
If you click a button, it shows the note name for 1 second. This already works.
But now, I want to be able to show for example all E notes on the fretboard, so i have to make a data thingy, where i can ...
by droadje
Thu Mar 28, 2019 9:12 pm
Forum: Coding Questions
Topic: SetGadgetText for 1 second, howto?
Replies: 11
Views: 2190

Re: SetGadgetText for 1 second, howto?

Ha, boys, thanks, all your code works and looks like it does the same thing.

And threads and gui DO seem to work on my Manajaro Linux

Plenty to learn now from the code you have given, thanks.
by droadje
Thu Mar 28, 2019 8:49 pm
Forum: Coding Questions
Topic: SetGadgetText for 1 second, howto?
Replies: 11
Views: 2190

Re: SetGadgetText for 1 second, howto?

In my program it works now also, like this:


; Snaar 1 ***********************************************
Procedure Button1_0(EventType)
If GetGadgetText(Button1_0) = ""
SetGadgetText(Button1_0, "E")
CreateThread(@empty(), Button1_0)
Else
SetGadgetText(Button1_0, "")
EndIf
EndProcedure ...
by droadje
Thu Mar 28, 2019 8:39 pm
Forum: Coding Questions
Topic: SetGadgetText for 1 second, howto?
Replies: 11
Views: 2190

Re: SetGadgetText for 1 second, howto?

thanks, that did the trick.
by droadje
Thu Mar 28, 2019 8:32 pm
Forum: Coding Questions
Topic: SetGadgetText for 1 second, howto?
Replies: 11
Views: 2190

Re: SetGadgetText for 1 second, howto?

thanks for the quick respond.
I tried TI-994A solution, but get the same result i already had. Perhaps because i am on Linux, will try Windows later. (hangs for 1 second with black background, not text)
So i have to learn the method Rashad has given.
Perhaps i should start smaller, because i now ...
by droadje
Thu Mar 28, 2019 7:16 pm
Forum: Coding Questions
Topic: SetGadgetText for 1 second, howto?
Replies: 11
Views: 2190

SetGadgetText for 1 second, howto?

Hi Purebasic,

Busy with a guitar fretboard learning ap, how can i set the text in a button for 1 seccond?
Procedure Button1_0(EventType)
If GetGadgetText(Button1_0) = ""
SetGadgetText(Button1_0, "E")
Delay(1000)
SetGadgetText(Button1_0, "")
Else
SetGadgetText(Button1_0, "")
EndIf ...