Author Topic: Testing new OxygenBasicProgress of 4th Feb 2019  (Read 337 times)

0 Members and 1 Guest are viewing this topic.

Arnold

  • Hero Member
  • *****
  • Posts: 772
Testing new OxygenBasicProgress of 4th Feb 2019
« on: February 05, 2019, 03:43:59 AM »
Hi Charles,

I installed the OxygenBasicProgress.zip and have started to test the demos in examples\WinDynDialogs (in 32-bit). A few small modifications were needed.

in \inc\Dialogs.inc I made a small typo in line 373, this should be:
sub AutoCheckBox
instead of sub AutoCCheckBox

Small modifications are necessary to run these apps with the latest oxygen.dll

DlgFromWin.o2bas line 144:
    do while (bRet := GetMessage(&Msg, NULL, 0, 0)) '!= 0
and:
SimpleModeLess.o2bas line 58:
   while (bRet := GetMessage(&Msg, NULL, 0, 0)) '!= 0
(The part !=0 is not needed and superfluous)

ListView.o2bas line 201
              Dialog( 0,0,144,77, "About Listview Sample",
instead of
              Dialog( 4,0,0,144,77, "About Listview Sample",
(4 is the count of controls in dialog and is not needed any more)

Apart from these small issues the demos run very nice in WinDynDialogs. Will you note the changes for the next release?

Roland


Arnold

  • Hero Member
  • *****
  • Posts: 772
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #1 on: February 05, 2019, 07:53:49 AM »
Hi Charles,

to run the demos of WinDynDialogs in 64-bit I only found this demo of interest:
In FullScreen.o2bas SetWindowPos does not fire. Reading the docu of Win32Help SetWindowPos is declared as:

BOOL SetWindowPos(HWND hWnd,HWND hWndInsertAfter,int X,int Y,int cx,int cy,UINT uFlags)

So I applied in line 56:
             SetWindowPos(hDlg, (sys) HWND_TOPMOST,
...

This looks logical to me, at least the app now works in 64-bit correctly too. What do you think?

I also modified Set/GetWindowlong to Set/GetWindowLongPtr (though Oxygen can handle this without these changes). Thus the adapted code for FullScreen.o2bas would look like this:

Code: OxygenBasic
  1. '====================================================================
  2. ' Fullscreen dialog demo, switch between normal and fullscreen mode
  3. ' modeless dialog as main.
  4. '====================================================================
  5.  
  6. $ filename "FullScreen.exe"
  7. 'uses rtl32
  8. 'uses rtl64
  9.  
  10. '% review
  11.  
  12. uses dialogs
  13.  
  14.  
  15. int ID_TestBtn=100
  16.  
  17. bool FullScreen=False
  18. int oldx, oldy, oldwidth, oldheight
  19.  
  20. '====================================================================
  21.  
  22. function DialogProc(sys hDlg, uint uMsg, sys wParam, lParam ) as int callback
  23.  
  24.    RECT rcDlg
  25.  
  26.    select case uMsg
  27.  
  28.      case WM_INITDIALOG
  29.        ShowWindow(hDlg,SW_SHOW)
  30.        
  31.      case WM_COMMAND
  32.  
  33.         select case loword(wParam)
  34.  
  35.         case ID_TestBtn      
  36.            FullScreen = not FullScreen
  37.        
  38.            if FullScreen then
  39.              GetWindowRect( hDlg, @rcDlg )
  40.              oldx=rcDlg.left : oldy=rcDlg.top
  41.              oldwidth=rcDlg.right-oldx : oldheight=rcDlg.bottom-oldy
  42.  
  43.              int cx, cy
  44.              sys hdc = GetDC(NULL)
  45.              cx = GetDeviceCaps(hdc,HORZRES) +
  46.              GetSystemMetrics(SM_CXBORDER)
  47.              cy = GetDeviceCaps(hdc,VERTRES) +
  48.              GetSystemMetrics(SM_CYBORDER)
  49.              ReleaseDC(null,hdc)
  50.        
  51.              SetWindowLongPtr(hDlg,GWL_STYLE,
  52.                            GetWindowLongPtr(hDlg, GWL_STYLE) and
  53.                            (not (WS_CAPTION or WS_THICKFRAME or WS_BORDER)))
  54.  
  55.              ' Put window on top and expand it to fill screen
  56.             SetWindowPos(hDlg, (sys) HWND_TOPMOST,
  57.              -(GetSystemMetrics(SM_CXBORDER)+1),
  58.              -(GetSystemMetrics(SM_CYBORDER)+1),
  59.              cx+1, cy+1, SWP_NOZORDER)
  60.  
  61.            else
  62.              SetWindowLongPtr(hDlg,GWL_STYLE,
  63.                            GetWindowLongPtr(hDlg, GWL_STYLE) or
  64.                                          WS_THICKFRAME or WS_BORDER or WS_CAPTION)
  65.  
  66.              MoveWindow( hDlg, oldx, oldy, oldwidth, oldheight, true )
  67.            end if
  68.  
  69.         case IDCANCEL
  70.            DestroyWindow( hDlg )
  71.  
  72.         end select
  73.        
  74.      case WM_CLOSE
  75.         DestroyWindow( hDlg )
  76.  
  77.      case WM_DESTROY
  78.         PostQuitMessage( null )
  79.  
  80.   end select
  81.  
  82.   return 0
  83. end function
  84.  
  85. '====================================================================
  86.  
  87. sub WinMain()
  88.  
  89.    sys hDlg
  90.    MSG wMsg
  91.  
  92.    Dialog( 0, 0, 200, 100, "Switch between FullScreen and Normal",
  93.                 WS_OVERLAPPEDWINDOW or DS_CENTER )
  94.    DefPushButton( "&Test", ID_TestBtn, 10, 20, 40, 20 )
  95.  
  96.    hDlg = CreateModelessDialog( null, @DialogProc, 0 )
  97.  
  98.    while GetMessage( @wMsg, null, 0, 0 ) != 0
  99.      if IsDialogMessage( hDlg,  @wMsg ) = 0 then
  100.        TranslateMessage( @wMsg )
  101.        DispatchMessage( @wMsg )
  102.      end if
  103.    wend
  104.  
  105. end sub
  106.  
  107. WinMain()
  108.  

Arnold

  • Hero Member
  • *****
  • Posts: 772
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #2 on: February 07, 2019, 12:51:05 AM »
Hi Charles,

while working through the demos of \examples\basics, I realized with horror that I asked many questions that were actually already answered in the examples. But your answers also helped me to better understand the code in other programming languages.

I noticed that in SizeofSpanof.o2bas the statement: dim s as asciiz*256 will not work any more. Is sizing for this case deprecated? I found two alternatives, are there still more?

Roland

Code: OxygenBasic
  1.  
  2. 'dim s as asciiz*256    'ERROR: *sizing not supported here
  3.  
  4. 'dim s as asciiz*        'will crash without message
  5. 'dim s as asciiz[256]    'will crash without message
  6.  
  7. 'dim s[256] as asciiz     'ok
  8. asciiz s[256]             'ok
  9.  
  10. print sizeof s
  11. print spanof s
  12. print countof s
  13. print bytesof s
  14. print "len of s = " len(s)
  15.  
  16. s="hello"
  17. print s
  18. print "len of s =" len(s)
  19.  
  20. dim st as asciiz*
  21. st="hello"
  22. print st
  23. print "len of st =" len(st)
  24.  

Arnold

  • Hero Member
  • *****
  • Posts: 772
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #3 on: March 01, 2019, 03:01:55 AM »
Hi Charles,

I noticed that in projectsB/Iup four apps do not work as expected:

jfdemo1H.o2bas needs a modification in line 25:
sub AddChild(sys parent, child)
otherwise the form will not be shown
(in jfdemo1.o2bas both versions of AddChild do work)

tabs.o2bas, line 17 must be deleted or commented out:
'typedef sys Ihandle
otherwise  the example6 will not create a new tab

zbox.o2bas, line 12 must be deleted or commented out:
'typedef sys Ihandle
otherwise changing the Layout will not work.

in gldemo3.o2bas line 111 should be modified too:
sub AddChild(sys parent, child)

In the other Iup examples, I found no problems.

Roland




John

  • Hero Member
  • *****
  • Posts: 3551
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #4 on: March 01, 2019, 09:41:06 PM »
Thanks Roland for being the guiding angel for the O2 IUP effort.