Solved

JVCL scroll the HelpPanel text

Posted on 2006-11-13
10
555 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

786 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