Results 1 to 7 of 7

Thread: How to maximize button in Canvas?

  1. #1
    Join Date
    Jun 2011
    Posts
    101

    How to maximize button in Canvas?

    Since past few couple of weeks I am trying to use this code to determine the current screen resolution in my monitor and enable or disable the maximize button in the size width defined in the argument. However, it is not working for me app.open. Can anyone tell me what I'm doing wrong? Thank you in advance.

    Code:
    Check the current resolution and set application accordingly
      Dim intWidth As integer
      Dim intHeight As integer
      intWidth = Screen(0).availablewidth
      intHeight = Screen(0).availableheight
      
      If intWidth > 1024 Then
        frmMain.MaximizeButton=False    
      Else
        frmMain.MaximizeButton=True
      End

  2. #2
    Join Date
    Jun 2009
    Posts
    1,518

    Re: How to maximize button in Canvas?

    Normally, the activation state of the window buttons are managed by the operating system, in any case, the only options we have as developers are simply whether visible or not. I'm not at my Windows machine at the time (which is when it comes to the office), but on the Mac, at least, the Maximize button remains active regardless of the size of the window, even at the maximum. Amctavis As indicated, this can be a barrier rather than operating under a RB one. If the ability to change the enabled state of buttons are available, however, I'm willing to bet that the MBS plug-ins that have some functionality.

  3. #3
    Join Date
    Nov 2008
    Posts
    1,514

    Re: How to maximize button in Canvas?

    You can allow yourself to use the following code. Do use it in Windows with declare. I have edited for you.


    Code:
    Sub DisableMaximizeButton()
      const GWL_STYLE = -16
      const WS_MAXIMIZEBOX = &h10000
      const WM_NCPAINT = &h85
      
      declare function GetWindowLong lib "user32" alias "GetWindowLongA" (hWnd as integer, nIndex as integer) as integer
      declare function SetWindowLong lib "user32" alias "SetWindowLongA" (hWnd as integer, nIndex as integer, value as integer) as integer
      declare function SendMessage lib "user32" alias "SendMessageA" (hWnd as integer, msg as integer, wparam as integer, lparam as integer) as integer
      
      dim n, ret as integer
      
      n = GetWindowLong(self.Handle, GWL_STYLE)
      n = bitwise.bitand(n, (bitwise.OnesComplement(WS_MAXIMIZEBOX)))
      ret = SetWindowLong(self.Handle, GWL_STYLE, n)
      ret= SendMessage(self.Handle, WM_NCPAINT, 0, 0)
      
    End Sub

  4. #4
    Join Date
    Mar 2009
    Posts
    1,360

    Re: How to maximize button in Canvas?

    Unfortunately, no! My toolbar graphic is attached to the main window (actually the only). The text menu (File, Edit, View, etc.) are all connected to the MDI window outside. Obviously I want to match the size of the MDI window, so the ultimate code. However, even when maximized MIN / MAX / off button inside the window are displayed. Therefore, I have to hide them in Windows. On Linux and OS X, this is an issue not as MDI is not handled by a sinister visible "father" of the window.

  5. #5
    Join Date
    Nov 2008
    Posts
    1,259

    Re: How to maximize button in Canvas?

    As I see it, my options are three to figure out some way to: 1) set the graphics toolbar for MDI and hide everything on the inside window 2) has the menu bar (not to be confused with toolbar graphics) on the main present window and MDI completely beyond or 3) simply hide the MIN / MAX / Close buttons in the internal window.

  6. #6
    Join Date
    Nov 2008
    Posts
    1,185

    Re: How to maximize button in Canvas?

    I have used it, but I think Tim has given me what I want. The problem I am trying to solve has nothing to do with the actual size of the window, and everything to do with how it looks on every platform. In OS XI obviously want the default MIN / MAX / CLOSE. However, in Windows, due to the nature of MDI ends with two sets of MIN / MAX / CLOSE (one for the internal window, and one for the MDI window). The reason for is that the use of MDI is for (besides my toolbar icon elegant) and displays the main menu (ie File, Edit, etc.). So, basically, "shrink wrap" the main program window to the MDI window.

  7. #7
    Join Date
    Nov 2008
    Posts
    1,192

    Re: How to maximize button in Canvas?

    Note that the below code for SendMessage is way to refresh the non-client area. I am sure it will work properly.
    Code:
    dim n, ret as integer
      dim mb as new MemoryBlock(16)
      
      n = GetWindowLong(self.Handle, GWL_STYLE)
      n = bitwise.bitor(n, WS_MAXIMIZEBOX)
      ret = SetWindowLong(self.Handle, GWL_STYLE, n)
      ret= SendMessage(self.Handle, WM_NCPAINT, 0, 0)
      
    End Sub

Similar Threads

  1. Canvas HD A116 vs Canvas 2 A110 vs Infinity A80
    By Rajminder in forum Polls & Voting
    Replies: 4
    Last Post: 29-03-2013, 01:05 PM
  2. How to maximize the pre rendered frames?
    By Chuluun in forum Monitor & Video Cards
    Replies: 4
    Last Post: 28-07-2011, 02:33 PM
  3. How to use <canvas> tag in HTML5
    By Aia Zav in forum Software Development
    Replies: 7
    Last Post: 26-02-2011, 01:52 PM
  4. always maximize new windows
    By adrin in forum Windows XP Support
    Replies: 3
    Last Post: 22-11-2008, 10:57 PM
  5. Maximize Windows Explorer
    By Kajj in forum Windows XP Support
    Replies: 5
    Last Post: 16-10-2008, 10:29 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,281,276.49664 seconds with 17 queries