Guidance
指路人
g.yi.org
Guidance Forums / Rapid-Q Basic / GUIDANCE! Edit request!

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. GUIDANCE! Edit request!
#4582
Posted by: 2004-06-22 23:20:00
Hey Guidance, Steve S added a reply to the 'shadow' thread that should be a new subject really. Please make that thing a new thread? My reply to this one is my reply to his question, so move that too?
Message2. Re: GUIDANCE! Edit request!
#4583
Posted by: 2004-06-22 23:34:14
Using QRichEdit in UDTs
Posted by: Steve S (IP Logged)
Date: June 22, 2004 10:38PM

Steve a QRichEdit can be used to store loads of stuff, I always use an invisible one for file handling. What you can do is combine the text strings your program will use into textfiles, then read those into a QRichEdit and in-program process that file.

Here is a code sample; it is the way I prefer to pass data to my program because the .txt files can be easily imported into Excel.

 DIM RiEd AS QRICHEDIT
 RiEd.plaintext = 1
 RiEd.visible = 0
 RiEd.PARENT = Form

 f$ = "ProASTM.txt"
 RiEd.Clear
 RiEd.LoadFromFile(f$)
 a$ = RiEd.Text
 Apro = VAL(MID$(a$,9,8))

 DIM Pro$(Apro)
 DIM Dast(Apro)
 DIM Iast(Apro)
 DIM Sast(Apro)

 FOR x=1 TO Apro
  beg = x * 33 - 15
  Pro$(x) = MID$(a$,beg,8)
  Dast(x) = VAL(MID$(a$,beg+8,8))
  Iast(x) = VAL(MID$(a$,beg+16,8))
  Sast(x) = VAL(MID$(a$,beg+24,8))
 NEXT x
Of course you might want to build an editor to actually write the texts and whatnot; so you'll need to store stuff from there. The code below is the companion code to the above code for storing data;

 a$ = "Baardaap" + LEFT$(STR$(Apro)+"        ",8)
 FOR x=1 TO Apro
  a$=a$ + "*"+LEFT$(Pro$(x)+"       ",8)
  a$=a$ + LEFT$(STR$(nDast(x))+"       ",8)
  a$=a$ + LEFT$(STR$(nIast(x))+"       ",8)
  a$=a$ + LEFT$(STR$(nSast(x))+"       ",8)
 NEXT x
 f$ = "ProASTM.txt"
 RiEd.Clear
 RiEd.Text = a$
 RiEd.SaveToFile(f$)
As you can see I just pass a small amount of data around,  but QRichEdit can be multi line. Anyway, hope this is enough to get you started  :)
Message3. Re: GUIDANCE! Edit request!
#4587
Posted by: guidance 2004-06-23 14:28:20
Registered user can edit his posts at any time.

By the way, this Rapid-Q forum need a volunteer as moderator, anybody interested?
Message4. Re: GUIDANCE! Edit request!
#4691
Posted by: 2004-06-30 22:20:30
Sorry for the delay in acknowledgement but I can only access the web 1/2 times a week, from my son's house:)

The tip sounds useful but I'm trying to avoid using too many files and my main problem is creating a scenario writer for my text adventure prog which stores all the location descriptions and the associated "conditions".  It was suggested elsewhere that I could just grab the RichText.Text field, but I only found that out today, and haven't had a chance to get home and try it.  If all else fails, I may just have to resort to multiple files, though. :(

Thanks for the help, though.

SteveS.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2017-11-22  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0