<div dir="ltr">Have you played around with different values for selection? like self.text_edit.selection = 1,1.....etc.<br>If they all fail, you might want to try going in and firing off the actual underlying win32 message<br>
<br>Good luck<br><br><div class="gmail_quote">On Thu, Aug 14, 2008 at 7:56 PM, Igor Kaplan <span dir="ltr"><<a href="mailto:igor_kaplan@hotmail.com">igor_kaplan@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="blue" lang="EN-US">
<div>
<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Hi </span></font><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;">Jared,</span></font></p>
<p><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> </span></font></p>
<p><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> Thanks so much for your advice, it solved the problem of loading
file all into 1 line, so loading is so much faster now!</span></font></p>
<p><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> I am still trying to figure out the cursor movement issues.</span></font></p>
<p><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> </span></font></p>
<p><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> All the best.</span></font><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"></span></font></p>
<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<div>
<div style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">
<hr align="center" size="2" width="100%">
</span></font></div>
<p><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;"> <a name="11bc3a721a7fa093_OLE_LINK8"></a><a name="11bc3a721a7fa093_OLE_LINK7">Jared </a>Forsyth
[mailto:<a href="mailto:jabapyth@gmail.com" target="_blank">jabapyth@gmail.com</a>] <br>
<b><span style="font-weight: bold;">Sent:</span></b> Thursday, August 14, 2008
7:41 AM<br>
<b><span style="font-weight: bold;">To:</span></b> Igor Kaplan<br>
<b><span style="font-weight: bold;">Cc:</span></b> <a href="mailto:pythonce@python.org" target="_blank">pythonce@python.org</a><br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [PythonCE]
Programaticly moving cursor in multi-line edit control</span></font></p>
</div><div><div></div><div class="Wj3C7c">
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>
<div>
<p style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">The way to preserve
linebreaks is tp replace "\n" with "\r\n"<br>
so: self.text_entry.text = fl.read().replace("\n","\r\n")</span></font></p>
<div>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">On Wed, Aug 13, 2008 at 8:05 PM, Igor Kaplan <<a href="mailto:igor_kaplan@hotmail.com" target="_blank">igor_kaplan@hotmail.com</a>> wrote:</span></font></p>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">Hello,<br>
<br>
I would like to ask a little advice. Already several days I am trying to<br>
figure out the following problem using ppygui: How to move the cursor in the<br>
edit field to the top of that field.<br>
In my code I create the frame and then Edit control:<br>
Self.text_entry = gui.Edit(multiline=True)<br>
sizer = gui.VBox(border=(2,2,2,2), spacing=2)<br>
sizer.add(self.text_entry)<br>
.<br>
<br>
Later I open the text file and copy it's context into that edit control:<br>
fl = open(self.filename, 'r')<br>
l = fl.readlines()<br>
self.text_entry.text = ""<br>
for i in l:<br>
self.text_entry.append(i)<br>
<br>
Only reason why I add the text such long way because if I just do:<br>
Self.text_entry.text = fl.read()<br>
I looze all line breaks and all text goes into 1 line.<br>
<br>
After opening that file I do:<br>
Self.text_entry.selection = 0, 0<br>
<br>
And that line does nothing. For some reasons the cursor always positions<br>
at the same spot in the Edit box after opening the file, somewhere in the<br>
middle and does not want to go to the beginning.<br>
<br>
I also have another event:<br>
Def OnBegin(self, event):<br>
Self.text_entry.selection = 0, 0<br>
<br>
That event executes on menu item. And something interesting is going on.<br>
Sometimes cursor goes to the beginning of the edit control as it should do,<br>
sometimes moves to some line of the edit box, again, somewhere at the<br>
middle, sometimes just stays where it was.<br>
<br>
I am not sure, if I am doing something incorrectly or positioning of the<br>
cursor does not work in ppygui?<br>
Would greatly appreciate any advice!<br>
<br>
Many thanks.<br>
<br>
Igor.<br>
<br>
<br>
_______________________________________________<br>
PythonCE mailing list<br>
<a href="mailto:PythonCE@python.org" target="_blank">PythonCE@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/pythonce" target="_blank">http://mail.python.org/mailman/listinfo/pythonce</a></span></font></p>
</div>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>
</div>
</div></div></div>
</div>
</blockquote></div><br></div>