Back again with hopefully another quickie:
I'm using a RichEdit box in my app as a communications log and a ComboBox as a command string input box. I'm using the CBS_DROPDOWN flag and storing a recent history of strings in it for recalling. The problem I'm having is when logging communication from the remote device, _GUIRichEdit_AppendText calls _WinAPI_SetFocus on the richedit which takes focus away from my combobox, so then I have to call _WinAPI_SetFocus on the combobox again. This causes the combobox to highlight everything in itself. If I'm typing when something happens in the log, I lose what I'm typing because it basically did a "Select All" and my typing overwrote the selected text.
My try at two solutions:
1) I edited GuiRichEdit.au3 and removed the _WinAPI_SetFocus call in the _AppendText function. When you do this, the richedit doesn't scroll vertically automatically anymore. So I added _GUIRichEdit_ScrollLines calls and tried counting how many lines and blah blah blah and it always screws up the scroll and never works right.
2) After putting the SetFocus back in the AU3 so that scrolling works correctly, I thought to myself "I'll just get the current selection in the combobox (which should be nothing most of the time) before appending text, then set the selection again after appending and everything should be great." So I added the functions and after much debugging and cursing found the note that says you can't use GetCurEditSel/SetCurEditSel if you use the $CBS_DROPDOWN flag or it will return an error.
So I'm stuck again looking for ideas. I wish I could just say "Scroll 100%" but it doesn't seem to work like that.
I'm using a RichEdit box in my app as a communications log and a ComboBox as a command string input box. I'm using the CBS_DROPDOWN flag and storing a recent history of strings in it for recalling. The problem I'm having is when logging communication from the remote device, _GUIRichEdit_AppendText calls _WinAPI_SetFocus on the richedit which takes focus away from my combobox, so then I have to call _WinAPI_SetFocus on the combobox again. This causes the combobox to highlight everything in itself. If I'm typing when something happens in the log, I lose what I'm typing because it basically did a "Select All" and my typing overwrote the selected text.
My try at two solutions:
1) I edited GuiRichEdit.au3 and removed the _WinAPI_SetFocus call in the _AppendText function. When you do this, the richedit doesn't scroll vertically automatically anymore. So I added _GUIRichEdit_ScrollLines calls and tried counting how many lines and blah blah blah and it always screws up the scroll and never works right.
2) After putting the SetFocus back in the AU3 so that scrolling works correctly, I thought to myself "I'll just get the current selection in the combobox (which should be nothing most of the time) before appending text, then set the selection again after appending and everything should be great." So I added the functions and after much debugging and cursing found the note that says you can't use GetCurEditSel/SetCurEditSel if you use the $CBS_DROPDOWN flag or it will return an error.
So I'm stuck again looking for ideas. I wish I could just say "Scroll 100%" but it doesn't seem to work like that.