Solved

JVCL scroll the HelpPanel text

Posted on 2006-11-13
10
551 Views
Last Modified: 2010-04-05
Hi guys,

Can anyone give me a source example of ho do add vertical scroll to the HelpPanel of the JVCL please?

* I tried Inheritance, but i'm DON'T know much about OO, so i probably didnt do it right.
* I also tried HelpPanel.Parent:=ScrollBox, but that put ALL the JVCL's HelpPanel inside the Scroll Box, and i need only the text part, NOT all the HelpPanel componnent.
* There is no WordWrap Property to the HelpPanel componnent.
* There is no ScrollBars Property to the HelpPanel componnent.

I'm begginer Delphi lover, so please give me a working and documented (as much as you can)

MANY thanks
0
Comment
Question by:ebi1
  • 6
  • 4
10 Comments
 

Author Comment

by:ebi1
ID: 17929162
Oh, and one more thing i forgot.

The Font Property, doesn't seem to work at all.
Nothing that i do changes anything in Capstion of the HelpPanel.
Changin the Font.Color, Font.Name, Font.Size, Font.Style Etc' make no difference.
Am i doing something wrong, or is it a bug in the componnent?

After adding this other questiong (about the same componnent ) i'm changing the points and raise it to 350.

MANY thanks (again)
0
 

Author Comment

by:ebi1
ID: 17929167
oops...
0
 
LVL 28

Expert Comment

by:TName
ID: 17931775
Hi ebi1,
It's quite easy to do (after finding the component!! I guess you mean JvgHelpPanel on the JVCL Globus 2  tab of the Jedi VCL...) but you'd have to add two lines to the source of JvgHelpPanel.pas, and I'm not sure if that would be such a good idea if you're unexperienced...

You'd have to go to  ...JVCL3.0\jvcl\lib\d7 (the name of the last directory depends on the Delphi version) and rename JvgHelpPanel.dcu to something else (so Delphi won't find it and you'd still have it as a backup). Then you'd have to add the directory in which the pas file (JvgHelpPanel.pas) is located (in my case ...\JVCL3.0\jvcl\run) to the library path:
Tools > Environment Options > Library -> Library Path

//then you'd have to add 2 lines to JvgHelpPanel.pas:

interface

uses

  {$IFDEF USEJVCL}
  {$IFDEF UNITVERSIONING}
  JclUnitVersioning,
  {$ENDIF UNITVERSIONING}
  {$ENDIF USEJVCL}
  StdCtrls,//  <-----------------------------------------------------------this
  Windows, Messages, SysUtils, Classes, Graphics, Controls,
  {$IFDEF USEJVCL}

//and in the constructor (constructor TJvgHelpPanel.Create(...)):

 if not (csDesigning in ComponentState) then
  begin
    FRich := TRichEdit.Create(Self);
    FRich.Parent := Self;
    FRich.ReadOnly := True;
    FRich.ScrollBars:=ssVertical;  //<-----------------------------------this
  end;


BTW, this would change the font (in the Paint procedure):

  Canvas.Font.Style := [fsBold];
  Canvas.Font.Name:='Courier New'; //<-----------------e.g. Here
  if FHighlightButton then


As I said, I'm not sure if it's a good idea...  (on the other hand, this is a way to learn how things work and look like in there;)
In any case you'd have to backup the original JvgHelpPanel.pas !!

You could also copy the pas file into your project directory, add the file to your project (Project>Add to project) and to the uses clause, and add the said code to THAT file. Then you'd have to create the HelpPanel at runtime.


0
 

Author Comment

by:ebi1
ID: 17932528
Hi TName,

You'r right.  it's not a good idea....    lol
My time is REALLY killing, so i really dont have time for testing my UNskillful "technics"  :)

Is there a way to do that programaticaly from within my program without recompiling/installing the whole JVCL package (if that's what i need to do...  me=noob) ?

btw, I tried the Canvas.Font.Style, and Canvas.Font.Name and i put it in the OnClick Event just to see if it changes the status, but it's not "working" because there is no "Canvas" Property to the TJvgHelpPanel...   :D

please bear with me (and forgive my english)

MANY MANY thanks for your time and help
0
 

Author Comment

by:ebi1
ID: 17932565
i forgot to mention (again) that i use Delphi 6 Ent, and yes, the component is the JvgHelpPanel on the JVCL Globus 2  tab of the Jedi VCL.

sorry about that and Thanks again
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 28

Accepted Solution

by:
TName earned 400 total points
ID: 17934120

The problem is that the text field (a TRichEdit) is declared in the TJvgHelpPanel class as private, so you cannot acces it by subclassing from another unit. If it was only  protected, you could simply say

 type
  THPanel = class(TJvgHelpPanel)
  private
  protected
  public
    constructor Create(AOwner: TComponent); override;
  end;

constructor THPanel.Create(AOwner: TComponent);
begin
   inherited;
   FRich.ScrollBars:=ssVertical;
end;






The only other way I can think of is to let Windows do it (Put this e.g. in FormShow):

var
h :HWND;
begin
   h := FindWindowEx(Handle, 0, 'TJvgHelpPanel', nil);
   if h<>0 then begin
     h := FindWindowEx(h, 0, 'TRichEdit', nil);
        if h<>0 then begin
           SendMessage(h, EM_SHOWSCROLLBAR, SB_VERT, 1);  //for some reason you have to call this twice
           SendMessage(h, EM_SHOWSCROLLBAR, SB_VERT, 1);
        end;
    end;
end;




0
 
LVL 28

Expert Comment

by:TName
ID: 17934172
For the last solution above, forgot to tell you to declare this constant:

Const EM_SHOWSCROLLBAR = WM_USER + 96;
0
 

Author Comment

by:ebi1
ID: 17940156
ohhh  man,  this works GREAT.

can you also help me with the second part of the question please?
(the one that doesnt change the TJvgHelpPanel headline font)

let me know if you want me to make it as a new question

i'm rasing the points to 400 and i will give another 400 points for the font problem

you REALLY helped me, my friend.
THANK YOU
0
 
LVL 28

Expert Comment

by:TName
ID: 17942960
Hi, here's an easy way to change the Font.Name and Font.Size:

Add this to the interface section of your unit:

type
  THack = class(TCustomPanel)
  private
  public
  published
    property Canvas;
  end;



and this to your FormShow (e.g. at the end of the procedure):

THack(JvgHelpPanel1).Canvas.Font.Name:='Courier New';  //or any other font
THack(JvgHelpPanel1).Canvas.Font.Size:=10;


you can't change the font color and style like this, because color and style are set in the paint procedure of the component, and will overwrite these settings.
To change them, you'd have to (subclass and) repaint the component (overwriting the original OnPaint).
0
 

Author Comment

by:ebi1
ID: 17943131
Well, you did again   :)

i will post another "question" just for you to give you the other 400 points i promissed.
i'll be happy if you accept them.

MANY thanks my friend.  you helped me A LOT.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now