Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Scollbar in delphi (Read 6961 times)
x-fgi
YaBB Newbies
*
Offline



Posts: 35
Joined: Aug 14th, 2009
Scollbar in delphi
Feb 4th, 2010 at 5:36pm
Print Post  
Hi Stoyo,
I'm back again trying to solve one of the last problem I have.
I'm working with a big chart that need to be scrolled. Grin
I work in Delphi with a skin enhancer library so that I need to draw a "skinned version" of any component.
Flowchartx's canvas area don't need to be skinned of course, but Scrollbars need to be draw in better way.
to do this I try to link a couple of TScrollBar delphi component to flowcharx, by doing this:

FlowChart1.RegExtrScrollers( HsScrollBar.Handle,VsScrollBar.Handle);
then
FlowChart1.HideScrollers();

but Scrollbars never resize themself when Draw area of Flowchartx changes.
moreover Flowcharx never scroll when I click on scollbars.
Ididn't understand what's the meaning of the phrase found in the RegExtrScrollers help page....
" Except scrollbars’ registration you should also resend WM_HSCROLL and WM_VSCROLL messages to IOleInPlaceObjectWindowless:: OnWindowMessage method. With that done the external scrollbars function as the built-in of the windowed version. When the document is scrolled or zoomed the scroll thumb position and size will be set accordingly."

I see the only examle I found in the DEMO directory, but C++ isn't so clear for me...
Cry

I hope you can help me
Franco
  

Franco
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Scollbar in delphi
Reply #1 - Feb 5th, 2010 at 9:31am
Print Post  
Hi Franco,

Do you know if the Delphi TScrollbars are wrappers around the Win32 scrollbar controls, or are some custom controls entirely implemented in Delphi? RegExtrScrollers supports only the Win32 API scrollbar controls, and the Flowchart sets external scrollbar ranges by calling the SetScrollInfo API function.

Stoyan
  
Back to top
 
IP Logged
 
x-fgi
YaBB Newbies
*
Offline



Posts: 35
Joined: Aug 14th, 2009
Re: Scollbar in delphi
Reply #2 - Feb 5th, 2010 at 12:50pm
Print Post  
Hi Stoyo,
There are two kin of scroolbar in Delphi,
The first (TControlSCrollbox) is defined as part of the TSCROLLBOX component ( that is a PANEL with scollbar) but this seems to be a full Deplphi component, and it has no accessible Window Handel.

The other component is the TScrollBar component. This seems to be a Windows wrapped component :  is derived  from TWinControl and therefore it has a is has a Windows Handle to acced the underlying Window Control.
in the implenetation of TScrollBar I didn't see any paint command but only Procedure that send or receive Windows Messages: may be I'm wrong, but I think at TScrollbar as a standard Window Component.

Anyway, if this could be a "mission : impossible"  I could try drive the tflowcharx.scrollto by the Delphi tscrollbox. My only problem is to kow how big is the drawing Area of the TFLowchartx. I know that is intially set to 1100x1100 but how I can be alerted when this size grown?.
Thank you
Franco
  

Franco
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Scollbar in delphi
Reply #3 - Feb 5th, 2010 at 2:51pm
Print Post  
Hi Franco,

Actually external scrollbars are intended for use in ActiveX windowless mode; I don't know if it's supported by Delphi. Otherwise the control always creates its built-in scrollbars when in windowed mode. We could add support for such scrollbars in windowed mode too, or raise some event when the document area is resized if you prefer to use the scroll-box approach.

Stoyan
  
Back to top
 
IP Logged
 
x-fgi
YaBB Newbies
*
Offline



Posts: 35
Joined: Aug 14th, 2009
Re: Scollbar in delphi
Reply #4 - Feb 5th, 2010 at 3:27pm
Print Post  
Hi Stoyo,
all my delphi programs use forms to disply other things, so Fchartx is alway to be inteded as a component inside a delphi windows. Even the "base" delphi windows is derived from a component called TScrollingWinControl .. wich has its own embedded Scrollbar as the TScrollbox.... so I think the right approach is to have an event like OnDrawSizeChange  and a property for CanvasDrawsize.x,y...or something like this... Smiley
For monday mornig right? Grin ...Joking!!
thanks
Franco
  

Franco
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Scollbar in delphi
Reply #5 - Feb 8th, 2010 at 4:15pm
Print Post  
Hi Franco,

Try this version, it adds a DocBoundsChanged event:
https://mindfusion.eu/_beta/flowchartx32.zip

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
x-fgi
YaBB Newbies
*
Offline



Posts: 35
Joined: Aug 14th, 2009
Re: Scollbar in delphi
Reply #6 - Feb 17th, 2010 at 1:21pm
Print Post  
Hi Stoyo, Sorry for this long delay, I have had a bad flue Cry
I briefly test the changes you sent me, containig the new DocBoundsChanged event.
Unfortunately It seems it doesn't reacts :
I programmatically added some boxes to a chart, some of them out of the orginal bounds of 1100x1100 but nothing happends.
Needs this Events any activation?
Thanks
Franco
  

Franco
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Scollbar in delphi
Reply #7 - Feb 17th, 2010 at 7:00pm
Print Post  
Hi Franco,

I hope you are feeling better now Smiley

Adding boxes programmatically does not resize the flowchart area. The flowchart is resized automatically if AutoSizedoc is enabled and you draw some boxes with the mouse. Otherwise you can set the size by calling SetDocSize and FitDocToObjects methods. You should get the event raised in these cases.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
x-fgi
YaBB Newbies
*
Offline



Posts: 35
Joined: Aug 14th, 2009
Re: Scollbar in delphi
Reply #8 - Feb 18th, 2010 at 8:51am
Print Post  
Hi Stoyo
I added FitDocToObjects after adding the last box and It works!
GREAT! Cheesy
Thank you very much!

Franco

p.s.
Here a stupid sample code for every delphi programmers who need this feature enabled

procedure TForm1.Button1Click(Sender: TObject);
var
i,j :integer;
x,y :integer;
box1,box2 : IboxItem;
begin
box1 := FlowChart1.CreateBox(100,100,20,20);
FlowChart1.HideScrollers();
for j := 0 to 3 do
for i := 0 to 3 do
begin
x := (i+1)*600;
y := (j+1)*600;
box2:=FlowChart1.CreateBox(x,x,10,10);
FlowChart1.CreateArrow(box1,box2);
end;
FlowChart1.FitDocToObjects(1);
end;
// here's the OnDocBoundsChanged event
procedure TForm1.FlowChart1DocBoundsChanged(ASender: TObject; left, top,
right, bottom: Integer);
begin
FlowChart1.Width := Right - Left;
FlowChart1.Height := Bottom - top;
end;

// note: the Flowchart is inserted in a scrollbox
the Align property of the Flowchart is set to "alNone"
Here's the fragment of the .dfm
object ScrollBox1: TScrollBox
Left = 185
Top = 0
Width = 949
Height = 622
Align = alClient
TabOrder = 1
object FlowChart1: TFlowChart
Left = 0
Top = 0
Width = 1100
Height = 1100
ParentFont = False
TabOrder = 0
OnDocBoundsChanged = FlowChart1DocBoundsChanged
ControlData = {
  

Franco
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint