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

0 Members and 1 Guest are viewing this topic.

Arnold

  • Guest
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

  • Guest
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

  • Guest
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

  • Guest
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




JRS

  • Guest
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.

Arnold

  • Guest
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #5 on: April 12, 2019, 03:23:52 AM »
Hi Charles,

I hope you are well and you still have some time to work on the further development of OxygenBasic? Now and then I compare the behavior of the current version with version B0 of July 2018 and in this case I checked the examples of the folder WideChars.

In HelloUnicode.o2bas there is an error message in line 158 (function WndProc, missing sys hWnd). That is logical for me, O2 is a bit stricter now with type checking?

In ReadUnicode.o2bas an error is displayed in line 34 (missing right bracket). If I change to:   print "ALPHA: " wchr (0x3b1) then everything works fine.

I am a bit unsure about the behaviour of print in UnicodeConsoleIO.o2bas. Line 86:
print  "Ansi:    " name
does not work correctly any more. It should have not worked with B0 neither as there is missing a cr or printl, so I commented it out. Line 96:
SetConsoleTitleW title
does also not work, the title of the console and the print statement should display unicode. Perhaps the logic of UnicodeConsoleIO.o2bas must be revised a bit. You introduced L".." with the new version:

https://www.oxygenbasic.org/forum/index.php?topic=1775.msg19328#msg19328

Can this have some impact now with using unicode in a console window?

Roland

Charles Pegge

  • Guest
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #6 on: April 15, 2019, 07:54:50 AM »
Hi Roland,

I've been catching up on sleep, and neural regeneration :) Intensive programming takes its toll but I hope to resume my normal level of activity soon.

Thanks for reporting the wide-Char problems. I have fixed wchr(n1,n2,...), which would not work with literal numbers. I still need to look at the console.

Arnold

  • Guest
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #7 on: April 23, 2019, 01:19:10 AM »
Hi Charles,

as is, this little code will crash:

Code: [Select]
$ filename "Here.exe"
'uses rtl32
'uses rtl64

uses console

dim a$ as string

a$="abcdefg"

goto here              'here will crash?
a$ = "1234567890"       'this does not get executed

here:
a$ = right$(a$,5)

print a$

printl "Enter..."
waitkey

If I replace "here" with "there" everything will work fine. You applied here in some cases too like:
    call fwd here : .here : pop eax : sub eax,here : add eax,bssdata

but this is labelled as .here, perhaps this does conflict with here:  It is not a major problem, I only wanted to notify you about the behaviour.

Roland

Charles Pegge

  • Guest
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #8 on: April 23, 2019, 02:46:25 AM »
Hi Roland,

.here is used internally. I will change this internal label to something decorated with underscores.

Arnold

  • Guest
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #9 on: April 24, 2019, 02:50:16 AM »
Hi Charles,

this is stated in Oxygen Helpfile:

#autodim
ACTION: enable variables to be created without a Dim statement
 
USE: switch off this mode for stricter compiling!
 
EXAMPLE: #autodim off

REMARKS: this mode is normally active.
 
In older versions of Oxygenbasic #autodim was the default, since version B0 the default is: #autodim off. From my experience, I can confirm that this behaviour is much less error-prone. Could 'active' be changed to 'disabled' in the next Oxygen Helpfile? I suppose the option now is #autodim on?

Roland

Charles Pegge

  • Guest
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #10 on: April 24, 2019, 06:39:08 AM »
Thanks, Roland.

I'll update the manual:

Code: [Select]
data       "#autodim 13 44"
'action:   enable variables to be created without a Dim statement
'use:      for mall, informal programs.
'example:  #autodim on
'related: 
'group:    directives
'updated:  24/04/2019

JRS

  • Guest
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #11 on: April 24, 2019, 07:47:34 AM »
It would nice if Mr. Roca would join us again and pickup where he left off with his documention effort.


Aurel

  • Guest
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #12 on: April 24, 2019, 09:57:39 AM »
It would be BUT better not
I like very much his aproach to things but in some cases HE is not very much oriented
according to problems with his own (theo) forum our John is a master 8)
which lead us to ..he don't feel the charm of o2  :D

so ...is autodim oFF or is ON by default?
« Last Edit: April 24, 2019, 10:08:50 AM by Aurel »

JRS

  • Guest
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #13 on: April 24, 2019, 04:42:44 PM »
Aurel,

If my plate wasn't already full with the ScriptBasic project, I would find a way that I could contribute more. I do what I can to keep the project promoted and provide resources to share O2 with others.

JRS

  • Guest
Re: Testing new OxygenBasicProgress of 4th Feb 2019
« Reply #14 on: April 24, 2019, 07:48:09 PM »
Theo isn't a very good hosting provider. No https, errors on the forum and off topic posts you wonder what planet he is from.