Results 1 to 13 of 13

Thread: 4 General Beginner questions!

  1. #1

    Thread Starter
    Member Skill Jaan's Avatar
    Join Date
    Apr 2003
    Location
    Islamabad, Pakistan
    Posts
    42

    Question 4 General Beginner questions!

    1. When a form is loaded, the window is positioned: Top = XX Left = XX. I want to position it like this:
    Top = 10
    Right = 10
    I couldnt find any property by which I can do this. I thought if I could do this by doing it like this:
    Top = 10
    Left = The number equal to (800 -10 - Width of form)
    It did the trick but I wonder if it will work on a machine with display settings "640 x 480" or ""1024 x 768"?

    2. I have set the border to None so that there is no title bar. I have the caption set to "Something". Now "Something" appears on the taskbar when the form is loaded. I want to make it appear like the caption of other windows appear in the task bar i.e. like "a small icon + Something". I searched the properties and found the Icon property. But when I set an Icon to that property it does not appear in the task bar. Is there any other property? How can I do this?

    3. I have 4 buttons on my form that are working as Tabs. So tat when the user clicks on a tab, the relevant Tab info will be displayed. How can I make appear the different Tab info when a user switches on to a different Tab.
    I solved it like this; by making 4 frames and putting the contents of each Tab into the relevant frames. Then I made the 1st frame Visible = True and the remaining 3 Visible=False. Then on each button I put the event to make the relevant frame Visible=True and the remainig frames Visible=False.
    Is the above method the right way? But it makes managing the frames really hard because in the design mode all the frames are piled one above the other and it is realy hard to edit the frames. How to solve this??

    4. I have a form with signin button and username and password text boxes on it. I want that when the user puts the data and clicks on the button, the button and textboxes disappear and a small animation starts (as it does when you sign in to the MSN messenger) and when the sign in is successful the animation stops and the Tree View of contacts appear. Suppose I have that animation as a .Gif file or an .swf (flash) file. How can I do this?

    Thanx for being so patient to read all these questions. It would be very kind if you people help me out. Thanx in advance!

  2. #2
    Fanatic Member sridharavijay's Avatar
    Join Date
    Sep 2002
    Location
    http://www.vijaysridhara.in
    Posts
    589

    Re: 4 General Beginner questions!

    Originally posted by Skill Jaan
    1. When a form is loaded, the window is positioned: Top = XX Left = XX. I want to position it like this:
    Top = 10
    Right = 10
    I couldnt find any property by which I can do this. I thought if I could do this by doing it like this:
    Top = 10
    Left = The number equal to (800 -10 - Width of form)
    It did the trick but I wonder if it will work on a machine with display settings "640 x 480" or ""1024 x 768"?

    2. I have set the border to None so that there is no title bar. I have the caption set to "Something". Now "Something" appears on the taskbar when the form is loaded. I want to make it appear like the caption of other windows appear in the task bar i.e. like "a small icon + Something". I searched the properties and found the Icon property. But when I set an Icon to that property it does not appear in the task bar. Is there any other property? How can I do this?

    3. I have 4 buttons on my form that are working as Tabs. So tat when the user clicks on a tab, the relevant Tab info will be displayed. How can I make appear the different Tab info when a user switches on to a different Tab.
    I solved it like this; by making 4 frames and putting the contents of each Tab into the relevant frames. Then I made the 1st frame Visible = True and the remaining 3 Visible=False. Then on each button I put the event to make the relevant frame Visible=True and the remainig frames Visible=False.
    Is the above method the right way? But it makes managing the frames really hard because in the design mode all the frames are piled one above the other and it is realy hard to edit the frames. How to solve this??

    4. I have a form with signin button and username and password text boxes on it. I want that when the user puts the data and clicks on the button, the button and textboxes disappear and a small animation starts (as it does when you sign in to the MSN messenger) and when the sign in is successful the animation stops and the Tree View of contacts appear. Suppose I have that animation as a .Gif file or an .swf (flash) file. How can I do this?

    Thanx for being so patient to read all these questions. It would be very kind if you people help me out. Thanx in advance!






    1. If the units are set to "Twips" then the form will show at the same location on any resolution
    2.Go to forms Icon property and select an icon from your system (max 32x32) ..If you want to set an icon for project.... go to project properties and set the icon to the above forms icon
    3.That is a right way for tabs... but you can make your form big one and arrange all the frames so that you can edit them.. and use forms move method during form load event to place them correctly

    4. Som'ne could answer this.....I'vent worked on Anim!!!! Gucd luck

  3. #3
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611
    1 Much puzzle, someone on the forum know the answer, I don't, I always puzzle until it works and look fine.
    2 To do that the form must have a border, in which you cna set an icon, which will appear in the taskbar
    3 Use the focus and the unfocus events, to know where the user is looking on you form
    4 Search this forum, many examples are given before

  4. #4
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    1. I guess the numbers you supplied are in pixels, while the form's left and top properties work with twips.

    VB Code:
    1. Private Sub Form_Load()
    2.     Me.Top = 10 * Screen.TwipsPerPixelY
    3.     Me.Left = Screen.Width - (Me.Width + (10 * Screen.TwipsPerPixelX))
    4. End Sub

    2. Skill Jaan already told this, but to explain it a bit further: The taskbarbutton shows an icon if the form shows an icon. With borderstyle set to none, the form doesn't show an icon, so the taskbarbutton won't either. Maybe there is a solution to this with an API call, but I don't know it.

    3. I would suggest to use an SSTab control (microsoft tabbed dialog control). This works much easier.

    4. There is a dll around (I believe it is called gif89.dll) that can be used to show an animated gif. Search the net for it, I am sure you will find it. Another option is to use a webbrowser control (microsoft internet controls), but i think that is a bit of overkill.
    To show a flash movie, you can use the Shokwave Flash control.
    Frans

  5. #5

    Thread Starter
    Member Skill Jaan's Avatar
    Join Date
    Apr 2003
    Location
    Islamabad, Pakistan
    Posts
    42
    1. The form's Top and Left properties are already in Twips, so problem solved! Thanx Frans C By the way How many Twips are there in 1 pixel?

    2. When I set the border to 1 , and add the icon, it still doesnt show in the title bar nor the taskbar because the Controlbox is set to false. When I set it to false the icon appears when the border is set to 1. But I wanna keep the border = 0 and still show the taskbar Icon. There must be a way man!

    3. Thanx sridharavijay I will manage it now.

    4. I guess I shall use the .swf file cuz I dont wanna go into that .dll thing. How much does an animation in .swf format increase the size of the file as compared to the .Gif?

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    A pixel is normally 15 twips.

    You shouldn't use the form width with your calculations since that include the form border, and you can never be sure how large this border is. Height is even worse since that include the Title bar and menu bar (if present). Always use ScaleWidth or ScaleHeight.

  7. #7

    Thread Starter
    Member Skill Jaan's Avatar
    Join Date
    Apr 2003
    Location
    Islamabad, Pakistan
    Posts
    42

    Thanx

    Originally posted by Joacim Andersson
    A pixel is normally 15 twips.

    You shouldn't use the form width with your calculations since that include the form border, and you can never be sure how large this border is. Height is even worse since that include the Title bar and menu bar (if present). Always use ScaleWidth or ScaleHeight.
    Thanx for the advice, but that doesn't matter in my project cuz the border is set to 0 and there is no Title bar nor Menu bar.

    By the way is that the only difference between the Width and ScaleWidth properties?

  8. #8
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    No, a forms width and height are always messured in Twips while the ScaleWidth/Height are messured in whatever you've set the ScaleMode property to. Personally I would use the ScaleXXX properties even if the form doesn't have any border so you don't have to change your code if you at a later point would change the ScaleMode for some reason.

  9. #9
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    The number of twips in a pixel depend on the font settings in windows. Normally this is 15, but with large fonts I believe it is 12, and with custom format this can be any value. You better don't hardcode it into your app, but use Screen.TwipsPerPixelX and Screen.TwipsPerPixelY.

    It is rediculous to say that you shouldn't use the Width and Height properties of a form, and should always use the ScaleWidth and ScaleHeight properties instead. Use the properties that give you the information you need. There is a use for both. In this case you want to know the width of the window (including borders), so you need the Width property and not the ScaleWidth property. Sorry Joacim, but in this case the scalewidth and scaleheight properties are useless.
    Frans

  10. #10
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Originally posted by Frans C
    In this case you want to know the width of the window (including borders), so you need the Width property and not the ScaleWidth property. Sorry Joacim, but in this case the scalewidth and scaleheight properties are useless.
    That's not really true, because he want to position a control on the form according to the width. A control can only be placed on the client part of the form and the ScaleWidth/Height messures that, not the Width or Height properties. In this case he uses a borderless form with the ScaleMode set to Twips so that means the Width and ScaleWidth returns the same value, but that doesn't mean that using the Width property of the Form to position controls is the correct property to use.

  11. #11
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    He doesn't want to position a control on a form, but a form on a screen.
    Read his first post.

    But you are correct that in this particular case both properties should return the same value.
    Frans

  12. #12
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Originally posted by Frans C
    He doesn't want to position a control on a form, but a form on a screen.
    Read his first post.

    But you are correct that in this particular case both properties should return the same value.
    Sorry, I've misunderstood the question, I though he wanted to position a control on the form. I stand corrected, in this case he should definitely use the Width property and not the ScaleWidth property.

  13. #13

    Thread Starter
    Member Skill Jaan's Avatar
    Join Date
    Apr 2003
    Location
    Islamabad, Pakistan
    Posts
    42

    Smile

    Thanx everybody!
    But Still cant find out how can I show an icon in the taskbar when border is set to 0.
    How much large does the .Swf file make the size of the application as compared to .Gif file? I am asking so as to choose between the two formats.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width