Author Topic: Documentation  (Read 65772 times)

0 Members and 2 Guests are viewing this topic.

JRS

  • Guest
Re: Documentation
« Reply #105 on: October 08, 2018, 06:12:29 PM »
I was pleased to see O2 code written by José Roca. It may not be his includes but classic José none the less. (sub class example)

Code: OxygenBasic
  1. $ filename "test4.exe"
  2. uses rtl64
  3. uses MinWin
  4. uses User
  5. uses Comctl
  6. #lookahead
  7.  
  8. %GWLP_WNDPROC = -4
  9.  
  10. function WinMain() as sys
  11.  
  12.    WndClass wc
  13.    MSG      wm
  14.    sys inst = GetModuleHandle 0
  15.  
  16.    sys hwnd, wwd, wht, wtx, wty, tax
  17.  
  18.    wc.style = CS_HREDRAW or CS_VREDRAW
  19.    wc.lpfnWndProc = &WndProc
  20.    wc.cbClsExtra = 0
  21.    wc.cbWndExtra = 0    
  22.    wc.hInstance = GetModuleHandle 0
  23.    wc.hIcon=LoadIcon 0, IDI_APPLICATION
  24.    wc.hCursor=LoadCursor 0,IDC_ARROW
  25.    wc.hbrBackground = GetStockObject WHITE_BRUSH
  26.    wc.lpszMenuName =0
  27.    wc.lpszClassName =@"Demo"
  28.  
  29.    RegisterClass (&wc)
  30.  
  31.    Wwd = 320 : Wht = 200
  32.    Tax = GetSystemMetrics SM_CXSCREEN
  33.    Wtx = (Tax - Wwd) /2
  34.    Tax = GetSystemMetrics SM_CYSCREEN
  35.    Wty = (Tax - Wht) /2
  36.  
  37.    hwnd = CreateWindowEx(0,wc.lpszClassName,"OXYGEN BASIC",WS_OVERLAPPEDWINDOW,Wtx,Wty,Wwd,Wht,0,0,inst,0)
  38.  
  39.    sys hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, _
  40.                               "Edit", _
  41.                               "", _
  42.                               WS_CHILD OR WS_VISIBLE OR WS_TABSTOP, _
  43.                               20, 30, _
  44.                               250, 25, _
  45.                               hWnd, 102, _
  46.                               inst, 0)
  47.    SetWindowSubclass hEdit, &EditSubclassProc, 102, 0
  48.    SetFocus hEdit
  49.  
  50.    ShowWindow hwnd,SW_SHOW
  51.    UpdateWindow hwnd
  52.  
  53.    WHILE GetMessage(&wm, 0, 0, 0) > 0
  54.       IF IsDialogMessage(hWnd, &wm) = 0 THEN
  55.          TranslateMessage(&wm)
  56.          DispatchMessage(&wm)
  57.       END IF
  58.    WEND
  59.  
  60. End Function
  61.  
  62. function WndProc (sys hWnd, uint wMsg, sys wParam, sys lparam) as sys callback
  63. '==================================================================
  64.  
  65.     SELECT wMsg
  66.        
  67.       CASE WM_CREATE
  68.          EXIT FUNCTION
  69.  
  70.  
  71.       CASE WM_COMMAND
  72.          SELECT CASE LOWORD(wParam)
  73.             CASE IDCANCEL
  74.                ' // If the Escape key has been pressed...
  75.               IF HIWORD(wParam) = BN_CLICKED THEN
  76.                   ' // ... close the application by sending a WM_CLOSE message
  77.                  SendMessage hwnd, WM_CLOSE, 0, 0
  78.                   EXIT FUNCTION
  79.                END IF
  80.          END SELECT
  81.  
  82.       CASE WM_DESTROY
  83.          PostQuitMessage 0
  84.  
  85.     END SELECT
  86.  
  87.    function = DefWindowProc hWnd,wMsg,wParam,lParam
  88.  
  89. end function ' WndProc
  90.  
  91. FUNCTION EditSubclassProc (sys hWnd, uint wMsg, sys wParam, sys lparam, uIdSubclass, dwRefData) as sys callback
  92.  
  93.    SELECT CASE wMsg
  94.       CASE WM_DESTROY
  95.          ' // REQUIRED: Remove control subclassing
  96.         RemoveWindowSubclass hwnd, &EditSubclassProc, uIdSubclass
  97.  
  98.       CASE WM_KEYDOWN
  99.          SetWindowText GetParent(hwnd), "ASCII " & STR(wParam)
  100.  
  101.    END SELECT
  102.  
  103.    FUNCTION = DefSubclassProc(hwnd, wMsg, wParam, lParam)
  104.  
  105. END FUNCTION
  106.  
  107.  
  108. WinMain
  109.  
« Last Edit: October 08, 2018, 06:20:08 PM by John »

JRS

  • Guest
Re: Documentation
« Reply #106 on: October 13, 2018, 12:18:54 PM »
José,

What editor do you use for writing code?


José Roca

  • Guest
Re: Documentation
« Reply #107 on: October 13, 2018, 02:49:51 PM »
Oxide. Not useful for anything but to run smalls tests.

  • Guest
Re: Documentation
« Reply #108 on: October 13, 2018, 07:02:14 PM »
Maybe a free editor such Notepad++ could be used. It needs to be able to save the file in UTF-16 and UTF-8 besides ansi now that a future version of O2 will understand them.

JRS

  • Guest
Re: Documentation
« Reply #109 on: October 13, 2018, 07:18:57 PM »
I have been using UltraEdit since it first was released when it was only Ian (owner/author) and a message from god to write it.

José Roca

  • Guest
Re: Documentation
« Reply #110 on: October 13, 2018, 07:26:16 PM »
I said free. If somebody wants to use a commercial editor it is up to him.

JRS

  • Guest
Re: Documentation
« Reply #111 on: October 14, 2018, 07:15:24 AM »
Microsoft Code editor (free/open source) is great editor with tons of features and an active project. I use it occasionally on Linux.
« Last Edit: October 14, 2018, 07:25:57 AM by John »

JRS

  • Guest
Re: Documentation
« Reply #112 on: October 14, 2018, 08:10:28 AM »
I'm curious why Windows MAXINT for 64 bit has a greater range than 64 bit on Linux?


WINDOWS -  18446744073709551615
LINUX -            9223372036854775807

« Last Edit: October 14, 2018, 08:52:05 AM by John »

José Roca

  • Guest
Re: Documentation
« Reply #113 on: October 14, 2018, 10:57:45 AM »
The first one is the value of unsigned 64 bit integers and the 2nd one for signed 64 bit integers. O2 only supports natively signed 64 bit integers (quad). I don't know about Linux.

JRS

  • Guest
Re: Documentation
« Reply #114 on: October 14, 2018, 11:30:25 AM »
Thanks for the clarification!

The Windows MAXINT was from your UINT64 O2 docs which now seems wrong if O2 only supports signed quads.

Are you showing ALL types, supported by O2 or not?

« Last Edit: October 14, 2018, 02:52:32 PM by John »

  • Guest
Re: Documentation
« Reply #115 on: October 14, 2018, 04:09:37 PM »
I'm showing the Windows Data Types and the O2's typedefs that can be used to emulate them. They are not native data types implemented in the C++ compilers, but aliases. The purpose of my O2 typedefs is to allow to use C declares without having to change HWND to sys, etc.

If O2 does not support unsigned quads, then you won't have unsigned quads. You will be limited to signed quads.

It is not a full list of C++ typedefs. There are thousands of them. For example, to work with COM we will have to add

typedef wchar OLECHAR;
typedef OLECHAR *LPOLESTR;
typedef OLECHAR *LPCOLESTR;

among many others.

JRS

  • Guest
Re: Documentation
« Reply #116 on: October 14, 2018, 04:33:21 PM »
Okay, got it.

Thanks for the detailed explanation.

JRS

  • Guest
Re: Documentation
« Reply #117 on: November 03, 2018, 11:25:28 AM »
It is.now approaching a month since the docs have been touched. Is there a shelf life with your participation?

Charles Pegge

  • Guest
Re: Documentation
« Reply #118 on: November 04, 2018, 01:40:54 AM »
I think José is waiting for me to catch up :)

JRS

  • Guest
Re: Documentation
« Reply #119 on: November 04, 2018, 01:49:06 AM »
Quote
I think José is waiting for me to catch up

Maybe if you you expand on what is working with what you have upload to Github in the last couple days it might motivate José to experiment. Who knows?