Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • Last Modified:

Created option array(s) not visible

I have created a form with 3 option buttons in 1 frame - frame1(0)  opt_ads(0) opt_percent(0)

though a loop I use the load statement to add 5 more combinations of the above ( in other words - an array of frame1(0) - frame1(5) and arrays of opt_ads(0) - opt_ads(5) and opt_percent(0) - opt_percent(5)
Each option button when created is assigned a container - to the corresponding frame - they do fit inside the frame

with frm_TimedDisplays
 for i = 1 to 5        
    Load .Frame1(i)
            With .Frame1(i)
                .Top = yPos - 10
                .Visible = True
                .ZOrder 0
            End With

   Load .opt_Ads(i)
            With .opt_Ads(i)
                .Top = yPos
                Set frm_TimedDisplays.opt_Ads(i).Container = frm_TimedDisplays.Frame1(i)
                .Visible = True
            End With

   Load .opt_Percentage(i)
            With .opt_Percentage(i)
                .Top = yPos
                Set frm_TimedDisplays.opt_Percentage(i).Container = frm_TimedDisplays.Frame1(i)
                .Visible = True
            End With
       
 next i
end with

 I have varified that the container statement does in fact work ( I can see the property - set focus to the button- and othe verifications)  properly and the option buttons are in fact put in as part of that frame -

THE PROBLEM (finally:)

I can't get the option buttons to appear - I have tried Zorder on the buttons , frames, containers - Set AutoRedraw - made frames invisible - then visible - same with buttons - Its like when you design a frame and put buttons on it sometimes you have to "sendtoback" the frame - this works fine in design but I cannot get anything to work programmically

please advise - thanks
bc

0
bczingo
Asked:
bczingo
  • 3
  • 3
1 Solution
 
bczingoAuthor Commented:
oops - should read 2 option buttons
0
 
ShauliCommented:
Dim yPos As Long

yPos = Frame1(0).Top + Frame1(0).Height

With frm_TimedDisplays
    For i = 1 To 5
        Load .Frame1(i)
            With .Frame1(i)
                .Top = yPos
                .Visible = True
            End With

        Load .opt_ads(i)
            With .opt_ads(i)
                Set frm_TimedDisplays.opt_ads(i).Container = frm_TimedDisplays.Frame1(i)
                .Top = opt_ads(0).Top
                .Visible = True
            End With

        Load .opt_percent(i)
            With .opt_percent(i)
                Set frm_TimedDisplays.opt_percent(i).Container = frm_TimedDisplays.Frame1(i)
                .Top = opt_percent(0).Top
                .Visible = True
            End With
    yPos = Frame1(i).Top + Frame1(i).Height
    Next i
End With

S
0
 
bczingoAuthor Commented:
thanks S - but it doesn't help - I've made sure that the opt buttons are inside the frame several different ways-
Its like I said - make a frame - put opt buttons in it - send opt buttons to back and you can't see them but they are there
I need to bring them to the front

besides - It seem your code starts the top of the opt button at the bottom of the frame anyway
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ShauliCommented:
Have you ran this code? I don't think so. Start a project put the Frame1(0) on it and the two Option buttons(0) on it. Put a command button and put my code in the command button click event. It works. Itested it.

Good luck,

S
0
 
ShauliCommented:
ps. The reason why your code doesn't work is NOT because the option buttons are sent to back, it is because their TOP property is not set right. Same thing with the frame. That is all. The top property of the option buttons should be the same as the first buttons (in frame(0)). as they are located in a duplicated frame, and the top begins from 0 in each new frame. Then with your frame - you locate the new frames ON TOP of the original frame and subtract 10?????? if you want the frames one below the other then you need to calculate the top of the first frame and its height as I did in my code : yPos = Frame1(0).Top + Frame1(0).Height

Now, with that in mind, copy my code to your project and test it. It will work.

Hope this clears this issue,

S
0
 
bczingoAuthor Commented:
sorry left out-
before the loop
yInc= frame1(0).height + (frame1(0).height*.25)

and at end inside of loop

yPos = yPos + yInc

The frames do space down the form


I ended up kludging solution with checkboxes
havent tried your code yet - but i will
thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now