Results 1 to 9 of 9

Thread: CL_TextEdit and CL_ScrollBar = RichText Display, but some problem I can't solved.

  1. #1
    Lesser Knight
    Join Date
    Sep 2011
    Posts
    38

    Question CL_TextEdit and CL_ScrollBar = RichText Display, but some problem I can't solved.

    Hi , everyone. I have a question with the RichText Component.
    In my idea, I create a CL_TextEdit and a CL_ScrollBar independently.
    This is my class:
    Code:
    class RichText{
    public:
        CL_TextEdit  *text;
        CL_ScrollBar *scrollbar;
    }
    So, when scrollbar is scrolling the slot-signal function can change the position of textEdit immediately!
    But, here comes the problem.
    I don't know how to get the location of cursor in textEdit or how to set the position in textEdit by line number, and other problem is the setting function of textEdit seems not enough to fix this problem.
    I'm a newbie here, if my question is stupid plz tell me

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    I don't understand what you are trying to do. Doesn't CL_TextEdit have its own scrollbar?

  3. #3
    Lesser Knight
    Join Date
    Sep 2011
    Posts
    38

    Default

    Really !?
    In this thread : http://www.rtsoft.com/forums/showthr...light=textedit
    It said it didn't have...
    Then I try to make two component , one is textedit and one is scrollbar. And doing some works to combine them.
    Name:  test.png
Views: 8
Size:  6.1 KB
    This is how it look now. And it's fail .

    If it has a function which can auto create a scrollbar when the text is overflow textedit's heigh,how do I set it?

  4. #4
    Lesser Knight
    Join Date
    Sep 2011
    Posts
    38

    Default

    The textedit doesn't add scrollbar when is too height.
    Can any one help me?
    Code:
    text = new CL_TextEdit(cl_preload);
    text->set_geometry(CL_Rect(50,20, CL_Size(200,300)));
    for( int i=0; i<20; i++ )
    {
    	text->add_text("test"); 
    }

  5. #5
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    OK, so the control was never finished.

    Anyway it was intended the scrollbar was a part of CL_TextEdit appearing automatically. Seems someone didn't need the feature and stopped prematurely. You could either add that to CL_TextEdit (we accept patches), or you could attempt to use the scintilla based text editor available at svn://esoteric.clanlib.org/ClanLib/Development/Contrib/GameIDE/GameIDE/TextEditor

  6. #6
    Lesser Knight
    Join Date
    Sep 2011
    Posts
    38

    Default

    @Norddahl
    Thanks for your response and advice
    SVN sounds difficult
    And the "scintilla based text editor" is a new part of ClanLib ?
    Well...I would try to add the scrollbar in textedit first.
    ---
    How can I change the view point at the textedit ?
    In ListView, I see that ListView can scroll down/up. How can I do that in textedit?

  7. #7
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Download the clanlib source http://clanlib.org/download/releases...nLib-2.3.5.zip

    And examine Sources/GUI/Components. A lot of the source was written a long time ago, and I will be surprised if anyone remembers.

    (I have never used it myself)

  8. #8
    Lesser Knight
    Join Date
    Sep 2011
    Posts
    38

    Default

    After some studying,I find that there is a variable called "rect_view" in listView which seems control the shown-area.
    But ,in texted, it doesn't have( I find a similar variable called "content_rect". Maybe I wrong. ).
    And I find the function called "on_render". "on_render" draws the grahpic by *gc* and *update_rect*.
    I'm not sure what update_rect do, maybe is a new location for the component ?

    ListView use ListViewLayout to control the visiable area, but textedit didn't have this function.
    I guess that's why textedit can't scroll down/up.

  9. #9
    Lesser Knight
    Join Date
    Sep 2011
    Posts
    38

    Default

    How can I edit the Source code and test it in my project?
    Or I have to compile hole ClanLib by myself again?
    I want to add a CL_ScrollBar in CL_Textedit, but the CL_Textedit's impl is private...

    BR,
    apple

Similar Threads

  1. CL_TextEdit
    By Jason Schilling in forum Official ClanLib SDK Forums
    Replies: 7
    Last Post: 08-13-2012, 02:41 AM
  2. CL2.1.0 display problems
    By supap in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 11-17-2009, 07:50 AM
  3. Unable to display anything.
    By Dermark in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 06-11-2008, 01:08 PM
  4. problem with CL_Surface display a PNG
    By lurker2000wxc in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 03-14-2008, 09:18 AM
  5. Green border around rotated sprite on ATI cards - Solved!
    By pTymN in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 11-06-2006, 08:44 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •