Clear"edit" box

Here you can attach your files or example so others can use it, discussions needs to be done at the general board
Post Reply
Mel
Posts: 32
Joined: Mon Dec 22, 2008 1:19 pm

Clear"edit" box

Post: # 603Post Mel
Wed Feb 10, 2010 1:21 pm

I am having trouble with the program below. I want to test the contents of an "Edit" box and if it is not valid, clear the box and start over. I have made a little test program that will work, but when I put the code into this program it will not compile. I get the message "radiiE.text not declared" or something like that.
Anyone have any ideas
TIA
Mel
`*************************************************************************
`This is a program to provide a set of coordinats to let you cut a radius on a lathe or mill
`without using form tools



`Const + Dim here
const crlf = chr$(10) + chr$(13)
`dim radiie.text as string `This did not help


`Objects here
     

object mainform as form
     center = true
     caption = "MNC"
     object label1 as label
           caption = "Choose a Machine"
           fontsize = 18
           fontname ="Courier New"
           fontcolor = &hFF00FF
           top = 20
           left = 55
     end object
     object btn1 as button
           top = 100
           left = 40
           caption = "Mill"
           onclick=millbtn
     end object
     object btn2 as button
           top = 100
           left = 210
           caption = "Lathe"
           onclick=lathebtn
     end object
end object

mainform.ShowModal

`Subs here
sub millbtn()
     `showmessage "Mill Clicked"
     object millform as form
           caption = "MILL"
           center = true
           height = 200
           width = 400
           object radiil as label
                 caption = "What is radius to be cut?"
                 fontcolor = &hFF
                 left = 15
                 top =25
                 fontsize = 12
           end object
           object radiiE as edit
                 left = 250
                 top = 25
                 width = 90
                 text = "Press (Enter) last"
                 onkeydown=ekd `EnterKeyDown
           end object
           object cutdial as label
                 caption = "What is dia. of end mill?"
                 fontcolor = &hFFFFFF
                 fontsize = 12
                 left = 15
                 top = 60
           end object
           object cutdiae as edit
                 left = 250
                 top = 60
                 width = 90
           end object
           object degstpl as label
                 caption = "How many degrees/step?"
                 fontcolor = &hFF8000
                 left = 15
                 top =95
                 fontsize = 12
           end object
           object degstpe as edit
                 left = 250
                 top = 95
                 width = 90
                 hint = "Use one of these...2,3,5,6,9,10"
                 showhint = true
           end object
           object btn3 as button
                 left = 170
                 top = 130
                 caption = "Continue"
                 fontcolor = &hFFFF
                 fontsize = 12
                 onclick=continuebtn
           end object
                 
     end object
     millform.ShowModal
end sub

sub lathebtn()
     `showmessage "Lathe Clicked"
     object latheform as form
           caption = "LATHE"
           center = true
           height = 200
           width = 400
           object llable as label
                 caption = "UNDER CONSTRUCTION"
                 fontname ="MS Sans Serif"
                 fontsize = 18
                 fontcolor = &hFF
                 top = 70
                 left = 60
           end object
     end object
  latheform.showmodal
end sub

sub continuebtn()
     showmessage "Continue clicked"
     object textwindow as richedit
                 width = 500
                 height = 400
                 fontname = "Courier"
                 fontsize = 12
                 text = ""
                 `parent = millform
     end object
     textwindow.text = "this is it..."

     end sub

sub ekd (sender as edit, key as integer, shift as integer)
     select case key
           case 13
                 showmessage "Enter Key Pressed"
                 `radiiE.text="" `Why does this not work ?

     end select
end sub

magna
Posts: 30
Joined: Tue Nov 08, 2005 3:00 pm

Clear"edit" box

Post: # 604Post magna
Thu Feb 11, 2010 9:15 am

Try it like this:

`****************************************************
` This is a program to provide a set of coordinats
` to let you cut a radius on a lathe or mill
` without using form tools

`Const + Dim here
const crlf = chr$(10) + chr$(13)

`Objects here
object frmMill as form
     caption = "MILL"
     center = true
     height = 200
     width = 400
     object lblRadius as label
           caption = "What is radius to be cut?"
           fontcolor = &hFF
           left = 15
           top =25
           fontsize = 12
     end object
     object edtRadius as edit
           left = 250
           top = 25
           width = 90
           text = "Press (Enter) last"
           onkeydown=EnterKeyDown
     end object
     object lblDiameter as label
           caption = "What is dia. of end mill?"
           fontcolor = &hFFFFFF
           fontsize = 12
           left = 15
           top = 60
     end object
     object edtDiameter as edit
           left = 250
           top = 60
           width = 90
     end object
     object lblStep as label
           caption = "How many degrees/step?"
           fontcolor = &hFF8000
           left = 15
           top =95
           fontsize = 12
     end object
     object edtStep as edit
           left = 250
           top = 95
           width = 90
           hint = "Use one of these...2,3,5,6,9,10"
           showhint = true
     end object
     object btnContinue as button
           left = 170
           top = 130
           caption = "Continue"
           fontcolor = &hFFFF
           fontsize = 12
           onclick=OnClickBtnContinue
     end object
     object redText as richedit
           width = 500
           height = 400
           fontname = "Courier"
           fontsize = 12
           visible=False
     end object
end object

object frmLathe as form
     caption = "LATHE"
     center = true
     height = 200
     width = 400
     object lblConstruction as label
           caption = "UNDER CONSTRUCTION"
           fontname ="MS Sans Serif"
           fontsize = 18
           fontcolor = &hFF
           top = 70
           left = 60
     end object
end object

object frmMain as form
     center = true
     caption = "MNC"
     object lblChoose as label
           caption = "Choose a Machine"
           fontsize = 18
           fontname ="Courier New"
           fontcolor = &hFF00FF
           top = 20
           left = 55
     end object
     object btnMill as button
           top = 100
           left = 40
           caption = "Mill"
           onclick=OnClickBtnMill
     end object
     object btnLathe as button
           top = 100
           left = 210
           caption = "Lathe"
           onclick=OnClickBtnLathe
     end object
end object

frmMain.ShowModal

`Subs here
sub OnClickBtnMill()
     frmMill.showmodal
end sub

sub OnClickBtnLathe()
     frmLathe.showmodal
end sub

sub OnClickBtnContinue()
     redText.text = "this is it..."
     redText.visible = True
end sub

sub EnterKeyDown(sender as edit, key as integer, shift as integer)
     select case key
           case 13
                 sender.text=""
     end select
end sub

Mel
Posts: 32
Joined: Mon Dec 22, 2008 1:19 pm

Clear"edit" box

Post: # 605Post Mel
Thu Feb 11, 2010 12:47 pm

Thanks to all that replied.  I will give it a try and post back to let you know how it works out for me.
(A little background on me)
I started programming back in the days of Dos, line numbers, Goto, Gosub.  Then I did not program for a long time.  Just recently (last 2-3 years) I have started again.  I have found things very different.  So I hope that everyone will not become upset with my questions.  So far I find FNX to be very easy to use except for a few quirks that throw me off.
Thanks again!!!
Mel

Mel
Posts: 32
Joined: Mon Dec 22, 2008 1:19 pm

Clear"edit" box

Post: # 606Post Mel
Sun Feb 14, 2010 1:22 pm

HI all, I tried the program the way Magna gave me and it worked OK!! However I had to make a change in it. I wanted to be able to return to the "Mill" form and run another set of numbers if I wanted.  (ie. "set of numbers", yes I have a lot more to add to the program. Trying to build it up a block at a time) By having the richedit as part of the "Mill" form I could not do that. So I made another form called "OutPut" and made richedit part of that form. Now it works the way I want.

I am still experimenting with clearing, adding text, ect. to the "edit" box. In the help file for "Edit" it lists "OnClick" as an event, but when I try to use it I get a message that it is not a part of "Edit". Is there something extra that I need to do. All of the other events seem to work just fine. What am I missing?

Mel

magna
Posts: 30
Joined: Tue Nov 08, 2005 3:00 pm

Clear"edit" box

Post: # 607Post magna
Sun Feb 14, 2010 10:20 pm

Your`e totally right. This seems to be a bug. All other events for the Edit object are implemented but not OnClick. :(

Mayuri
Posts: 2
Joined: Mon Aug 29, 2011 9:02 am

Clear"edit" box

Post: # 608Post Mayuri
Mon Aug 29, 2011 9:08 am

how to write and read array record into file??

Post Reply