Re: [VB6] - i need advices:(
i know that, when control is created, it reads all properties(to see there values). my question is: what is the event that can tell me when the properties was read them?
Re: [VB6] - i need advices:(
I, for one, am confused as to what exactly the problem is or how to solve it. It would help if you could post the code, or zip and attach your project sothat someone here can take a look at it and suggest improvements.
Without knowing what you are trying to achieve by the project, it's difficult to comment upon any particular aspects or suggest changes.
.
Re: [VB6] - i need advices:(
Quote:
Originally Posted by
honeybee
I, for one, am confused as to what exactly the problem is or how to solve it. It would help if you could post the code, or zip and attach your project sothat someone here can take a look at it and suggest improvements.
Without knowing what you are trying to achieve by the project, it's difficult to comment upon any particular aspects or suggest changes.
.
i have 8 graphic effects properties, that both call the ShowImage sub. these sub do the graphics effects, depending on that 8 properties. when the control is created these 8 properties are read automatic. then the ShowImage sub is called 8 times or even more, slowing down the when the form is showed. how?
think on these: you have 100 controls(my sprite control) on form and both showes an image. and, when the control is created, the ShowImage sub is called. if 1 control calls it 8 times, think how many times 100 controls can call it?(8X100=800)
well these can slow down and very the form when is showed. even on IDE. yes i try open the form, on IDE, and the IDE\form needs time to show the controls with images. my objective is try read these sub only 1 time, when the control is created, but after read all properties. but how can i do it?
Re: [VB6] - i need advices:(
That's a little better. Just to ensure we are on common ground, here's what your code looks like as of now. Please correct me if I am wrong:
Code:
Property One
OnChange Call ShowImage
End Property
Property Two
OnChange Call ShowImage
End Property
Property Three
OnChange Call ShowImage
End Property
Property Four
OnChange Call ShowImage
End Property
Property Five
OnChange Call ShowImage
End Property
'and so on
Sub Form_Load()
Read Property One 'which will in turn call ShowImage
Read Property Two 'which will in turn call ShowImage again
'and so on
End Sub
Two workarounds come to mind: Remove the call to the ShowImage function from the individual property subs. So your code would look like this:
Code:
Property One
'OnChange Call ShowImage
End Property
Property Two
'OnChange Call ShowImage
End Property
Property Three
'OnChange Call ShowImage
End Property
Property Four
'OnChange Call ShowImage
End Property
Property Five
'OnChange Call ShowImage
End Property
'and so on
Sub Form_Load()
Read Property One 'which will NOT call ShowImage
Read Property Two 'which will NOT call ShowImage again
'and so on
ShowImage 'Being called only once, after all properties have been set/get
End Sub
The other solution is to use a flag to decide whether the ShowImage should be called from within the property subs:
Code:
Bool CallShowImage = False
Property One
If CallShowImage = True Then
OnChange Call ShowImage
End If
End Property
Property Two
If CallShowImage = True Then
OnChange Call ShowImage
End If
End Property
Property Three
If CallShowImage = True Then
OnChange Call ShowImage
End If
End Property
Property Four
If CallShowImage = True Then
OnChange Call ShowImage
End If
End Property
Property Five
If CallShowImage = True Then
OnChange Call ShowImage
End If
End Property
'and so on
Sub Form_Load()
Read Property One 'which will NOT call ShowImage
Read Property Two 'which will NOT call ShowImage again
'and so on
ShowImage 'Call this once in the form_load
CallShowImage = True 'Now each property sub will automatically invoke the ShowImage
End Sub
The second code has the advantage of eliminating your performance problems at startup, but still being able to invoke ShowImage from individual property subs after the startup.
By the way, you may notice the code above is not strictly as per the syntax, and I am hoping you will be able to understand the logic and implement it your own way.
.
Re: [VB6] - i need advices:(
i understand what you mean, but how can i do it, if the usercontrol, when is inititalizate\created, read the properties automatic?
can you tell me the usercontrol events order?(maybe i can see what i need;))
Re: [VB6] - i need advices:(
User control event orders should be the same as the form events, so the above code should, in principle, still work inside a user control.
.
Re: [VB6] - i need advices:(
Quote:
Originally Posted by
honeybee
User control event orders should be the same as the form events, so the above code should, in principle, still work inside a user control.
.
but can you, please give the event order?
the iniproperty event is activated after read all properties or before?
Re: [VB6] - i need advices:(
To be honest, I don't give a rat's tail what the control firing order is, and I don't remember too.
You can either search Google (which is tough, since VB6 is way too old), or place message boxes in the various events you have handled. The firing of the message boxes will show you the sequence in which the events are firing.
.
Re: [VB6] - i need advices:(
Quote:
Originally Posted by
honeybee
To be honest, I don't give a rat's tail what the control firing order is, and I don't remember too.
You can either search Google (which is tough, since VB6 is way too old), or place message boxes in the various events you have handled. The firing of the message boxes will show you the sequence in which the events are firing.
.
finally the sub is called 1 time;)
seems that resize event is called more than 1 time, when the control is created.
but i continue with 1 bug, that, honestly, i don't know what is causing it:(
but i know is what i see: very sprites on form showing an image. then the form needs very time to show the controls:(
i don't know what can cause these problem... i need test more my control;)
thanks for the help;)
Re: [VB6] - i need advices:(
ok... i have 1 question: what can needs time to show the control?
i have try see the control events and both seems normaly... the timers are false and the showimage sub is only called, when the control is showed. the resize event only test the resize way(vertical, horizontal and diagonals) and theres the hook api function for the mouse wheel. nothing more. then i'm trying to thing what causes that delay and i don't understand:(
can anyone sugest me something?
Re: [VB6] - i need advices:(
I suggest you upload your project as a zip file so someone here can take a look. Without knowing the whole code, it's really difficult to comment upon such issues.
.
Re: [VB6] - i need advices:(
Quote:
Originally Posted by
honeybee
I suggest you upload your project as a zip file so someone here can take a look. Without knowing the whole code, it's really difficult to comment upon such issues.
.
ok.. i belive that i found the real problem of these.
1st - we found the way how call that sub once after the control be created.
2nd - now i need speed up my code;)
and for start, i need speed up my tiles code:
Code:
~If blnTiles = True Then
picGraphicsEffects.Width = UserControl.Width
picGraphicsEffects.Height = UserControl.Height
picGraphicsEffects.Picture = UserControl.Image
For x = 0 To UserControl.Width Step IIf(StripsActivate = True, StripsWidth - 1, imgSize.Width - 1)
For y = 0 To UserControl.Height Step IIf(StripsActivate = True, StripsHeight - 1, imgSize.Height - 1)
BitBlt picGraphicsEffects.hDC, x, y, PicAnimation(lngActualSubImage).Width, PicAnimation(lngActualSubImage).Height, picGraphicsEffects.hDC, 0, 0, vbSrcCopy
API_DoEvents
Next
Next
picGraphicsEffects.Picture = picGraphicsEffects.Image
UserControl.Picture = picGraphicsEffects.Image
End If
i don't know how can i do it. if use hdc variables, the code speed up more or i must use the DIB's code?
Re: [VB6] - i need advices:(
See your other thread in the games/graphics section. I've given you a really fast tiling routine
Re: [VB6] - i need advices:(
i have here an image:
http://www.mediafire.com/i/?3mazro88t43xfqd
the form is showed in these way by some seconds... can anyone advice me how avoid these bug or slow thing?