dcsimg
Page 1 of 2 12 LastLast
Results 1 to 40 of 59

Thread: Form Question - About Min and Max

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Form Question - About Min and Max

    I want the Min, Max, and Close Buttons enabled but I do not want user to Min, Max, or Close the Form.

    I know to use Cancel = True in Form_Unload() to prevent user from closing Form however I can't use this method because then the main Form will not be able to close it's sub Forms

    How to prevent these events.
    Last edited by jmsrickland; Oct 30th, 2013 at 02:47 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,596

    Re: Form Question - About Min and Max

    If you don't want the functionality, then why confuse the user with an UI which doesn't work as expected?

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,928

    Re: Form Question - About Min and Max

    Yeah.. it makes no sense to have a min, max and close button but not allow them to do what they are supposed to do.

    I suppose you could override the min and max buttons in the resize event by simply setting the windowstate to normal.

    As for the query unload you could use a flag var or you could test why the form is being unloaded but again why put the buttons there if they are not going to work all it would do is confuse the user and make it seem like your program is not working.

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,543

    Re: Form Question - About Min and Max

    Next we'll see a thread asking how to let users type into Command Buttons.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Form Question - About Min and Max

    You guys should just answer the request if you know the answer and not question why. I don't make the rules; I just do what is wanted whether I agree or not about the request; so should you


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  6. #6
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,928

    Re: Form Question - About Min and Max

    Quote Originally Posted by jmsrickland View Post
    You guys should just answer the request if you know the answer and not question why. I don't make the rules; I just do what is wanted whether I agree or not about the request; so should you
    Really? No thanks, I don't know about you but my customers come to me because I know how things should be done and I am quick to tell them when they ask for something that does not make sense. They expect that from me as well since I am the professional and should know best.

    If I simply gave them what they asked for without pointing out things that do not make sense and making proper adjustments I would end up re writing a lot of software, loosing money and likely loosing several customers.

    If a customer asked me for something like this I would be quick to explain why they should not do it, how it will confuse the user, how it will cause wasted tech support time and just in general a very bad idea. of course if once they know the issues they insist and want to pay then I will give them what they ask for but will charge them extra when they come back to me to have it changed ... and they will

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Form Question - About Min and Max

    You are totally off base, DM. I am not in a position to tell anybody anything or suggest anything. That's already been decided on; I just do what is asked of me. I am not the designer and I'm sure they have already taken that into account and they have their reasons which are not reveled to me; I'm the coder and that's what I get paid for.
    Last edited by jmsrickland; Oct 30th, 2013 at 05:51 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  8. #8
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,928

    Re: Form Question - About Min and Max

    I used to work with a guy that did just that, on several occasions he submitted his work and quickly the question came up as to why the program was the way it is and his answer would be "That is what you asked for" Then they would tell him what they wanted now and he would redo the program.

    One day I was in the room with him when he received the outline for a new project so I just sat and listened to the requirements and picking up on what he was getting from it. Then once the boss left the room I said to the other guy you think he wants xyz right? He said yes. I said you know that is not what he actually wants right? He says what do you mean? I said that will not do what he is really wanting to do and not the way he wants to do it, what you really need to do is this .... He says, oh, that makes a lot more sense, why did he not say that

    I have also in the past given customers exactly what they asked for and then had to answer the question as to why I did it that way. Of course I said that is what you asked for and their response was "What do we know about programming? You are the professional and we expect you to let us know and correct issues such as this. That is why we are paying you the big bucks."

  9. #9

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Form Question - About Min and Max

    I agree and I also agree about the disabling of the functions but like I said I am not in a position to say anything. I am given the requirements and the last time I suggested something I got the "just do as you are told and let us worry about that" bit so now I let them worry about that. I know from experience that team members who do the designing don't like to be advised by the coders; they seem to get a little apprehensive about it. I'm sure they know what they are doing and that's why I work for them instead of them working for me. Now, if they came to me for advice in addition to coding then that's different. I have learned to know when to keep my mouth closed and just do as asked and everything works out OK. I'm happy, they're happy, and every body goes home happy.

    P.S. I do, however, have the say so if it turns out either it can't be done or I myself don't know how to do it. That's why I am asking so that I can either do it and get it done or tell them it can't be done
    Last edited by jmsrickland; Oct 30th, 2013 at 06:07 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  10. #10
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,638

    Re: Form Question - About Min and Max

    Quote Originally Posted by jmsrickland View Post
    I want the Min, Max, and Close Buttons enabled but I do not want user to Min, Max, or Close the Form.
    It cannot be done....at least not cleanly.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  11. #11
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,886

    Smile Re: Form Question - About Min and Max

    Never tried, but, what if you re-set the Height and the Width properties of the form in the Resize event with the same properties values of the design

    EDIT: Just tried and it can't be done...
    Last edited by jggtz; Oct 30th, 2013 at 06:38 PM.
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  12. #12
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,928

    Re: Form Question - About Min and Max

    All you would need is something like this
    Code:
    Private Sub Form_Resize()
         If Not Me.WindowState = vbNormal Then Me.WindowState = vbNormal
    End Sub
    Using a flag var on the query unload works fine, just set it to true when you want to close the form
    Code:
    Option Explicit
    Dim AllowClose As Boolean
    
    Private Sub Command1_Click()
        AllowClose = True
        Unload Me
    End Sub
    
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
       Cancel = Not AllowClose
    End Sub
    
    Private Sub Form_Resize()
        If Not Me.WindowState = vbNormal Then Me.WindowState = vbNormal
    End Sub
    Last edited by DataMiser; Oct 30th, 2013 at 06:50 PM.

  13. #13
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,098

    Re: Form Question - About Min and Max

    For my two cents I really think that is just such an occasion when you should ask why. Better yet ask something along the lines of:

    "So you want these three elements incorporated into the UI? What functionality should be associated with those elements, please?". When they say "None", ask them if they would like some radio buttons and checkboxes randomly thrown in as well. ;-)

    Better yet, give them a quote of two man-days for the effort of coding their requirement versus an estimate of 30 seconds to remove the control-box.
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  14. #14
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,928

    Re: Form Question - About Min and Max

    Quote Originally Posted by ColinE66 View Post
    Better yet, give them a quote of two man-days for the effort of coding their requirement versus an estimate of 30 seconds to remove the control-box.
    Sounds like something I would do

  15. #15
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,098

    Re: Form Question - About Min and Max

    Indeed. Money is a language they can understand
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  16. #16
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,928

    Re: Form Question - About Min and Max

    One other note the flag var is not needed. unloadmode is 0 when the x is clicked and 1 when unload me is executed from code so

    Something like this will override the x button but still allow you to unload the form via code
    Code:
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Cancel = (UnloadMode = 0)
    End Sub

  17. #17
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,057

    Re: Form Question - About Min and Max

    Code:
    Option Explicit     'In modSubclass.bas
    
    Private Const SC_CLOSE         As Long = &HF060&
    Private Const SC_MAXIMIZE      As Long = &HF030&
    Private Const SC_MINIMIZE      As Long = &HF020&
    Private Const SC_RESTORE       As Long = &HF120&
    Private Const SC_SIZE          As Long = &HF000&
    
    Private Const WM_DESTROY       As Long = &H2
    Private Const WM_GETMINMAXINFO As Long = &H24
    Private Const WM_SYSCOMMAND    As Long = &H112
    
    Private Type POINT
        X As Long
        Y As Long
    End Type
    
    Private Type MINMAXINFO
        ptReserved     As POINT
        ptMaxSize      As POINT
        ptMaxPosition  As POINT
        ptMinTrackSize As POINT
        ptMaxTrackSize As POINT
    End Type
    
    Private Declare Function CallWindowProcW Lib "user32.dll" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Private Declare Function DefSubclassProc Lib "comctl32.dll" Alias "#413" (ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Private Declare Function SetWindowSubclass Lib "comctl32.dll" Alias "#410" (ByVal hWnd As Long, ByVal pfnSubclass As Long, ByVal uIdSubclass As Long, ByVal dwRefData As Long) As Long
    Private Declare Function RemoveWindowSubclass Lib "comctl32.dll" Alias "#412" (ByVal hWnd As Long, ByVal pfnSubclass As Long, ByVal uIdSubclass As Long) As Long
    
    Private m_FixedWidth  As Long
    Private m_FixedHeight As Long
    
    Public Function Subclass(ByRef Form As VB.Form) As Boolean
        m_FixedWidth = CLng(Form.Width / Screen.TwipsPerPixelX)
        m_FixedHeight = CLng(Form.Height / Screen.TwipsPerPixelY)
    
        Subclass = SetWindowSubclass(Form.hWnd, AddressOf SubclassProc, AddressOf GetMinMaxInfo, AddressOf SubclassProc):   Debug.Assert Subclass
    End Function
    
    Private Function SubclassProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long, _
                                  ByVal uIdSubclass As Long, ByVal dwRefData As Long) As Long
        Select Case uMsg
            Case WM_GETMINMAXINFO
                SubclassProc = CallWindowProcW(uIdSubclass, hWnd, uMsg, wParam, lParam)
                Exit Function
    
            Case WM_SYSCOMMAND
                Select Case wParam And &HFFF0&
                    Case SC_CLOSE, SC_MAXIMIZE, SC_MINIMIZE, SC_RESTORE ', SC_SIZE 'works too, but not so well with Aero Snap
                        Exit Function
                End Select
    
            Case WM_DESTROY
                dwRefData = RemoveWindowSubclass(hWnd, dwRefData, uIdSubclass): Debug.Assert dwRefData
        End Select
    
        SubclassProc = DefSubclassProc(hWnd, uMsg, wParam, lParam)
    End Function
    
    Private Function GetMinMaxInfo(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByRef lParam As MINMAXINFO) As Long
        lParam.ptMinTrackSize.X = m_FixedWidth
        lParam.ptMinTrackSize.Y = m_FixedHeight
        lParam.ptMaxTrackSize.X = m_FixedWidth
        lParam.ptMaxTrackSize.Y = m_FixedHeight
    End Function
    Code:
    Option Explicit     'In a blank Form
    
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
        If KeyCode = vbKeyEscape Then Unload Me
    End Sub
    
    Private Sub Form_Load()
        Subclass Me
    End Sub
    EDIT

    The subclassing code above now incorporates the prevention of window resizing as requested in this thread.
    Last edited by Bonnie West; Nov 6th, 2013 at 08:47 AM.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  18. #18
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,638

    Re: Form Question - About Min and Max

    Very nice Bonnie!!. Before I made my previous post, I looked through this list for any message that looked like it could tell me when a Form's WindowState was going to be changed and none seemed to fit. I would have never guessed it was a parameter of WM_SYSCOMMAND. You never cease to amaze me with your knowledge of the Win32 API.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

  19. #19
    Fanatic Member
    Join Date
    Jan 2013
    Posts
    648

    Re: Form Question - About Min and Max

    Quote Originally Posted by jmsrickland View Post
    I am not in a position to tell anybody anything or suggest anything.
    Sorry, but I disagree.
    I honestly believe it is our duty to challenge nonsense like this. If we don't, nobody else will - until the Users see the program and complain like mad.

    Quote Originally Posted by jmsrickland View Post
    That's already been decided on; I just do what is asked of me.
    Just because it's been "decided" doesn't mean that it should have been or that it's right. What if they "decided" that installing your application must turn off UAC and disable virus checking on your customers' computers?

    I find that many "decisions" like this, like those far-left-field "Requirements" that go way beyond the VB "box", aren't worth the paper they're written on and, given any kind of reasoned argument, will crumble away to nothing, being simply someone's half-baked, "bright" idea.

    Quote Originally Posted by jmsrickland View Post
    I am not the designer and I'm sure they have already taken that into account and they have their reasons which are not revealed to me
    IMHO, that's a very dangerous assumption.

    Many designers I've worked with in recent years don't have a Scooby how Windows is supposed to work and will come up with things "just to be different". That usually means not following standard Windows conventions, confusing your Users and, on balance, completely wasting time and money in (a) writing the stupid things in the first place and (b) "fixing" them when the complaints and Bug Reports roll in.

    I know it's a difficult place to be and it won't win you any "Brownie points" with "The Bosses" but I find they take constructive criticism and reasoned arguments early on far "better" than they receive the "I told you so's" once the product's been released - and slated by the user community.

    Regards,
    Phill W.

    p.s. Good Luck.

  20. #20

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Form Question - About Min and Max

    @Phill

    I work as a contractor for various companies and I work at home. My name is on the list of available programmers with a professional job placement service and they contact me whenever a company is in need of extra help. I work on a 'need to know basis'. If I need to know they tell me; if I don't need to know they don't tell me. I am given the requirements and I can accept or decline the request. I have worked for this company many times in the past and I know how they are. They have teams of designers but have no on site programmers or coders if you will. I am only working on a very small part of a bigger project and I don't even know what the overall project is nor do they tell me. When I am given an assignment and I accept it I go by a pre-written list of requirements. I follow the rules. I don't even communicate with anyone at the company; I only communicate with the placement service. I rarely ever see or know what the finished project is. I really do not have the means to discuss what my thoughts are (like in this case). I do my part, send them the results of my work and that's it. I don't even know anyone at the company I am working for. I do not hear form them again unless they want to have me redo something, do more, or hire me again someday and then it's through the placement service.

    If I was working for a particular company and I was an on site programmer then it would be different. I would make comments and suggestions but that is simply not the case here as I think I have explained.

    The thing is this: does it matter why they want this or that? No. Does it backfire on me if their project doesn't work right? No, unless it is a result of a mistake I made but not if I did not make any and I followed the requirements to a T. Do I care? Only what I do and nothing else. I have a certain requirement to do and I do it. Did the total project fail? I have no idea since I do not get informed of anything about it.
    Last edited by jmsrickland; Oct 31st, 2013 at 01:58 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  21. #21
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,543

    Re: Form Question - About Min and Max

    If a subclassing hack does what's needed these have been posted here many times before.

    http://www.vbforums.com/showthread.p...M_CLOSE-events

  22. #22
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,491

    Re: Form Question - About Min and Max

    I do not see any reason to hack this. Yes, it can probably be done as Bonnie pointed out, but the users will see a Min, Max and Close button. They will expect it to function as they are accustomed to. Full stop.

    I have never really liked some requests I had in the past as well, I always try to think of the end user at the end of the day. It helps nothing we confuse them with how things work. Then, I take it a step further and ask myself why MS made the Office suite buttons mostly the same? It is so that the users can adapt to their products easily.

    I would tell my boss ( whether I am a contractor or not ) that this is really a bad idea.

    Just my 2 cents
    VB.NET MVP 2008 - Present

  23. #23
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Form Question - About Min and Max

    Given JM's explanation, the requirement could be justifiable.

    I could (just about) imagine a situation where users are being trained to use a new system. Part of the training is to demonstrate the flow of the system from one form / screen to another. Allowing the trainee to close forms manually would nullify the whole purpose of that particular exercise. Perhaps the implications of doing so comes later in the training exercise.

    So, the trainee sees the production system forms / screens in all their glory but, for training purposes, with restrictions on what they can do. Yes, the Trainer could request the trainees not to manually close the forms, but we all know that there would be at least one bright spark who would, just to see what happens, which might cost the class 15 minutes whilst a few individuals get back to where they should be.

    Without knowing the purpose of the overall system and the designer's intentions there's no point in trying to second guess.
    Last edited by Doogle; Nov 1st, 2013 at 03:10 AM.

  24. #24
    Fanatic Member
    Join Date
    Aug 2013
    Posts
    806

    Re: Form Question - About Min and Max

    One addendum to Bonnie's very good subclassing example above - for reasons known only to Microsoft engineers, using the "Aero snap" feature to maximize a window (by dragging the titlebar to the top of the monitor) will not send the SC_MAXIMIZE message. Strangely, it will also not send the SC_SIZE message (&HF000&).

    It will, however, send the SC_MOVE message, so you can declare that as follows and add it to the list of messages to check:

    Code:
    Private Const SC_MOVE As Long = &HF010&
    Not sure if relevant to this particular problem, but thought I'd mention it just in case.
    Check out PhotoDemon, a pro-grade photo editor written completely in VB6. (Full source available at GitHub.)

  25. #25

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Form Question - About Min and Max

    @DM
    @Colin
    @Phill
    @HanesTheGreat

    I would like for you all to read my post #20 then answer these...

    1) To whom will you ask what is the purpose of this

    2) To whom will you tell that this is a bad idea or it is nonsense


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  26. #26
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,098

    Re: Form Question - About Min and Max

    Tell the placement service to pass your thoughts onto their client? You say that they are the only people you have contact with so clearly that is the only answer and it is therefore strange that you ask. I think we can all reasonably assume that the placement service is in contact with the person requesting the work. Of course, in your situation, I'd probably not talk myself out of the income...
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  27. #27

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Form Question - About Min and Max

    No, I really do not talk with anyone at the placement service besides they do not themselves get involved with this. It's all handled by emails. I do not ask the placement what's this for or tell the placement service that this is a bad idea or it sucks or it's nonsense like some of you posted previously. That is just plain ridiculous to do such a thing and besides who really cares as long as I get it done they don't want to hear my arguments. All they want to know is do I want the assignment, yes or no and that is it so it is absolutely pointless and totally out of context with this thread to suggest such things.

    Yes, yes, yes, I know that what has been said has merit but in the right situation and this is not that situation. It does no good to post these things trying to convince me that I should do some of these suggestions because as stated before several times I can't. It's as simple as that.

    Now, if any of you have a solution other than Bonnie then please post it and I will be very appreciative and thank you.
    Last edited by jmsrickland; Nov 1st, 2013 at 06:34 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  28. #28
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,098

    Re: Form Question - About Min and Max

    Well, if I were you I'd send the email to the placement service, save a copy of it permanently and leave it at that. If the placement service do nothing with it that is up to them but you have (potentially) protected your professional reputation should anything ever arise from it. But that is just me - you are free to do as you wish, of course...
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  29. #29
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,098

    Re: Form Question - About Min and Max

    Better yet, put some comments in the code - they'll see that...
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  30. #30

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Form Question - About Min and Max

    I remember several years ago I took an assignment and I worked hard and diligently on their request and I tested it and tested it and then I tested it again just to make sure that I had done what they wanted and it worked according to their specs. I was so proud of myself. And then I returned it back to them. Later, I was in a position to see the finished project and guess what! They didn't even use anything that I had worked so hard on in the project. They tossed it; change in design I suppose. Kind of hurt my pride a bit. I wouldn't be surprised if this doesn't happen a lot of the time.

    Anyway, no, I will not say anything or put anything in comments and the reason is very simple. I do not believe it is a bad idea, as has been so stated here. I do not believe it is nonsense, as has already been stated here. I do not believe it will do nothing but confuse the user(s), as has already been stated here. I do not believe that it is a design decision that goes beyond the VB box, as has already been stated here. What I do believe is that these statements that have been said are wrong. I don't know, you don't know, no one here knows what their intentions are so why make statements that hold no weight. That the nonsense if you ask me. It has entered my mind and I have to believe it has also entered the minds of the others here at this thread that all they want from me is to deliver a blank Form with the Min, Max, and Close buttons operable but do nothing because they are going to implement their own functionality and they don't want the OS intervening. That makes sense to me. Or, maybe it's part of a program for kids. They want the kids to push the buttons but not have the real functions take place. It can be anything and used for anything. Only they know for sure. Beside, maybe they wont even use it.

    I am not so vague or naive that I wouldn't say something if I thought that the changes they wanted would or could cause undesirable results later on. Of course I would inform them of my professional opinion. But this? Come on, it's a blank Form that does nothing. What's the big deal here? Leave it alone.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  31. #31
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,098

    Re: Form Question - About Min and Max

    Fair enough. But to be fair to everybody who has posted here, this is the first we have heard that the form is a blank one with no functionality. Had we been aware that the entire brief is to disable the default functionality on an otherwise blank form I'm pretty sure you would have not got the responses that you have.

    I'm surprised it didn't occur to you to point out the otherwise 'nothing-ness' of the form earlier?
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  32. #32

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Form Question - About Min and Max

    I didn't point it out because it didn't seem relevant to my question at that time. It shouldn't have mattered. What was relevant was how can this be done; nothing else mattered. I asked a simple straight forward question and I thought I would get a straight forward answers and not a lot of what I did get. Guess I was wrong and from now on I will be on guard knowing that there is no such thing as a straight forward answer to a straight forward question. But it's alright, I'm not offended in the least; I just couldn't understand why all the fuss.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  33. #33
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,098

    Re: Form Question - About Min and Max

    All I'm saying is that it would have occurred to me much sooner than it appear has done to you, that the motivation for other posters making their observations was based upon the assumption that this was a small part of a larger spec. The fact that it is the spec should not have been lost on you. I'm stunned that you couldn't see that and made numerous posts inviting further comments before bothering to point it out. Frankly, it is you who encouraged further discussion around it!!!! It also quite odd that you agreed with the earlier posts (in #9) even when (you alone!!!) knew that that was the entire brief.

    It was never a straightforward question, btw, as you assert above. How can it have been when people pointed out valid observations (within the context of what they knew), that you agreed with and then invited further discussion about before revealing the most pertinent piece of information that was hitherto missing! Am I the only one sighing heavily right now?
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  34. #34
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,928

    Re: Form Question - About Min and Max

    Quote Originally Posted by jmsrickland View Post
    I didn't point it out because it didn't seem relevant to my question at that time. It shouldn't have mattered. What was relevant was how can this be done; nothing else mattered. I asked a simple straight forward question and I thought I would get a straight forward answers and not a lot of what I did get. Guess I was wrong and from now on I will be on guard knowing that there is no such thing as a straight forward answer to a straight forward question. But it's alright, I'm not offended in the least; I just couldn't understand why all the fuss.
    Well you got more than one answer at least 2 different ways to solve the issue, so why is this thread not already marked as resolved?
    The solution I posted is simple and requires no sub classing, the one Bonnie posted uses sub classing, either should do the trick if it must be done.

    I still think it is a very strange requirement and if someone had passed such a thing on to me I would surely have asked questions as I would have thought it was a mistake or an oversight on their part.

    Then again I am not just a coder, I am a designer and a coder and I always ask questions and give feedback on every project i am involved in.
    When something does not make sense I always point it out.

  35. #35

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Form Question - About Min and Max

    Well I don't think it's strange and it makes sense to me.
    Last edited by jmsrickland; Nov 2nd, 2013 at 12:48 AM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  36. #36

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Form Question - About Min and Max

    @DM

    Did you even try your suggestion?

    Code:
    Private Sub Form_Resize()
        If Not Me.WindowState = vbNormal Then Me.WindowState = vbNormal
    End Sub


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  37. #37
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    7,113

    Re: Form Question - About Min and Max

    Personally, JMS, I'd make a borderless form and create buttons/shapes/labels to look like the top border (Min, Max, Close, Title area, etc). And of course have nothing in their click events. This IS, of course, assuming the form will be shown, never shrunk/expanded. Should do what you asked and should take only a few minutes to do it. Lot less time than reading this litany of (now) 37 posts.

  38. #38

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,073

    Re: Form Question - About Min and Max

    I'm not sure they would like anything but a real Form. As I stated previously they may implement their own functionality.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  39. #39
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Form Question - About Min and Max

    Quote Originally Posted by HanneSThEGreaT View Post
    I do not see any reason to hack this. Yes, it can probably be done as Bonnie pointed out, but the users will see a Min, Max and Close button. They will expect it to function as they are accustomed to. Full stop.
    One possible enhancement to Bonnie's code might be (in addition to intercepting
    and disallowing the Min, Max, and Close button action), to have a MsgBox pop up
    with an explanation .. something like "The Min button is not to be used."

    Spoo

  40. #40
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,928

    Re: Form Question - About Min and Max

    Quote Originally Posted by jmsrickland View Post
    @DM

    Did you even try your suggestion?

    Code:
    Private Sub Form_Resize()
        If Not Me.WindowState = vbNormal Then Me.WindowState = vbNormal
    End Sub
    Yes of course I did and it worked just fine
    Basically all it does is override the window state and sets it to normal anytime it is changed to min or max

Page 1 of 2 12 LastLast

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width