Have you played around with different values for selection? like
self.text_edit.selection = 1,1.....etc.
If they all fail, you might want to try going in and firing off the actual
underlying win32 message

Good luck

On Thu, Aug 14, 2008 at 7:56 PM, Igor Kaplan <[EMAIL PROTECTED]>wrote:

>  Hi Jared,
>
>
>
>   Thanks so much for your advice, it solved the problem of loading file all
> into 1 line, so loading is so much faster now!
>
>   I am still trying to figure out the cursor movement issues.
>
>
>
>   All the best.
>
>
>  ------------------------------
>
> *From:* Jared Forsyth [mailto:[EMAIL PROTECTED]
> *Sent:* Thursday, August 14, 2008 7:41 AM
> *To:* Igor Kaplan
> *Cc:* pythonce@python.org
> *Subject:* Re: [PythonCE] Programaticly moving cursor in multi-line edit
> control
>
>
>
> The way to preserve linebreaks is tp replace "\n" with "\r\n"
> so: self.text_entry.text = fl.read().replace("\n","\r\n")
>
> On Wed, Aug 13, 2008 at 8:05 PM, Igor Kaplan <[EMAIL PROTECTED]>
> wrote:
>
> Hello,
>
>  I would like to ask a little advice. Already several days I am trying to
> figure out the following problem using ppygui: How to move the cursor in
> the
> edit field to the top of that field.
>  In my code I create the frame and then Edit control:
> Self.text_entry = gui.Edit(multiline=True)
>    sizer = gui.VBox(border=(2,2,2,2), spacing=2)
>    sizer.add(self.text_entry)
> .
>
>  Later I open the text file and copy it's context into that edit control:
>    fl = open(self.filename, 'r')
>    l = fl.readlines()
>    self.text_entry.text = ""
>    for i in l:
>      self.text_entry.append(i)
>
>  Only reason why I add the text such long way because if I just do:
> Self.text_entry.text = fl.read()
> I looze all line breaks and all text goes into 1 line.
>
>  After opening that file I do:
> Self.text_entry.selection = 0, 0
>
>  And that line does nothing. For some reasons the cursor always positions
> at the same spot in the Edit box after opening the file, somewhere in the
> middle and does not want to go to the beginning.
>
>  I also have another event:
> Def OnBegin(self, event):
>  Self.text_entry.selection = 0, 0
>
>  That event executes on menu item. And something interesting is going on.
> Sometimes cursor goes to the beginning of the edit control as it should do,
> sometimes moves to some line of the edit box, again, somewhere at the
> middle, sometimes just stays where it was.
>
>  I am not sure, if I am doing something incorrectly or positioning of the
> cursor does not work in ppygui?
>  Would greatly appreciate any advice!
>
>  Many thanks.
>
>   Igor.
>
>
> _______________________________________________
> PythonCE mailing list
> PythonCE@python.org
> http://mail.python.org/mailman/listinfo/pythonce
>
>
>
_______________________________________________
PythonCE mailing list
PythonCE@python.org
http://mail.python.org/mailman/listinfo/pythonce

Reply via email to