Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 262167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:29:35+00:00 2026-05-11T22:29:35+00:00

I’m writing my first gtk2hs+glade application, and I’m using a textview to display output

  • 0

I’m writing my first gtk2hs+glade application, and I’m using a textview to display output from the program. Instead of scrolling which I thought was supposed to be the default behavior, the textview gets bigger everytime I re-set the text, and makes my buttons below it smaller until they disappear, but the scroll bars never pop up, and it never scrolls. Am I supposed to do something special to get it to scroll? Here is the main function I’m using at the moment, forgive the dirty code, I intend to house-clean later. 🙂

main :: FilePath -> IO ()
main gladepath = do
initGUI
-- Create inital game state
st <- newIORef (State "" "" "" 0 0 0)
-- Get handles to all needed widgets from Glade file
Just xml <- xmlNew gladepath
mw     <- xmlGetWidget xml castToWindow "mainWindow"
sw     <- xmlGetWidget xml castToWindow "window2"
mb     <- xmlGetWidget xml castToButton "fireButton"
ng     <- xmlGetWidget xml castToButton "nbutton"
mv     <- xmlGetWidget xml castToTextView "textview1"
but    <- xmlGetWidget xml castToButton "button1"
ab     <- xmlGetWidget xml castToAboutDialog "aboutdialog1"
menu   <- xmlGetWidget xml castToMenuItem "menuitem3"
about  <- xmlGetWidget xml castToMenuItem "imagemenuitem10"
quitb  <- xmlGetWidget xml castToMenuItem "menuitem3"
p1name <- xmlGetWidget xml castToEntry "entry1"
p2name <- xmlGetWidget xml castToEntry "entry2"
spin   <- xmlGetWidget xml castToSpinButton "spinbutton1"
sett   <- xmlGetWidget xml castToMenuItem "menuitem2"
p1lab  <- xmlGetWidget xml castToLabel "label4"
p2lab  <- xmlGetWidget xml castToLabel "label5"
cylab  <- xmlGetWidget xml castToLabel "label6"
-- Handle events and such
buff <- textViewGetBuffer mv
onActivateLeaf quitb mainQuit
onResponse ab $ \resp -> 
   case resp of
      ResponseClose -> widgetHide ab
      _             -> widgetHide ab
onActivateLeaf about $ widgetShow ab
onActivateLeaf sett  $ widgetShowAll sw
onDelete sw $ \_ -> widgetHide sw >> return True
onClicked but $ 
          initalize sw p1name p2name spin st p1lab p2lab cylab buff
onClicked ng $ widgetShowAll sw
onDelete ab $ \_ -> widgetHide ab >> return True
onClicked mb $ fireButton st sw buff cylab
onActivateLeaf menu $ widgetDestroy mw
onDestroy mw mainQuit
widgetShowAll mw
mainGUI

If you need anything else, please request it in a comment. I’m not sure if I need to provide anything else.

The glade file is too large to show here, but I pasted it here in case someone needs it: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=6310#a6310

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:29:35+00:00Added an answer on May 11, 2026 at 10:29 pm

    I’ve managed to solve my own problem after speaking with Axel on the gtk2hs mailing list.

    TextViews are designed so that they can be a single line of text, or a multiline TextView with scroll bars. If you want scrolling capabilities, you have to put the TextView into a Scrolled Window. I solved my problem by placing my TextView into a Scrolled Window, it works perfectly now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.