| | |
Flashing shape !!! ...
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Nov 2007
Posts: 12
Reputation:
Solved Threads: 0
Ok. Need some help with a project at my work. Wanting to create a useful map of the windfarm where I work. (Once completed, will be the largest windfarm in Europe :-))
Anyway have created a map of the site showing the locations of each turbine. Using this map as an image file I added a small circle for each turbine. Once a turbine is selected from a combo box list, the turbine circle is highlighted by changing the circle's colour width and height change (get bigger) to highlight the requested turbine.
Now for the help bit. I want the circle to go large then small, large etc. (ie flash three times and then stay big) I did a For/loop for the three times but can't get the delay to slow down the change. my current code has the click procedure as:
Dim x as Integer
For x = 1 to 3
shape1.colour= (red)
shape1.width= 100
shape1.height= 100
THIS IS WHERE I NEED CODE FOR A DELAY
shape1.colour= (white)
shape1.width=200
shape1.height=200
next x
This changes the circle to white but I've tried timer, another loop etc in the middle but can't get the delay required. As you may gather, I'm a VB newbie, and this may be obvious to some of you how to achieve this. Please reply ASAP, as I'm trying to have this completed over the weekend. Thanks in advance for any help you can offer
Anyway have created a map of the site showing the locations of each turbine. Using this map as an image file I added a small circle for each turbine. Once a turbine is selected from a combo box list, the turbine circle is highlighted by changing the circle's colour width and height change (get bigger) to highlight the requested turbine.
Now for the help bit. I want the circle to go large then small, large etc. (ie flash three times and then stay big) I did a For/loop for the three times but can't get the delay to slow down the change. my current code has the click procedure as:
Dim x as Integer
For x = 1 to 3
shape1.colour= (red)
shape1.width= 100
shape1.height= 100
THIS IS WHERE I NEED CODE FOR A DELAY
shape1.colour= (white)
shape1.width=200
shape1.height=200
next x
This changes the circle to white but I've tried timer, another loop etc in the middle but can't get the delay required. As you may gather, I'm a VB newbie, and this may be obvious to some of you how to achieve this. Please reply ASAP, as I'm trying to have this completed over the weekend. Thanks in advance for any help you can offer
Hi, Timer will solve your problem.
1) Use a flag variable that indicates bigger to smaller and smaller to bigger as form level.
2) Inside timer, check the Boolean variable
3) At design time change the Enabled property of the Timer to false
4) When user Select the Combobox Enable the Timer
5) At last when u desire Disable the timer
1) Use a flag variable that indicates bigger to smaller and smaller to bigger as form level.
Dim bBigToSmall as Boolean Dim iNoOfTimes As Integer Private Sub Form_Load() bBigToSmall = False Timer1.Interval = 100 Timer1.Enabled = False End Sub
2) Inside timer, check the Boolean variable
vb Syntax (Toggle Plain Text)
Private Sub Timer1_Timer() If bBigToSmall = False Then Shape1.Width = Shape1.Width + 100 Shape1.Height = Shape1.Height + 100 iNoOfTimes = iNoOfTimes + 1 If iNoOfTimes = 3 Then bBigToSmall = True End If Else Shape1.Width = Shape1.Width - 100 Shape1.Height = Shape1.Height - 100 iNoOfTimes = iNoOfTimes - 1 If iNoOfTimes = 0 Then bBigToSmall = False End If End If 'Random Color Shape1.FillColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255) End Sub
3) At design time change the Enabled property of the Timer to false
4) When user Select the Combobox Enable the Timer
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Combo1_Change() Timer1.Enabled = True End Sub Private Sub Combo1_Click() Combo1_Change End Sub
KSG
•
•
Join Date: Nov 2007
Posts: 12
Reputation:
Solved Threads: 0
Hold On! Still a problem. :-(
I have 140 shapes (Shape1 = "T001", Shape2 = "T002" etc). I would like to try and have the program so that, if I select 1 of 140 from a combo box (Eg 39), I only want Shape 39 to flash, then if I select another from the combo (Eg 100), both 39 and 100 will flash. (I already have a reset button which stops everything and returns them to their original condition)
At present I have a combo box where I select a number from T001 to T140, and then click on a "Show"button to trigger it. I'm using Select case so that if combo1.text = T001, then once clicked I want it to flash.
Using your code the shape1 code is in the timer section. How do I set up the timer code so that when each case is selected it then selects the appropriate shape for the timer? (Hope this makes sense)
Help please again
I have 140 shapes (Shape1 = "T001", Shape2 = "T002" etc). I would like to try and have the program so that, if I select 1 of 140 from a combo box (Eg 39), I only want Shape 39 to flash, then if I select another from the combo (Eg 100), both 39 and 100 will flash. (I already have a reset button which stops everything and returns them to their original condition)
At present I have a combo box where I select a number from T001 to T140, and then click on a "Show"button to trigger it. I'm using Select case so that if combo1.text = T001, then once clicked I want it to flash.
Using your code the shape1 code is in the timer section. How do I set up the timer code so that when each case is selected it then selects the appropriate shape for the timer? (Hope this makes sense)
Help please again
•
•
Join Date: Nov 2007
Posts: 12
Reputation:
Solved Threads: 0
Yes I have 140 shapes named as shape1, shape 2 etc. How would I code a control array. Could you code me for 3 shapes?
On the form there would be a combo box with a list 1-3, and a button to click. Eg select 2 from combo dropdown, click on "Show" button to flash box 2. Then eg select 3 from combo dropdown, click on "Show" button, and both 2 and 3 are flashing. Really appreciate your expert knowledge in helping me.
Kenny
On the form there would be a combo box with a list 1-3, and a button to click. Eg select 2 from combo dropdown, click on "Show" button to flash box 2. Then eg select 3 from combo dropdown, click on "Show" button, and both 2 and 3 are flashing. Really appreciate your expert knowledge in helping me.
Kenny
To create control array you must do it in design time. When drawing shape form Toolbox to form,
1) First place one shape control and set the properties for the shape. Change the Name of the Shape this will be used for all the controls. It is similar to array in VB.
2) Copy and Paste the Shape ,Vb will ask you to create control array because the shape name already exists. Press yes.
3) Next Paste the as many control as needed your design.
Now your array of controls created
(Shape1(0), Shape1(1), Shape1(2).... Shape1(139) )
Another Way
1- Leave the Control Shape1, You can change the Name property of the Shape2 control to Shape1.
2- For the First time vb will ask Do you want to have control array. Press Yes
3- Then you have to change the Name all other Shapes (Shape3, Shape4, Shape5) in order.
Now these controls are having Same Name Shape1, but different Indexes
I Attach the Example with this
1) First place one shape control and set the properties for the shape. Change the Name of the Shape this will be used for all the controls. It is similar to array in VB.
2) Copy and Paste the Shape ,Vb will ask you to create control array because the shape name already exists. Press yes.
3) Next Paste the as many control as needed your design.
Now your array of controls created
(Shape1(0), Shape1(1), Shape1(2).... Shape1(139) )
Another Way
1- Leave the Control Shape1, You can change the Name property of the Shape2 control to Shape1.
2- For the First time vb will ask Do you want to have control array. Press Yes
3- Then you have to change the Name all other Shapes (Shape3, Shape4, Shape5) in order.
Now these controls are having Same Name Shape1, but different Indexes
I Attach the Example with this
KSG
![]() |
Similar Threads
- Help- Stuck in OS 9 (OS X)
- num/caps/scroll lock flashing lights (USB Devices and other Peripherals)
- suspected spyfalcon infection (Viruses, Spyware and other Nasties)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: green screen problem
- Next Thread: sum up a fields
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






