using stupid, unfriendly Frames

Agent
03-11-2002, 07:32 PM
Ok, i'm having major problems. I thought that using frames was the right way to go to sort all of my control but it isn't working.

I have command buttons on the left side and when you click one, on the right side it 'frame.visible = true's. After I added more this started to screw up big time. What else can I use? Easier and simplier but same concept as a frame... Thank you.

Volte
03-11-2002, 08:07 PM
Ummm... simpler than a frame?! A frame is just a box that doesn't even have any events or unordinary properties! I'm almost certain you're not getting any simpler...

We could help you figure out where things are screwing up... details please?

Thinker
03-11-2002, 08:11 PM
I like frames for this. I also use pictureboxes too, because they
can autoalign to the four sides of a form.

Agent
03-12-2002, 02:52 PM
I used to like it too but the controls such as my textboxes, listboxes, and stuff get messed up and start appear in other frames. Even though they suppose to be in one frame they appear in another and also even though I make the others .visible = false...

ChiefRedBull
03-12-2002, 03:56 PM
You could use the Microsoft SSTab control. It looks good, is easy to use - basically just a container with tabs across the top.

dcl3500
03-12-2002, 04:09 PM
Sounds like to me you are drawing the errant controls on the form and not inside the frame control. Test this by dragging one of them to a location outside the frame control. If it will leave the frame then it is not actually in the frame, but on/over/under it. If that is the case then right click it, cut and right click on the frame in question and paste it in the frame. Then when you make the frame.visible=false the control won't show.

Agent
03-12-2002, 07:03 PM
By golly, dcl3500, your correct! Thanks alot for that idea I overlooked. Oh yeah, is there a way I can loop through the frames with this type of logic:

For a = All the frames on this form AND NOT the X frame
a.visible = false
next a

so Is there a way to loop through all the frames but one?

dcl3500
03-12-2002, 07:29 PM
Well when I was doing something like this I used a frame on the left with several radio buttons style set to graphical (so they actually looked like buttons) in an array. I set the frames I wanted turned on and off into an array with the index matching the radio buttons. Then when I clicked the radio button it turned on the coresponding frame. I am sure you could figure a loop control method though.

Agent
03-12-2002, 08:21 PM
Originally posted by dcl3500
I am sure you could figure a loop control method though.

I hope so.

dcl3500
03-12-2002, 09:15 PM
Well Clayton give me more of a clue what you are after here. With some further info maybe I can find a solution laying about my code, or heaven forbid :), come up with something new :D to help you along.

Squirm
03-13-2002, 02:09 AM
Maybe this??

Private Sub ShowOneFrame(aFrame As Frame)

Dim fTemp As Control
For Each fTemp In Me.Controls
If TypeOf fTemp Is Frame Then
fTemp.Visible = IIf(fTemp Is aFrame, True, False)
End If
Next fTemp

End Sub

Agent
03-13-2002, 01:30 PM
Sweeet, that works great. I'm going to use those Iif lines more often. There cool. What does the "I" before the If mean?

Thanks alot guys.

Banjo
03-15-2002, 10:30 AM
I'm guessing here but it probably stands for Inline IF.

Derek Stone
03-15-2002, 01:38 PM
You're close Banjo. It stands for 'Immediate', although I do like your definition better.

Regards,
-CL

Squirm
03-15-2002, 01:50 PM
I always thought an 'Inline' if was one that was not blocked, and occured on one line (or multiple connected lines), like so:

If Blah Then x = x + 1 Else MsgBox "Hello"

as opposed to:

If blah Then
x = x + 1
Else
MsgBox "Hello"
End If

Heh, well thats what I always thought. :)

Agent
03-15-2002, 04:44 PM
Well it is very useful if you implement it right.

Thinker
03-16-2002, 07:24 PM
This is way off topic, but the IIF function can be very evil and
should be avoided where a normal If will work. Why? Because
no matter whether the expression evaluates to true or false, both
the True and False parameters are evaluated. So...
IIF(A = 0, 0, 3 / A)
will still try to evaluate 3/A and raise a divide by zero error. On
top of that, in order for it to work generically, it must take Variant
arguments for all parameters, and return a Variant.

Don't use it except in very limited instances.

Squirm
03-16-2002, 07:40 PM
Ouch!
IIf is banished.......

Volte
03-16-2002, 09:14 PM
... why? I use it quite regularly. It helps condense code. However, it should only be used it expressions, not just as a shortcut due to laziness.

Thinker
03-16-2002, 09:27 PM
Volte, take this line of code from Squirm's earlier example...
fTemp.Visible = IIf(fTemp Is aFrame, True, False)
fTemp.Visible is a Boolean so it expects a boolean return value.
The expression, fTemp Is aFrame, gets evaluated, and the result
is passed in as a variant holding a boolean. The other two
parameters also get stuck into variants. The return value is
another variant that gets it's value copied in from one of the last
two parameter variants. Finally, the return variant boolean value
gets extracted to get assigned to the .Visible property.

You think this is fine, but have posted in the past to use
Left$ rather than Left? :confused:
This is many times more inefficient than the difference between
Left$ and Left.

Volte
03-16-2002, 09:33 PM
*cough*

:-\

I... uh... well, I guess your right. I wouldn't say IIf is banished though. I do use it (and still intend to use it) in certain places. It's not harming anything if it fires a few times. I would never use it in a long, tight loop though, that would probably slow it down considerably.

Thinker
03-16-2002, 09:43 PM
I know I should let this drop, but I am just too curious. Volte,
please give me an example where it would be appropriate over
a plan-old If Then?

Derek Stone
03-16-2002, 10:40 PM
* Crazed-Lunatic chuckles to himself and then proceeds to close the thread to avoid a conflict

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum