stringgadget scrollbars?

Just starting out? Need help? Post your questions and find answers here.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

stringgadget scrollbars?

Post by thefool »

Hi! Im making a minimalistic pb util, and i need a multiline stringgadget
with BOTH vertical and horizontal scrollbars. I know this maybe is a very much newbie question, but i have never used them before. notice it is a stringgadget, not an editorgadget

edit: Sorry. didnt think of stringadgets size limit. I want to use an editorgadget instead. Please notice that when telling me how to use scrollbars :oops:

and by the way sorry for posting such noob's questions like this, but i am really really tired, and i just would like to fix this before going to bed.
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

Well I'm afraid I dont know how to do it with an editor gadget, but I know how to add the scrollbars to a string gadget. I thought I'd add it here so that at least if anyone searchs for it they might stand a chance.
You add the constants #WS_VSCROLL and #WS_HSCROLL as flags to the stringgadget() command to add vertical and horizontal scrollbars (respectively). Sorry this doesnt help you thefool, but it might help someone.
upnorth
User
User
Posts: 18
Joined: Wed Jul 21, 2004 8:54 pm
Location: California, USA

Post by upnorth »

I have been doing some experimenting with the EditorGadget and found that both the Vertical and Horizontal Scroll Bars appear only when they are needed. Since EditorGadgets do automatic word wrapping, you have to have unbroken lines of text that extend beyond the right edge of the Gadget before the Horizontal Scrollbar appears, and more lines of text than will fit in the control before the Vertical Scrollbar appears.

Apparently it's possible to replace the automatic word wrap procedure with one of your own. Here's a bunch of info on the RichText Control (EditorGadget) at Microsoft: <A TARGET=_NEW HREF="http://msdn.microsoft.com/library/defau ... asp">About Rich Edit Controls </A>

Hope this helps.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

i tried with stringgadget, but cant get the vertical scrollbar to work
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

Here, try this code

Code: Select all

ret$=Chr(13)+Chr(10)
OpenWindow(0,20,20,120,100,#PB_Window_ScreenCentered | #PB_Window_SystemMenu,"Scrollable stringgadget")
If CreateGadgetList(WindowID())
  StringGadget(0,0,0,120,100,"How about now, do you have"+ret$+"both of the"+ret$+"scrollbars"+ret$+"You do need to make it multiline"+ret$+ret$+ret$+ret$+ret$+ret$+"Hope it works",  #PB_String_Multiline | #ES_AUTOVSCROLL | #WS_VSCROLL | #WS_HSCROLL );| #ESB_DISABLE_LEFT| #ESB_DISABLE_RIGHT)
EndIf
  
Repeat 
Until WaitWindowEvent()=#PB_Event_CloseWindow
The two flags I've commented out are useful too. If you remove the #WS_HSCROLL flag and put those two in you should get your text properly wrapped to the width of your gadget, and only scroll up and down available.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Thanks very much :D It works very cool now.
it should be included in the help file how to do this :)
but it works now. Im just trying to make a very small and fast editor, just with the needed features. i know i got notepad, but i wanna write my own :) also for having something to do :P
I know this is only a small project, but still everyone should make at least
one simple editor :D
just for knowing how to deal with menu's and stuff like that.
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

For my first project I made a little dictionary program. I think it was a pretty good way to start. It sat in the taskbar, so I learnt how to do that. Obviously had file-handling for the dictionary files. And general things like string handling and window tricks. Taught me quite a lot.
Post Reply