It is currently Fri Aug 23, 2019 2:24 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: "Word wrap" in multi-line StringGadgets?
PostPosted: Wed Jun 11, 2003 11:58 pm 
Offline
New User
New User

Joined: Fri May 02, 2003 9:35 am
Posts: 7
Location: Denmark
I can't seem to find a way to auto word wrap user input in a multi-line StringGadget.

I found this old thread and some others, but none of them give a solution that works.
It would seem a natural thing, as right-justified StingGadgets can be tricked into wrapping just fine!!

No user can be expected to enter text in a field that scrolls sideways!
Come on, please tell me this has been worked out for v. 3.70! Anyone?

/Jones

_________________
<FONT color="DarkGray" size="1">Registered PureBasic user. (Win 98 2nd, AMD Duron, 800 MHz, 192 MB RAM)</FONT>


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Jun 12, 2003 12:06 am 
Offline
New User
New User

Joined: Fri May 02, 2003 9:35 am
Posts: 7
Location: Denmark
Sorry, I have to use the EditorGadget of course.

Here's the code from El_Choni.

/Jones

_________________
<FONT color="DarkGray" size="1">Registered PureBasic user. (Win 98 2nd, AMD Duron, 800 MHz, 192 MB RAM)</FONT>


Top
 Profile  
Reply with quote  
 Post subject: Re: "Word wrap" in multi-line StringGadgets?
PostPosted: Thu Jun 12, 2003 5:25 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Fri Apr 25, 2003 5:24 pm
Posts: 7581
> I can't seem to find a way to auto word wrap user input in a
> multi-line StringGadget.

Here ya go (thanks to FangBeast for the disable flags):

Code:
If OpenWindow(0,200,200,300,200,#PB_Window_SystemMenu,"test")
  CreateGadgetList(WindowID())
  t$="This text goes inside a multiline StringGadget."+Chr(13)+Chr(10)
  For r=1 To 10 : t$+Str(r)+Chr(13)+Chr(10) : Next
  StringGadget(0,10,10,200,100,t$,#PB_String_Multiline|#ES_AUTOVSCROLL|#WS_VSCROLL|#WS_HSCROLL|#ESB_DISABLE_LEFT|#ESB_DISABLE_RIGHT)
  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf


Top
 Profile  
Reply with quote  
 Post subject: Aww shucks.
PostPosted: Thu Jun 12, 2003 6:44 am 
Offline
PureBasic Protozoa
PureBasic Protozoa
User avatar

Joined: Fri Apr 25, 2003 3:08 pm
Posts: 4483
Location: Not Sydney!!! (Bad water, no goats)
Can't take credit for this, found this on the forum last year (the old forum) :):)

_________________
Amateur Radio, D-STAR/VK3HAF


Top
 Profile  
Reply with quote  
 Post subject: Re: "Word wrap" in multi-line StringGadgets?
PostPosted: Wed Oct 29, 2003 9:42 pm 
Offline
User
User

Joined: Fri Oct 24, 2003 5:49 am
Posts: 21
Location: Redlands, CA
PB wrote:
#ES_AUTOVSCROLL #WS_VSCROLL #WS_HSCROLL #ESB_DISABLE_LEFT #ESB_DISABLE_RIGHT
Where do these come from? I tried searching in the help menu for them, but haven't been able to find them yet. Where can I find more information on them?

It seems that autovscroll sets it to automatically scroll vertically. I don't really see why hscroll is needed. Disable_left and disable_right must stop the code from scolling past the edge of the box to the left and the right.

But why do these codes turn the string box into a right-justified box? Perhaps it's hscroll that makes the box become right-justified?

_________________
--BX


Top
 Profile  
Reply with quote  
 Post subject: Re: "Word wrap" in multi-line StringGadgets?
PostPosted: Wed Oct 29, 2003 9:55 pm 
Offline
User
User

Joined: Fri Oct 24, 2003 5:49 am
Posts: 21
Location: Redlands, CA
Why does this work? Comments inline
Code:
If OpenWindow(0,200,200,300,200,#PB_Window_SystemMenu,"test")
  CreateGadgetList(WindowID())
  t$="This text goes inside a multiline StringGadget."+Chr(13)+Chr(10)
;a string variable was created -- t$ is equal to the text plus some control characters
;t$ is displayed when the StringGadget is created later on

  For r=1 To 10 : t$+Str(r)+Chr(13)+Chr(10) : Next
;text has been created -- but this information shouldn't be displayed
;see further comments after the code

  StringGadget(0,10,10,200,100,t$)
;we display t$ at this point when we create the stringgadget

  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf

That text, t$+Str(r)+Chr(13)+Chr(10), shouldn't be displayed from what I can tell. It's not saved to a variable, so it has to be displayed right then. But, SetGadgetText() isn't used, Print() isn't used . . . from what I can tell, this text shouldn't be displaying. And yet, somehow, it displays. Why? What am I missing?

Thanks. :)

_________________
--BX


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye