|
-
Oct 5th, 2009, 08:37 AM
#1
[RESOLVED] .SetFocus
Has anyone else experienced this?
I am in debug mode VB6 IDE.
I am running my IDE on Citrix Terminal Server.
There's a command Spread1.SetFocus
For some reason this fails when I am running my code in IDE.
Spread1 is a farpoint spread control.
Can someone please test?
Last edited by abhijit; Oct 5th, 2009 at 08:48 PM.
Reason: Mark as kinda resolved
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Oct 5th, 2009, 08:58 AM
#2
Re: .SetFocus
What is the operation that you want to perform after setting focus?
Instead of setting focus try this...
vb Code:
With Spread1 '~~> your code to execute the opreation without setting focus... End With
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 5th, 2009, 09:09 AM
#3
Re: .SetFocus
 Originally Posted by koolsid
What is the operation that you want to perform after setting focus?
Instead of setting focus try this...
vb Code:
With Spread1
'~~> your code to execute the opreation without setting focus...
End With
There's nothing on the GotFocus event of the spread control.
This is legacy code from 1998. I am going to try and remove the setFocus line in this particular form and see how it goes.
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Oct 5th, 2009, 09:15 AM
#4
Re: .SetFocus
Does it have an .activate event...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 5th, 2009, 09:25 AM
#5
Re: .SetFocus
 Originally Posted by koolsid
Does it have an .activate event...
Farpoint Spread control does not have an activate event. Not the version we have in our application.
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Oct 5th, 2009, 09:31 AM
#6
Re: .SetFocus
What is the EditMode property of spread1 set to?
Also you can either set the TabIndex to 0 to have the Spread have focus when it is loaded or call the SetFocus method after the Spread control is loaded (Form_Activate event).
Last edited by Siddharth Rout; Oct 5th, 2009 at 09:37 AM.
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 5th, 2009, 11:36 AM
#7
Re: .SetFocus
 Originally Posted by abhijit
Has anyone else experienced this?
I am in debug mode VB6 IDE.
I am running my IDE on Citrix Terminal Server.
There's a command Spread1.SetFocus
For some reason this fails when I am running my code in IDE.
Spread1 is a farpoint spread control.
Can someone please test?
How does it fail? If there's an error message what is it? Is the control visible when you try to SetFocus?
-
Oct 5th, 2009, 11:53 AM
#8
Re: .SetFocus
 Originally Posted by abhijit
For some reason this fails when I am running my code in IDE.
You are not debugging at the moment when focus has to be set, are you? If you are then that's the reason.
-
Oct 5th, 2009, 11:56 AM
#9
Re: .SetFocus
I am not sure if it will make a difference but have you tried the SetFocus API if it will work?
-
Oct 5th, 2009, 12:16 PM
#10
Re: .SetFocus
 Originally Posted by RhinoBull
You are not debugging at the moment when focus has to be set, are you? If you are then that's the reason.
If that were the case, this code should also fail while I am debugging.
Code:
Option Explicit
Private Sub Command1_Click()
DoEvents
Text2.SetFocus
End Sub
This form has got two text boxes. If I run it in debug mode, it sets the focus on the second text box.
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Oct 5th, 2009, 12:23 PM
#11
Re: .SetFocus
 Originally Posted by MartinLiss
How does it fail? If there's an error message what is it? Is the control visible when you try to SetFocus?
The error message is "RunTime Error 5: Invalid procedure call or argument".
I am pretty sure that control is visible, but I need to check this again. The control is on a frame. There are several frames on the form and there is code that hides and un-hides the frames.
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Oct 5th, 2009, 01:09 PM
#12
Re: .SetFocus
 Originally Posted by abhijit
The error message is "RunTime Error 5: Invalid procedure call or argument"...
That could only be if:
- control is not visible
- control is disable
- parent container is not visible
- parent container is disable
-
Oct 5th, 2009, 01:11 PM
#13
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 5th, 2009, 01:52 PM
#14
Re: .SetFocus
 Originally Posted by koolsid
What is the EditMode property of spread1 set to?
Also you can either set the TabIndex to 0 to have the Spread have focus when it is loaded or call the SetFocus method after the Spread control is loaded (Form_Activate event).
 Originally Posted by koolsid
Abhi
Did you see post 6?
Sid,
EditMode properties are not checked or set in the control. I believe the cause for the error could be something to do with the way the container controls hide and unhide during a process.
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Oct 5th, 2009, 01:54 PM
#15
Re: [Kinda Resolved] .SetFocus
Is it loaded when you are trying to set focus?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 5th, 2009, 01:56 PM
#16
Re: [Kinda Resolved] .SetFocus
Yes it is present on the form, when I invoke it.
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Oct 5th, 2009, 02:36 PM
#17
Re: [Kinda Resolved] .SetFocus
Hopefully you aren't trying to set focus on the Form_Load event.
-
Oct 5th, 2009, 02:43 PM
#18
Re: [Kinda Resolved] .SetFocus
Does it work ok when you run from complied EXE?
-
Oct 5th, 2009, 02:49 PM
#19
Re: [Kinda Resolved] .SetFocus
Hmmm. one last try...
Set it's EditMode property to true and then try it...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 5th, 2009, 02:54 PM
#20
Re: [Kinda Resolved] .SetFocus
What does your "Kinda Resolved" mean?
-
Oct 5th, 2009, 02:58 PM
#21
Re: [Kinda Resolved] .SetFocus
 Originally Posted by Pradeep1210
Does it work ok when you run from complied EXE?
Yes it does. However, I cannot completely trust the compiled executable as there are several places in this code where it uses "On Error Resume Next".
 Originally Posted by MartinLiss
What does your "Kinda Resolved" mean?
I suspect the container for that control is getting hidden. I am going to look in this direction. Once I find the suspect, I will return and mark it to "RESOLVED".
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Oct 5th, 2009, 03:00 PM
#22
Re: [Kinda Resolved] .SetFocus
Construct a watch that breaks when the container is hidden. Do you need help in doing that?
-
Oct 5th, 2009, 08:48 PM
#23
Re: [Kinda Resolved] .SetFocus
 Originally Posted by MartinLiss
Construct a watch that breaks when the container is hidden. Do you need help in doing that?
That worked.
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|