en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en nl en en en en en en en en en en en en en en en en en en en en en en nl en en en en en en en fr en da en en en en en en en nl en en en pt fi en en en en en en en es en en en en en en en nl en en en en en en en en en en en en de en en en fr en en en en en en en en en pt en en en en en en
By logging into your account, you agree to our Privacy Policy, personal data processing and storage practices as described therein.
Forgot password or user name?
Search in titles only Search in PowerBASIC for Windows only
You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Best way to set RichEdit text buffer?
All Time Today Last Week Last Month
All Discussions only Photos only Videos only Links only Polls only Events only
Best way to set RichEdit text buffer?
11 Jun 2009, 08:49 AM
Since a user can select the entire text within a RichEdit control, capturing the selected text means I have to provide a buffer larger enough to hold the maximum amount of text the RE can hold. In my app, I've set that using EM_LIMITTEXT to 1MB.
My question is what is the best way to provide the appropriately sized buffer. In most of the examples I've seen, the buffer sizes are relatively small - I haven't seen an example with a huge buffer size.
The two methods I've considered are:
Create a global buffer variable using the RE size limit (should be slightly bigger, I suppose). No #STACK required. Global variable size limits are huge.
#Compile Exe #Dim All %RELimit = &H100000& Global REBuffer As Asciiz * %RELimit Function PBMain () As Long ... End Function
Create a Local variable, but using #STACK to make sure the SUB stack is large enough to hold the REBuffer.
#Compile Exe #Dim All #Stack &H200000& 'something bigger than REBuffer %D = &H100000& Function PBMain () As Long Call MySub End Function Sub MySub Local REBuffer As Asciiz * %D ... End Sub
In this last option, I could also use a string value, with some variation on this:
Local sBuffer As String sBuffer = Space$(%D) + Chr$(0)
Is there a common approach to this problem?
Join Date: Aug 1998
11 Jun 2009, 09:59 AM
Buffer$= STRING$(BufferSize&,0) GLOBAL MEM ALLOC Buffersize& to hMem pBuff = malloc(size) ' note 1 REDIM buff(BufferSize& -1) AS BYTE LOCAL|STATIC\GLOBAL|THREADED Buffer AS STRING * %Buffersize [ or AS ASCIIZ * %BUffersize + 1)
Note 1: Code at : malloc, realloc, free for PB/Win32 September 20, 2002)
Port Washington WI USA
Join Date: Feb 1999
11 Jun 2009, 01:47 PM
The best (and proper IMO) way to set and get text with a RichEdit control is to use the following messages:
Do a search of the forums for examples.
These commands allow you to move very large blocks of text (in the megabytes), to move only selected portions of the text (what is selected or highlighted) and to move text in either ascii or RTF (RichText Format).
If you want to get the most out of the RichEdit control start learning how to use these messages.
Join Date: Aug 2006
11 Jun 2009, 04:11 PM
Maybe this will be of help? or Maybe not
RTF made Easy for RichEdit
Engineer's Motto: If it aint broke take it apart and fix it
"If at 1st you don't succeed... call it version 1.0"
"Half of Programming is coding"....."The other 90% is DEBUGGING"
"Document my code????" .... "WHYYY??? do you think they call it CODE? "
Copyright © 1998-2022 PowerBASIC Tools, LLC - All Rights Reserved.
Powered by vBulletin® Version 5.7.0
Copyright © 2022 vBulletin Solutions, Inc. All rights reserved.
All times are GMT-5. This page was generated at 04:36 AM.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.