Re: Rich Edit confusion

new topic     » goto parent     » topic index » view thread      » older message » newer message

> 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>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu