Guidance
指路人
g.yi.org
Guidance Forums / Rapid-Q Basic / Integers and Qedit

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Integers and Qedit
#982
Posted by: 2003-06-10 05:23:30
Hiya I how do I accpet an integer from a Qedit object?

I want to be able to say

DIM edit as QEDIT


form etc
EDIT parent..... etc etc



IF edit > 6 then showmessage "must be below 6"
if EDIT <0 then etc......

I only only get if statements to work as a string but this is no good, you can imagine the amount of IF statements I would require.  I can post source code if required

Thanks for any help.
Message2. Re: Integers and Qedit
#983
Posted by: 2003-06-10 07:06:02
use

value = VAL(Qedit.Text)

Qedits contain text, VAL turns the text into a value.
To put a value in a Qedit use

Qedit.text = STR$(value)
Message3. Re: Integers and Qedit
#989
Posted by: 2003-06-12 22:56:44
it still dosn't work, this is my section of that code:

dim stylewidthnumber as integer.......................

stylewidthnumber=Val(sylewidthedit.Text)
stylewidthedit.text = STR$(stylewidthnumber)
if stylewidthnumber <1 then showmessage = "must be greater 0"
Message4. Re: Integers and Qedit
#990
Posted by: 2003-06-12 23:01:21
the line

stylewidthnumber=Val(sylewidthedit.Text)

should be

stylewidthnumber=Val(sTylewidthedit.Text)

I presume ?

Message5. Re: Integers and Qedit
#991
Posted by: 2003-06-12 23:04:40
And an integer is a whole number, a QEdit text could well have a fractional component. So maybe you need to use

stylewidthnumber = INT( Val(stylewidthedit.Text) )

Mind you, this does not round the number but cuts the decimal part off, so I'd use

stylewidthnumber = INT( Val(stylewidthedit.Text) + 0.44 )

Message6. Re: Integers and Qedit
#992
Posted by: 2003-06-12 23:22:18
Instead of using a shedload of IF's you could use CASE .... SELECT (see the Rapid Q documentation)


Alternatively use an array of texts to be displayed* and use the value to display the appropriate text, for example;

Qedit.Text = choice$( int( val( stylewidth.text ) + 0.44 ) )



Alternatively use a QComboBox instead of a QEdit, fill the box with the choices / texts. That works for choosing VALUES too, for example;

for x=1 to 7
   a$ = "  "+ Str$(x)
   StyleBox.AddItems = a$
 next x


Use value = StyleBox.ItemIndex + 1 (it starts counting at 0) to get the number of the item chosen




If you were clearer on what you are trying to do the answers you get
would be more appropriate  :P



* set up the texts to be used at the very start of the program ...

  Dim choice$(required number)
   for x=0 to required number
      read choice$(x)
   next x

 data "minimum value is 1 !","choice is number one","number 2"


etcetera

Message7. Re: Integers and Qedit
#994
Posted by: 2003-06-13 00:45:51
thanks, I am just making an HTML editor and I have a a bit where you can had a horizontal rule, I just need to make a maximum value as its designed for absolute bigeners of HTML.

Also I don't suppose you know how to get bold, italic and other information from the font dialogue box do you? so far I can only get font name, colour and size to work. Thanks
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥860.00 ·
 
 
¥410.00 ·
 
 
¥288.00 ·
 
 
¥918.00 ·
 
 
¥288.00 ·
 
 
¥264.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0