crackmunky Posted June 2, 2009 Author Share Posted June 2, 2009 Heya guys, I made a seperate form for my chat window and made it transparent, Ive set it so by default it is allways ontop of the frmMirage but nothing else. I want it to be able to follow the frmMirage if it is moved, i tried this -``` TxtChatForm.Left = frmMirage.Left TxtChatForm.Top = frmMirage.TopTxtChatForm.HideTxtChatForm.Show```to no avail, here is an image of what it looks like right now -[![](http://img4.imageshack.us/img4/9316/errorwxb.jpg)](http://img4.imageshack.us/my.php?image=errorwxb.jpg)So to say again I want to get it to FOLLOW frmMirage. Any help is appreciated. Link to comment Share on other sites More sharing options...
Bobosk Posted June 2, 2009 Share Posted June 2, 2009 Can't you run it on over timer, that checks to see if the form's top/left match..? Link to comment Share on other sites More sharing options...
vrage Posted June 2, 2009 Share Posted June 2, 2009 use the game loop Link to comment Share on other sites More sharing options...
crackmunky Posted June 2, 2009 Author Share Posted June 2, 2009 @V-Rage:> use the game loopAhh thankyou for that one, I saw that I placed it slightly above the main loop.``` If ChatX = 0 Then ChatX = frmMirage.Top If ChatY = 0 Then ChatY = frmMirage.Left If Not frmMirage.Left = ChatX Then TxtChatForm.Left = frmMirage.Left ChatX = 0 End If If Not frmMirage.Top = ChatY Then TxtChatForm.Top = frmMirage.Top ChatY = 0 End If```Im very new to VB but I just wrote the above peice of code and it seems to be working. Link to comment Share on other sites More sharing options...
Robin Posted June 2, 2009 Share Posted June 2, 2009 Glad to see you learnt some logical negation from me, but it shouldn't be used in this context.Make a new sub and call it in your GameLoop, preferebly within a 25 tick timer.```If (frmCredits.Left = frmMainMenu.Left) And (frmCredits.Top = frmMainMenu.Top) Then Exit SubfrmCredits.Left = frmMainMenu.LeftfrmCredits.Top = frmMainMenu.Top```Re-name frmCredits to your chat form, obviously. And frmMainMenu to frmMirage. Link to comment Share on other sites More sharing options...
crackmunky Posted June 2, 2009 Author Share Posted June 2, 2009 @Robin:> Glad to see you learnt some logical negation from me, but it shouldn't be used in this context.> > Make a new sub and call it in your GameLoop, preferebly within a 25 tick timer.> > ```> If (frmCredits.Left = frmMainMenu.Left) And (frmCredits.Top = frmMainMenu.Top) Then Exit Sub> frmCredits.Left = frmMainMenu.Left> frmCredits.Top = frmMainMenu.Top> ```> Re-name frmCredits to your chat form, obviously. And frmMainMenu to frmMirage.Ahh I see, the method you used is much more efficent. Thankyou for that, slowly learning. Link to comment Share on other sites More sharing options...
Robin Posted June 2, 2009 Share Posted June 2, 2009 Much quicker than most people, it seems. I haven't seen anyone warm up to logical operators so quickly before.Keep it at, and I'll answer any questions you post :] Link to comment Share on other sites More sharing options...
anasky Posted June 4, 2009 Share Posted June 4, 2009 I don't know if it works fast enough now, but you could make it like this:``` If frmMirage.Left <> (textbox).Left Then (textbox).Left = frmMirage.LeftEnd If ```Not sure if it works faster though. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now