1. Rich Edit confusion
Hi,
I have to questions involving the rich edit control.
1) I want to setFont to a richedit control. simly using setFont isn't
working, Please tell me what is going on or what i have to do to setFont to
a RichEdit Control(without need for going through the font dialog)?
2)In case you want to select all text in a richedit control, it says in the
documentaion that you can simply use setIndex(RE,{0,-1}). This is not
working. I'm currently using the patched up version of win32lib ie 55.5?
Some one please tell me how i can select all items in a RichEdit control.
Hope to get feed Back.
Jordah
<jorfergie03 at yahoo.com>
2. Rich Edit confusion
Hi,
I have to questions involving the rich edit control.
1) I want to setFont to a richedit control. simly using setFont isn't
working, Please tell me what is going on or what i have to do to setFont to
a RichEdit Control(without need for going through the font dialog)?
2)In case you want to select all text in a richedit control, it says in the
documentaion that you can simply use setIndex(RE,{0,-1}). This is not
working. I'm currently using the patched up version of win32lib ie 55.5?
Some one please tell me how i can select all items in a RichEdit control.
Hope to get feed Back.
Jordah
<jorfergie03 at yahoo.com>
3. Re: Rich Edit confusion
- Posted by euman at bellsouth.net
Mar 01, 2002
> Hi,
> I have to questions involving the rich edit control.
> 1) I want to setFont to a richedit control. simly using setFont isn't
> working, Please tell me what is going on or what i have to do to setFont to
> a RichEdit Control(without need for going through the font dialog)?
Jordah I dont use win32lib but this works for me everytime.
Get a copy of the MS SDK if you dont already have it.
Dont get the Borland or LCC version get MS' version.
its more helpfull I think to have .chm help instead of the old
style windows help.
Im not entirly sure Win32lib is set up like this infact I think it
has some sort of custom built deal to handle fonts.
Maybe this needs to be put into the library.
Here's the code! good luck!
xCreateFont = link_c_func(gdi32,"CreateFontA",{C_INT, C_INT, C_INT, C_INT,
C_INT, C_INT,
C_INT, C_INT, C_INT, C_INT,
C_INT, C_INT,
C_INT, C_POINTER}, C_INT)
function CreateFont(integer nHeight, integer nWidth, integer nEsc, integer
nOrient, integer fnWidth,
atom fdwItal, atom fdwUnd, atom fdwStr, atom fdwChar, atom
OutPrec, atom cliPric,
atom fdwQual, atom fdwPitch, atom fntname)
atom font
font =
c_func(xCreateFont,{nHeight,nWidth,nEsc,nOrient,fnWidth,fdwItal,fdwUnd,fdwStr,
fdwChar,OutPrec,cliPric,fdwQual,fdwPitch,fntname})
return font
end function
constant TRANSPARENT = 1
constant TA_CENTER = 6,
TA_LEFT = 0
constant FW_NORMAL = 400,
ANSI_CHARSET = 0,
OUT_DEFAULT_PRECIS = 0,
CLIP_DEFAULT_PRECIS = 0,
DEFAULT_QUALITY = 0,
DEFAULT_PITCH = 0,
FF_DONTCARE = 0
constant
ANSI_FIXED_FONT = 11,
ANSI_VAR_FONT = 12,
DEFAULT_GUI_FONT = 17
-- hope I copied all the constants if not let me know jordah
global atom fnt, hnewfnt, fntname, item
global procedure Create_fonts()
fntname = allocate_string("Sans Serif") --Substitute you font choice
->"Sans Serif"
fnt = CreateFont(16, 0, 0, 0, FW_NORMAL, 0, 0, 0, ANSI_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH + FF_DONTCARE,
fntname)
--16 is the font size
free(fntname)
end procedure
-- Create you Richedit control "name it Edit"
junk = SendMessage(Edit, WM_SETFONT, fnt, 0)
> 2)In case you want to select all text in a richedit control, it says in the
> documentaion that you can simply use setIndex(RE,{0,-1}). This is not
> working. I'm currently using the patched up version of win32lib ie 55.5?
> Some one please tell me how i can select all items in a RichEdit control.
junk = SendMessage(Edit,EM_SETSEL, num_chars,-1)
Euman
euman at bellsouth.net
>
>
> Hope to get feed Back.
>
> Jordah
> <jorfergie03 at yahoo.com>
4. Re: Rich Edit confusion
- Posted by akusaya at gmx.net
Mar 02, 2002
j> Hi, I have to questions involving the rich edit control.
j> 1) I want to setFont to a richedit control. simly using
j> setFont isn't working, Please tell me what is going on
j> or what i have to do to setFont to a RichEdit
j> Control(without need for going through the font dialog)?
This is what I use in my program:
teks is RichEdit
font = getFontDialog( teks )
if sequence(font) then
setIndex(teks, {1, -1})
setFont( teks, {font[4],font[1]}, font[2], font[3] )
end if
j> 2)In case you want to select all text in a richedit
j> control, it says in the documentaion that you can simply
j> use setIndex(RE,{0,-1}). This is not working. I'm
j> currently using the patched up version of win32lib ie
j> 55.5? Some one please tell me how i can select all items
j> in a RichEdit control.
I used setIndex(RE, {1,-1}) and it worked.
Maybe the documentation need to be edited.