CONTROL SET SIZE - not synced behavior for some controls
issueid=18 03-08-2009 13:51
Super Moderator
Number of reported issues by Petr Schreiber: 126
CONTROL SET SIZE - not synced behavior for some controls

Martin discovered that for some of the controls, CONTROL SET SIZE sets size in pixels, even if dialog is in units mode.

It applies for:
  • WebBrowser
  • Viewport
Issue Details
Issue Number 18
Project thinBasic
Category Unknown
Status Fixed
Priority Unknown
Affected Version 1.8.9
Fixed Version 1.9.1
Milestone thinBasic 1.9.0.0
Users able to reproduce bug 0
Users unable to reproduce bug 0
Assigned Users (none)
Tags (none)




22-08-2009 12:47
thinBasic author
Thanks for reporting.
I will try to fix asap.

17-11-2011 16:02
thinBasic author
I should have fixed this

17-11-2011 20:13
Super Moderator
Hi Eros,

in the last 1.9.0.0 you linked in other thread the SET SIZE and creation is still broken for VIEWPORT, other controls seem ok.
Here testing code:
' 
' Viewport test
'
 
Uses "UI"

' -- ID numbers of controls
Begin ControlID
  %vViewport
  
End ControlID 
        
Local hRecyclableDialog As DWord
                                                       
' -- Create dialog here
Function TBMain()
  Local hDlg As DWord
  
  Dialog New 0, "Viewport test",-1,-1, 800, 490, _
                                               %WS_MAXIMIZEBOX   |  
                                               %WS_MINIMIZEBOX   |  
                                               %WS_SYSMENU       |  
                                               %WS_CLIPCHILDREN  |  
                                               %WS_CLIPSIBLINGS  |  
                                               %DS_CENTER           
                                               To hDlg
  
  
  ' -- Viewport should be over whole window, with 5 units offset    
  Control Add VIEWPORT hDlg, %vViewport, "", 5, 5, 790, 480    
    Control Set Size hDlg, %vViewport, 790, 480

                   
  Dialog Show Modal hDlg, Call cbDialog

End Function

' -- Callback for dialog
CallBack Function cbDialog()

  ' -- Test for messages
  Select Case CBMSG

    Case %WM_INITDIALOG
      BuildViewportDialog(Control_GetHandle(CBHNDL, %vViewport))  
      
    Case %WM_COMMAND
    ' -- You can handle controls here

    'SELECT CASE CBCTL
    '
    '  CASE ...
    '    IF CBCTLMSG = ... THEN
    '
    '    END IF
    '
    'END SELECT


    Case %WM_CLOSE
    ' -- Put code to be executed before Dialog End here

  End Select

End Function

                  
                        
Function BuildViewportDialog( hViewport As DWord ) As Long
  ' -- If it exists, destroy it
  If hRecyclableDialog <> 0 Then Dialog End hRecyclableDialog
                  
  Local w, h As Long    
  
  w = 800
  h = 600             
  
  Dialog New hViewport, "", 0, 0, w, h, _
                                          %WS_CHILD Or %WS_CLIPCHILDREN To hRecyclableDialog
  
  Dialog Set Color hRecyclableDialog, %BLACK, %BLACK
  
  Dialog Show Modeless hRecyclableDialog, Call cbViewportDialog
  ViewPort_SetChild(hViewPort, hRecyclableDialog, %FALSE )

End Function          

' -- Callback for dialog
CallBack Function cbViewportDialog()

  ' -- Test for messages
  Select Case CBMSG

    Case %WM_INITDIALOG
    ' -- Put code to be executed after dialog creation here
   

    Case %WM_COMMAND
    ' -- You can handle controls here

    'SELECT CASE CBCTL
    '
    '  CASE ...
    '    IF CBCTLMSG = ... THEN
    '
    '    END IF
    '
    'END SELECT


    Case %WM_CLOSE
    ' -- Put code to be executed before dialog end here

  End Select

End Function
Petr

17-11-2011 21:45
thinBasic author
No Petr, new changes are still not online because I did them today.
I will update new 1.9.0 this night.

Thanks for the example, so I tested it.

Ciao
Eros

17-11-2011 22:35

18-11-2011 00:08
Super Moderator
Thanks Eros!,

I tested all the controls, seems to work fine.
Just one side note - the UpDown control should have in the help file that it requires %WS_CHILD Or %WS_VISIBLE style to be visible (most other controls have this included in help or dont need it).


Petr

18-11-2011 00:50
thinBasic author
I will create a new bug report

+ Reply