Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK .NET / making DGDK access the form controls when embedd

Author
Message
Hayer
18
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 22nd Jun 2010 09:24
Hi

I got a a WinForm and DGDK running(as a embedd window) so I have to windows. My question is;

How can I access the WinForm variabels from the DGDK window?

To access the DGDK variables from the WinForm I can do

dgdkApplication.Object3D newObject = new dgdkApplication.Object3D

but I cant do something like

fMain.Textbox1.Text = "Hi from DGDK"

from the DGDK window.

Keep it simple.
Questions? Mail me
darxus
14
Years of Service
User Offline
Joined: 18th Aug 2009
Location: Greece
Posted: 23rd Jun 2010 02:10
but I cant do something like
fMain.Textbox1.Text = "Hi from DGDK"


I am not sure if I understood your question. I think that you can use every datatype value as you wish, anytime. Either it comes from DarkGDK, Windows Forms or any other library.

I made one example (download the file to the bottom right border of this message window).

Things to watch:

1. I use a progress bar to check the Y rotation of the cube.
(DarkGDK values sent to windows forms controls)

2. I use a track scrollbar to change the color the cube (not the color exactly but the whiteness )
(values from windows forms controls sent to DarkDGK scene)

One very important thing I noticed, everything that has to do with DarkGDK.NET must be instantiated/created within the OnShown method of the form. Otherwise in the constructor method the application won't execute.

If I missed something let me know.

Attachments

Login to view attachments
Hayer
18
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 24th Jun 2010 17:00
How to you "send" the values from GDK to the windows form controls?

how to I make GDK set the .Text for a TextBox..

Cause this is the "wrong" way;
TextBox1.Text = dgdkApplication.SomeString

Keep it simple.
Questions? Mail me
APEXnow
Retired Moderator
20
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 26th Jun 2010 02:27
Hayer,

I understand what you're trying to do. You've got your code running inside the default GameLoop function which is located in the Application.vb file and you want to access the controls on fMain.

This is straight forward to modify.

Open the Application.vb file and add the following line:



Now open the fMain.vb file in code view and add the following line to the 'Public Sub New()' function:



Now, in your Application.vb functions, to access the controls of the main form, just use the prefix shared variable before the control name etc.

i.e. _fMain.MyScrollbar.Value

Hope this helps.

Paul.

Hayer
18
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 29th Jun 2010 01:19
Whats the equliant to "static" in VB?..

Im using C#.Net cause I like the syntax in C#

Keep it simple.
Questions? Mail me
darxus
14
Years of Service
User Offline
Joined: 18th Aug 2009
Location: Greece
Posted: 29th Jun 2010 01:58
Oh, now I understand what do you mean. You want to give access to your class through a static variable.

e.g.
Class.StaticVariable.MissionAccomplished

In the simplest implementation you can do this.



In theory this technique works fine, it has the same idea based on the Singleton design pattern.

Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th Jun 2010 23:51
Quote: "Whats the equliant to "static" in VB?"


Shared

[b]

Login to post a reply

Server time is: 2024-03-28 18:08:16
Your offset time is: 2024-03-28 18:08:16