Best way to show a picture in an X# VOForm
Best way to show a picture in an X# VOForm
Hi Dick,
Thanks, but I'm afraid just seeing what you do won't be enough, after all it's just a double click, not much can go wrong about itself
We would need to install debugging tools to find what's the problem in this particular case, but I think that's really overkill for debugging an empty window that you do not need anyway. In case you do get this anytime again, please let us know though!
.
Thanks, but I'm afraid just seeing what you do won't be enough, after all it's just a double click, not much can go wrong about itself
We would need to install debugging tools to find what's the problem in this particular case, but I think that's really overkill for debugging an empty window that you do not need anyway. In case you do get this anytime again, please let us know though!
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Best way to show a picture in an X# VOForm
Hello Chris,
I add my remark in a issue I posted today here too, for future readers:
I reinstalled 2.10c and now the VO Form designer opened normally. Also on Frank's sample. I think the betaversion I still had installed may have been the cause of the FormDesigner not opening.
Dick
I add my remark in a issue I posted today here too, for future readers:
I reinstalled 2.10c and now the VO Form designer opened normally. Also on Frank's sample. I think the betaversion I still had installed may have been the cause of the FormDesigner not opening.
Dick
Best way to show a picture in an X# VOForm
Hello Chris,
When I add a Customcontrol in the VO style Window editor, change the name to PICT and change the above line to:
I get a compiler as error 1 below and with
I get a runtime error 2).
What parameter(s) am I suppose to add? Or should I do something else?
1 Severity Code Description Project File Line Suppression State
Error XS7036 There is no argument given that corresponds to the required formal parameter 'hWndNewParent' of 'VOWin32APILibrary.Functions.SetParent(PTR, PTR)' VOMDIApp2 C:TempVOMDIApp2Window1.prg 51
2 System.NullReferenceException: Object reference not set to an instance of an object.
Dick
In Frank's sample program with the Winforms control on it, the PostInit says:Chris wrote: About the toolbox, you can choose to add a CustomControl to the window (from the VO toolbox), make it as large as you want and position it accordingly on the window, and then when you use SetParent(), use the handle of that custom control, instead of the handle of the window. That should do the trick.
.
Code: Select all
SetParent(Self:pictureBox1:Handle, Self:Handle())
Code: Select all
SetParent(self:oDCPict:Handle())
Code: Select all
SetParent(Self:pictureBox1:Handle, Self:oDCPict:Handle())
What parameter(s) am I suppose to add? Or should I do something else?
1 Severity Code Description Project File Line Suppression State
Error XS7036 There is no argument given that corresponds to the required formal parameter 'hWndNewParent' of 'VOWin32APILibrary.Functions.SetParent(PTR, PTR)' VOMDIApp2 C:TempVOMDIApp2Window1.prg 51
2 System.NullReferenceException: Object reference not set to an instance of an object.
Dick
Best way to show a picture in an X# VOForm
Hi Dick,
SetParent() needs 2 arguments, first the handle of the control you need to move and second the handle of the parent, so your (2) version is the correct one.
It's very strange if you are getting a NullReferenceException with it, are you sure it happens in this line of code and not sometime later in the program? Try checking the SELF:oDCPict object before using SetParent(), is it indeed NULL?
.
SetParent() needs 2 arguments, first the handle of the control you need to move and second the handle of the parent, so your (2) version is the correct one.
It's very strange if you are getting a NullReferenceException with it, are you sure it happens in this line of code and not sometime later in the program? Try checking the SELF:oDCPict object before using SetParent(), is it indeed NULL?
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Best way to show a picture in an X# VOForm
Hello Chris,
It is not so strange, I realize now. I out commented some of the existing lines including the instantiation. So the error makes sense
When I replace the SetParent line with SetParent(Self:pictureBox1:Handle, Self:oDCPict:Handle())
the program uses the CustomControl which I added in the form editor.
I am still wondering if that is the most efficient way? I can't do something like this:
Self:oDCPict:= System.Windows.Forms.PictureBox{} (XS0029, implicit conversion of PictureBox to VO.Custom.Control) and all the other assignments are not of that CustomCOntrol class. But the (working) code feels a bit contrived:
Dick
It is not so strange, I realize now. I out commented some of the existing lines including the instantiation. So the error makes sense
When I replace the SetParent line with SetParent(Self:pictureBox1:Handle, Self:oDCPict:Handle())
the program uses the CustomControl which I added in the form editor.
I am still wondering if that is the most efficient way? I can't do something like this:
Self:oDCPict:= System.Windows.Forms.PictureBox{} (XS0029, implicit conversion of PictureBox to VO.Custom.Control) and all the other assignments are not of that CustomCOntrol class. But the (working) code feels a bit contrived:
Code: Select all
Self:pictureBox1:= System.Windows.Forms.PictureBox{}
Self:pictureBox1:Location := System.Drawing.Point{1, 1}
Self:pictureBox1:Name := "e""pictureEdit1"
Self:pictureBox1:Size := System.Drawing.Size{400, 400}
Self:pictureBox1:SizeMode:= System.Windows.Forms.PictureBoxSizeMode.Zoom
Self:pictureBox1:Visible := True
Self:pictureBox1:TabIndex := 700
Self:pictureBox1:Load("https://dt9qzg9h465rt.cloudfront.net/c:tempSomePict.jpg")
SetParent(Self:pictureBox1:Handle, Self:oDCPict:Handle())
Best way to show a picture in an X# VOForm
Hi Dick,
You can't assign a Windows.Forms control to a VO GUI control object, in the same way you cannot assign a WPF control to a WinForms object or vice versa. Or like assigning a VO style ragged array to a fixed size array, they are just different things.They are both controls that you can put on a window, but they have a completely different design and of course also different class hierarchy.
.
You can't assign a Windows.Forms control to a VO GUI control object, in the same way you cannot assign a WPF control to a WinForms object or vice versa. Or like assigning a VO style ragged array to a fixed size array, they are just different things.They are both controls that you can put on a window, but they have a completely different design and of course also different class hierarchy.
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Best way to show a picture in an X# VOForm
Hi,
I used code similar to the code below to show a .NET HTML editor control on a VO MDI datawindow with a custom control. I have also tried it in another app on a VO dialogwindow without the custom control. In both cases, everything works (you can type in the control, use the cursor keys and edit text) except for the ENTER key. This should produce a new line but seems to do nothing at all. I have written code to intercept key presses inside the control and the ENTER is not detected at all so I suspect the ENTER key is somehow not "passed on" to the control. The same control on a Winforms form works fine including the ENTER key. Can anyone think of a reason why specifically the ENTER key would not work on a VO window?
Thanks for any help!
Kees.
I used code similar to the code below to show a .NET HTML editor control on a VO MDI datawindow with a custom control. I have also tried it in another app on a VO dialogwindow without the custom control. In both cases, everything works (you can type in the control, use the cursor keys and edit text) except for the ENTER key. This should produce a new line but seems to do nothing at all. I have written code to intercept key presses inside the control and the ENTER is not detected at all so I suspect the ENTER key is somehow not "passed on" to the control. The same control on a Winforms form works fine including the ENTER key. Can anyone think of a reason why specifically the ENTER key would not work on a VO window?
Thanks for any help!
Kees.
Frank Müßner wrote:Hello Dick,
I use this code when I need a .Netcontrol on a VO window.
runs without problems until now.Code: Select all
self:pictureEdit1:= DevExpress.XtraEditors.PictureEdit{} self:pictureEdit1:Location := System.Drawing.Point{self:size:Width-175, 124} //tt:Height-289} self:pictureEdit1:Name := "e""pictureEdit1" self:pictureEdit1:Properties:SizeMode := DevExpress.XtraEditors.Controls.PictureSizeMode.Zoom self:pictureEdit1:Properties:BorderStyle := DevExpress.XtraEditors.Controls.BorderStyles.NoBorder self:pictureEdit1:Properties:ShowMenu := false self:pictureEdit1:Size := System.Drawing.Size{162, 162} self:pictureEdit1:Visible := True self:pictureEdit1:TabIndex := 500 SetParent(SELF:pictureEdit1:Handle, self:Handle())
Maybe it will help you
Frank
Best way to show a picture in an X# VOForm
Hi Kees,
Try adding this code to your app:
Now, after you put any .Net control to a VO window (with SetParent()), add this code exactly after SetParent():
Does it work ok now?
.
Try adding this code to your app:
Code: Select all
USING System.Collections.Generic
GLOBAL gaHandlesForEnter := List<IntPtr>{} AS List<IntPtr>
// put this method inside the App subclass in your code
METHOD BeforeDispatch(hWnd,uMsg,wParam,lParam)
IF uMsg == WM_KEYDOWN .and. wParam == VK_RETURN
IF gaHandlesForEnter:Contains((IntPtr)hWnd)
SendMessage(hWnd, WM_CHAR , 10 , 0)
SendMessage(hWnd, WM_CHAR , 13 , 0)
RETURN FALSE
END IF
ENDIF
RETURN TRUE
Code: Select all
gaHandlesForEnter:Add(oMyNetControl:Handle)
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Best way to show a picture in an X# VOForm
Hi Chris,
Thank you for the code. I have tried it but unfortunately it makes no difference. I have also put a MessageBox below the line "IF uMsg == WM_KEYDOWN .and. wParam == VK_RETURN" and it does not appear if I press Enter so I guess the ENTER key does not even make it to that point.
Kees.
Thank you for the code. I have tried it but unfortunately it makes no difference. I have also put a MessageBox below the line "IF uMsg == WM_KEYDOWN .and. wParam == VK_RETURN" and it does not appear if I press Enter so I guess the ENTER key does not even make it to that point.
Kees.
Best way to show a picture in an X# VOForm
Hi Kees,
Can you please send me a complete zipped sample solution showing the not working correctly control on the VOWindow?
I do have the devexpress controls, so no need to send those dlls also.
.
Can you please send me a complete zipped sample solution showing the not working correctly control on the VOWindow?
I do have the devexpress controls, so no need to send those dlls also.
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu