Board Logo
« question about a component swap @ edit time ??? »

Welcome Guest. Please Login or Register.
Nov 20th, 2017, 6:33pm


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: question about a component swap @ edit time ???  (Read 164 times)
JBenthusiast
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 13
xx question about a component swap @ edit time ???
« Thread started on: Aug 31st, 2017, 12:12am »

I realize its been a while since i've entered in here ... I have this gui window project that someone in here helped me with a while back but I want to swap out a combobox for a textbox from this form... I keep getting syntax errors when I think i'm trying to enter new code and rid the project of the undesired code. the project is a tone generator that has 2 combobox's I want to change out for textbox's instead to display more exacting numbers instead of the preseted type numeric content that is there.
[code snip below....]

statictext #scope.ss, "Sample rate" ,5,185,80,20
combobox #scope.ss, ss$(),[samples],5,205,80,20 <---trying to change this 1
statictext #scope.hz, "Hertz" ,90,185,80,20
combobox #scope.hz, hz$(),[hertz],90,205,80,20 <---trying to change this 1 as well

^^^^ so that each of the above labeled items can be textbox's instead of combobox's which
heavily limit its functionality to where I want it to be. I could also assume that i'd have to further
edit code line where each of these exist to ensure no furthering errors.....

thanks to anyone that could lend some assistance cheesy


User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3129
xx Re: question about a component swap @ edit time ??
« Reply #1 on: Aug 31st, 2017, 09:17am »

See if this helps. If you are having difficulty accessing the help file let us know.

Code:
    nomainwin
    WindowWidth = 800
    WindowHeight = 600
    UpperLeftX = (DisplayWidth-WindowWidth)/2
    UpperLeftY = (DisplayHeight-WindowHeight)/2
    statictext #scope.ss, "Sample rate" ,5,185,80,20
    textbox #scope.ss, 5,205,80,25
    'combobox #scope.ss, ss$(),[samples],5,205,80,20 '<---trying to change this 1
    statictext #scope.hz, "Hertz" ,90,185,80,20
    textbox #scope.hz, 90,205,80,25
    'combobox #scope.hz, hz$(),[hertz],90,205,80,20 '<---trying to change this 1 as well
    button #scope.read, "Read Input", [read], UL, 180, 205
        open "test" for window as #scope
    #scope "trapclose [quit]"
   wait


   [read]
   #scope.ss "!contents? ss$"
   #scope.hz "!contents? hh$"
   notice "You input "+ss$+" "+hh$
   wait


   [quit]
   close #scope
   end

 
User IP Logged

JBenthusiast
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 13
xx Re: question about a component swap @ edit time ??
« Reply #2 on: Sep 2nd, 2017, 10:11pm »

big thanks to rod for that help. Every bit of help can get me closer to finishing this project. I have included source of the project to this message because I have 2 other things I need just a lil bit of help with. As it shows below I had the [samples] & [hertz] function in the combobox objects but now having commented them out I have the objects changed to textboxes. I need to switch the functioning to equip those textboxes properly so that when the [play] function is triggered, the values in those textboxes having been input by the user will result in proper values triggered. I tried a few ideas to see if I could fix it but nothing worked,... so here I am.

[code snippet below @ the point of importance]

statictext #scope.ss, "Sample rate" ,5,185,80,20
textbox #scope.ss, 5,205,80,22 <----[samples] function needed in here
'combobox #scope.ss, ss$(),[samples],5,205,80,20
statictext #scope.hz, "Hertz" ,90,185,80,20
textbox #scope.hz, 90,205,80,22 <---[hertz] function needed in here
'combobox #scope.hz, hz$(),[hertz],90,205,80,20
statictext #scope.wv, "Waveform" ,175,185,80,20
combobox #scope.wv, wv$(),[wave],175,205,80,20
statictext #scope.vo, "Volume" ,260,185,80,20
combobox #scope.vo, vo$(),[volume],260,205,80,20
statictext #scope.du, "Duration" ,345,185,80,20
combobox #scope.du, du$(),[duration],345,205,80,20
button #scope.load, "Load",[load],UL,5,5
button #scope.save, "Save",[save],UL,50,5
button #scope.play, "Play",[play],UL,5,155
button #scope.loop, "Loop",[repeat],UL,50,155
button #scope.stop, "Stop",[stop],UL,95,155

open "Tone Generator" for window_nf as #scope

print #scope.ss, "11025"
samplesPerSecond=11025
print #scope.hz, "100"
hertz=100
print #scope.wv, "select Sine"
wave$="Sine"
print #scope.vo, "select 50%"
volume=.5
print #scope.du, "select 1000ms"
duration=1

wait

[samples]
print #scope.ss, "!contents? text$"
samplesPerSecond=val(text$)
' only 11025 supported just now
wait

[hertz]
print #scope.hz, "!contents? text$"
hertz=val(text$)
wait
User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3129
xx Re: question about a component swap @ edit time ??
« Reply #3 on: Sep 3rd, 2017, 1:31pm »

Get the contents of both textboxes inside the play function or branch?
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls