I need a control which I can use as a simple text editor. A regular multiline string gadget would work, except for the 32K character limit.
I need only basic text editing and load from/save to a file. I can handle printing just by printing the text file, but I also might need to print just a selected portion of the text.
I am considering El_Choni's Rich Text library or the Scintilla text editor control. Does anyone have any other suggestions? The simpler, the better!
Thanks,
Eric
What to use for a Text Editing Gadget?
Hi ebs,
i try with an "EDIT" control, its seems to work with 64400 char.
>>> but I also might need to print just a selected portion of the text
You have to search with API to get selectet text inside control.
Run it and push OK Button to fill control (wait a little bit)
Here the code i've tried under Win98 SE.
Denis
i try with an "EDIT" control, its seems to work with 64400 char.
>>> but I also might need to print just a selected portion of the text
You have to search with API to get selectet text inside control.
Run it and push OK Button to fill control (wait a little bit)
Here the code i've tried under Win98 SE.
Code: Select all
#EditText = 200
#EditText2 = 201
#Button_OK = 202
#Button_Cancel = 203
Procedure CreateEditText()
hInstance = GetmoduleHandle_(0)
HwndEditText = CreateWindowEx_(#WS_EX_CLIENTEDGE,"EDIT","", #WS_VISIBLE | #WS_CHILDWINDOW | #ES_AUTOHSCROLL | #WS_VSCROLL | #ES_MULTILINE | #ES_WANTRETURN |#ES_NOHIDESEL, 50,50,300,300,WindowID(0),#EditText,hInstance,0)
HwndEditText1 = CreateWindowEx_(#WS_EX_CLIENTEDGE,"EDIT","", #WS_VISIBLE | #WS_CHILDWINDOW | #ES_AUTOHSCROLL | #WS_VSCROLL | #ES_MULTILINE | #ES_WANTRETURN |#ES_NOHIDESEL, 500,50,300,300,WindowID(0),#EditText2,hInstance,0)
EndProcedure
If OpenWindow(0,0,0,900,600,#PB_Window_SystemMenu | #PB_Window_ScreenCentered,"Basic Text Control")
CreateEditText()
If CreateGadgetList(WindowID())
ButtonGadget(#Button_OK, 50, 500, 30, 30, "Ok")
ButtonGadget(#Button_Cancel, 100, 500, 70, 30, "Cancel")
EndIf
EndIf
Repeat
Select WaitWindowEvent()
; Case #PB_Event_Menu
Select EventGadgetID()
Case #Button_OK
If Once = 0
string.s=""
; assign text to the String
For i=1 To 64400/2
String + "H" +"E"
Next i
string + "Z" ; last Char <> to verify inside the control
; write text inside 1st control
SetDlgItemText_(WindowID(0),#EditText,String)
;
Debug("Len(String)")
Debug(Len(String ))
Debug("")
string="" ; clear string
string1.s= Space(i*2) ; new string to get text
; ; get text from 1st controm and set String1 with it
GetDlgItemText_(WindowID(0),#EditText,String1,65000)
MessageRequester("","The 1st control has been set",16)
; write text inside 2nd control
SetDlgItemText_(WindowID(0),#EditText2,String1)
Debug("Len(String1)")
Debug(Len(String1))
once = 1
EndIf
Case #Button_Cancel
Quit = 1
EndSelect
Case #PB_EventCloseWindow
Quit = 1
EndSelect
Until quit
End Denis
A+
Denis
Denis
