Hi all,
Can somebody post here an example how I can show an graphic in an picture control is that te same as an canvas view?
I try this but it fails. I don't know what functions must use for create by example the function f(x) = x^3. I can calaculate this but which functions have I need for show this in an graphic view control?
Kind regards
Stephane
FireFly3 does not have a graphics view control. You must be thinking of DDT ??
You can assign icons or bitmaps to the Picture control. The FireImage control can display jpg, bmp, ico, gif, wmf and png files.
Quote
I can calaculate this but which functions have I need for show this in an graphic view control?
You can not use the Picture control or FireImage control for this purpose.
Paul
Its not DDT code but SDK code.
I would like to add an control like an Canvas control such as the thirth part tool EZGUI.
I would like to draw lines, circles, rectangles, fill or not shapes and generate graphic functions?
Can you please post an example how I can this handle this in SDK code with use in FF3 paul?
I very trusted your product very good.
Kind regards
Stephane
I like the idea of adding a control in FF3 that allows the user to draw lines, colors, etc... I will probably add a control like that.
I don't own EZGUI so I have no idea how such a thing is implemented in that product.
I'm confused. Can't you draw lines in a FireImage control? I know you can do it in a DDT graphic control with DDT. Can't you use the API's MoveTo and LineTo in graphic controls and FireImage controls?
I haven't done much with SDK and I've never done this. I've only read about it. I've only used DDT for line drawing. But I assumed this would work.
Barry
I think Chris has such control for individual sale, your best bet would be to purchase that control and ask Chris for support on using it in Firefly 3.
I too would like a graphic control. This is something one should not have to buy. It should have all the functions the graphic control has in PB9. Since I'm very new to FF3 there are many things I don't really understand. Like how do you use the PB9 Graphic control or can it even be used. I assumed, maybe incorrectly, that FF3 added to / improved PB9 not limit it. I suppose I can understand is PB9's DDT can't be used in FF3 but if thats true then ALL of them should have a equal FF3 counterpart.
Again I'm really new to FF3 and I may be way off base. The help file isn't too clear or detailed on the subject. I have tried adding the graphic control from PB9 and I may be doing it wrong but I can't get it to work.
I'm not knocking FF3, its great.
I have never used the GRAPHIC statements in PB9 and I haven't used the DDT commands for a long, long, long time.
It appears that the PB DDT Graphic control is simply a window of "static" class.
I did a very quick experiment of adding a Graphic control to a FireFly form. Try the code below. It works. The trick is to create a modeless dialog to act as a container for the graphic control. I add a "Custom Control" to my form and add the code below to the INIT message handler.
'--------------------------------------------------------------------------------
Function FORM1_CUSTOMCONTROL1_INIT ( _
ClassName As Asciiz, _ ' windows class
Caption As Asciiz, _ ' window caption
hWndParent As Dword, _ ' handle of parent window
ExStyles As Dword, _ ' extended window styles
Styles As Dword, _ ' standard window styles
nLeft As Dword, _ ' left position of control
nTop As Dword, _ ' top position of control
nWidth As Dword, _ ' width of control
nHeight As Dword _ ' height of control
) As Long
' If your custom control uses CreateWindowEx then use the template below, otherwise
' follow the instructions provided by the Custom Control's author. The Custom Control
' INIT function is called during the %WM_CREATE message for the Form on which the
' Custom Control is created.
Local hWndControl As Dword
Local hWndGraphicDlg As Dword
Dialog New Pixels, hWndParent, "", nLeft, nTop, nWidth, nHeight, _
%WS_CHILD Or %WS_VISIBLE, 0, To hWndGraphicDlg
Control Add Graphic, hWndGraphicDlg, IDC_FORM1_CUSTOMCONTROL1, "", _
0, 0, nWidth, nHeight
' Draw a buffered, blue gradient fill.
' Nothing is displayed before GRAPHIC REDRAW,
' this enhancing performance dramatically.
Graphic Attach hWndGraphicDlg, IDC_FORM1_CUSTOMCONTROL1, ReDraw
For y& = 0 To 255
Graphic Line (0, y&) - (255, y&), Rgb(0, 0, y&)
Next
Graphic ReDraw
Dialog Show Modeless hWndGraphicDlg
' Bypass the assigning of the handle to a variable because we
' do not want FireFly to take control of this graphic window
' by subclassing it.
'It is important that this function return the Windows Handle to the newly created Control *** Do not delete this ***.
' Function = hWndControl
End Function
Thank you, I have it on the form, now I can play and see what it'll do
Doug
I used the Graphic Window in FF2(Actually found the app and most likely FF1 since 5 years ago and I had to convert it to view it) before since it has a window handle and can just be added to a form. You can probably still find my code in the FF2 thread. I think I animated a Pacman chomping in it. There are SetParent API calls and such you can use too. They appear to have dropped me off their Beta after their last version...could be cause I got the latest PBwin, but not PBcc or something, but I was fighting for more options for the Graphic Window which they did enhance and it should work even better now.
Found links:
http://www.planetsquires.com/protect/forum/index.php?topic=649.0
http://www.powerbasic.com/support/forums/Forum6/HTML/004783.html
Not all of my suggestions were made to the control, so it may be limited. There are other controls out there though. Jose even suggests one in the 1st thread above that he has.
I have to say Paul's code (above) works great. now I can use all of PB's GRAPHIC functions.
Thank you
Quote
Jose even suggests one in the 1st thread above that he has.
Yes, I wrote it because the DDT graphic control doesn't work with SDK applications without hacking. It is a true custom control, not a subclassed label.
Quote
GRAPHCTX is a graphic control for pictures, text and graphics. It can be used both with SDK windows and DDT dialogs. You can use both GDI and GDI+ to draw graphics and text and to load and manipulate images.
This control features persistence and uses a virtual buffer (set initially equal to the size of the control when it is created) to allow to display images bigger than the size of the control. Scrollbars are automatically added when the size of the virtual buffer is bigger than the size of the control and removed when unneeded. It also features keyboard navigation and sends command messages to the parent window or dialog when the Return or Escape keys are pressed, and notification messages for mouse clicks.
To use the control, include the GRAPHCTX.INC file in your program and initialize it with a call to the InitGraphCtx function, that registers the GRAPHCTX class, making it available to be used with CONTROL ADD (DDT style) or CreateWindowEx (SDK style).
http://www.jose.it-berater.org/smfforum/index.php?topic=2868.0
Besides, complete reference guides to GDI and GDI+ are available in my site:
GDI: http://www.jose.it-berater.org/gdi/iframe/index.htm
GDI+: http://www.jose.it-berater.org/gdiplus/iframe/index.htm
The notification messages for mouse clicks use the appropriate Windows messages and are processed in the same way:
CASE %WM_NOTIFY
LOCAL phdr AS NMHDR PTR
phdr = lParam
IF wParam = %IDC_GRCTX THEN
SELECT CASE @phdr.code
CASE %NM_CLICK
CASE %NM_DBLCLK
CASE %NM_RCLICK
CASE %NM_RDBLCLK
CASE %NM_SETFOCUS
CASE %NM_KILLFOCUS
END SELECT
END IF
It also responds to mouse wheel.
And, as we have the source code (short and clean), we can improve or customize it at any time if needed.
Stephane,
I've just uploaded two sample FireFly projects called GraphicControlDemo and GraphicWindowDemo to illustrate how to use some PB graphics functions with FireFly.
More specifically you will be able to see how to compute and how to draw the function f(x) = x^3
I hope it could be of some help.
http://www.planetsquires.com/protect/forum/index.php?topic=2300.0
Jean-Pierre