AutoHotkey Community

It is currently May 26th, 2012, 7:51 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: July 8th, 2005, 9:29 pm 
Offline

Joined: February 24th, 2005, 8:45 am
Posts: 278
If someone needs to add a text line in which he want to change a specific words font and/or size, that can be very difficult... so is it possible to enhance the Gui, Add, Text command so it can do this easily ... i mean (something) like this:

Code:
Gui, Add, Text, , This Text is plain `, `(Font, S12 C2255BB, Comic Sans MS) While this text has changed font and colour `(Font)

Happy Scripting


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2005, 9:36 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
I was wondering how different formatting would be applied to text in RichEdit when it comes out. So far, I thought it would be something like, GuiControl, Format, (Control), (Colour), (Start Character), (End Character). However it's done, it would be a nice addition if other controls could adopt this type of formatting.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2005, 9:40 pm 
Offline

Joined: February 24th, 2005, 8:45 am
Posts: 278
Quote:
I was wondering how different formatting would be applied to text in RichEdit when it comes out

RichEdit? :S


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2005, 10:08 pm 
Offline

Joined: March 16th, 2005, 10:33 pm
Posts: 969
Location: Frisia
:D Yes, RichEdit, in other words: built in support for adding a RichEdit edit to a GUI (which could be done by DLLCall, like almost anything, but built in support is way easier to handle).

If I understand correctly Titan is wondering how formatting manipulation could be used and generalized for existing and to be added GUI elements, so, a syntax proposition.

Quote:
GuiControl, Format, (Control), (Colour), (Start Character), (End Character)


I don't think Colour would be enough though, RichEdit has many more possibilities/info, but your structure makes sense.

_________________
Image mirror 1mirror 2mirror 3ahk4.me • PM or Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2005, 10:26 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
By Colour, I also meant to say text size, fonts and whatever else is possible.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2005, 10:39 pm 
Offline

Joined: March 16th, 2005, 10:33 pm
Posts: 969
Location: Frisia
How about something like in this example:

GuiControl, Format, myRichEdit, fVerdana s14 b i cFFCCEE p, 15, 58

Would format the text from character 15 up to 58, font = Verdana, size = 14, bold, italic, color = FFCCEE and make it a paragraph

_________________
Image mirror 1mirror 2mirror 3ahk4.me • PM or Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2005, 10:53 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
That's the best way I can think of.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2005, 12:45 am 
Offline

Joined: March 16th, 2005, 10:33 pm
Posts: 969
Location: Frisia
Here is a good tutorial on RichEdit. It's in assembly, but after reading, I even understood it (a bit) :P It's all DLLCalls and SendMessages if I look at it right. Very good reading...

RichEdit Control - Basics, more at his main site

Here is a somewhat cynical guy, but he reports the possible errors, and provides coding methods.

The 3 different versions of the RichEd dll offer (or not) these functions:

Quote:
selection bar - all
unicode editing - 2,3
character/paragraph formatting - all
search for text - 1:forward, 2,3:forward/backward
OLE embedding - all
Drag and drop editing - all
Undo/Redo - 1:single-level, 2,3:multi-level
automatic URL recognition - 2,3
Accelerator key support - 2,3
Windowless operation - 2,3
Line break - 1:CRLF, 2:CR only, 3:CR only (can emulate version 1.0)
Zoom - 3
Paragraph numbering - 3
simple table - 3
normal and heading styles - 3
underline coloring - 3
hidden text - 3
font binding - 3


These are the files involved:

Quote:
Riched.dll - 236Kb - 98 <- This is identified as a Windows 95 version, but it is not on my Windows 95 system. It is on a Windows 98 system, has the same date, time, and version as one of the Riched32.dll files, but not the same size.

Riched32.dll - 174Kb - 95 <- This is identified as a Windows 95 version.

Riched32.dll - 184Kb - 98

Riched32.dll - 4Kb - XP <- The Windows XP version is just a wrapper for Riched20.dll.

Riched20.dll - 288Kb - 95 *version 2*
Riched20.dll - 422Kb - 98 *version 3*
Riched20.dll - 417Kb - XP *version 3*

_________________
Image mirror 1mirror 2mirror 3ahk4.me • PM or Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2005, 4:47 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Concerning the request at the top of this topic, it can't be done easily because Text controls do not support multiple colors. Therefore, each time the font changes in color or size, you would have to create a new Text control. This is not too hard if you use relative positioning:

Gui, Add, Text,, The word following word is shown in blue:%A_Space%
Gui, Add, Text, x+0 cBlue, Sky
Gui, Show


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group