Author Topic: callbacks + buttons?  (Read 4415 times)

0 Members and 1 Guest are viewing this topic.

Frankolinox

  • Guest
callbacks + buttons?
« on: June 21, 2012, 08:03:32 AM »
hi charles, where I can find examples about a) "buttons" and b) "callbacks" (for example: %WM_TIMER, %WM_INITDIALOG, %WM_PAINT) in example folders? best regards, frank

Charles Pegge

  • Guest
Re: callbacks + buttons?
« Reply #1 on: June 21, 2012, 01:12:31 PM »
Hi Frank,

Standard Windows stuff, I have not really covered so I am working on further examples.

If you are interested in making your own controls from graphics then I recommend projects/CustControls/. It uses a version of Peter's Windows API. It is much more fun than using windows buttons.

Callbacks in Oxygen are really easy. You simply add the word callback to the function prototype, and the address of the function is the name preceded by & or @. For example @WndProc

    wc.lpfnWndProc = @WndProc

...

function WndProc ( sys hWnd, wMsg, wParam, lparam ) as sys callback



Charles
« Last Edit: June 21, 2012, 01:24:42 PM by Charles Pegge »

Frankolinox

  • Guest
Re: callbacks + buttons?
« Reply #2 on: June 22, 2012, 03:20:44 AM »
thanks charles for infos :)

here I send an working attempt for "button" handling :) I have added some function to the "minwin.inc".

Code: [Select]
 $ filename "t.exe"
  '#include "../../inc/RTL32.inc"
  '#include "../../inc/RTL64.inc"
  #include "../../inc/MinWin.inc"

  %Buttoni = 1001
  
  #lookahead ' for procedures
  s=error()
  '
  if s then
    print s
    goto endprog
  end if




  '==================
  'GLOBAL DEFINITIONS
  '==================


'  sys inst,hdc
'  sys xmax,ymax,r,idx,idy,xball,yball
'
'  r =15 : idx =5 : idy=5 : xball=200 : yball=100  



  '=========
  'MAIN CODE
  '=========
  
  dim cmdline as asciiz ptr, inst as sys
  &cmdline=GetCommandLine
  inst=GetModuleHandle 0
  '
  'WINDOWS
  '-------
  '
  WinMain inst,0,cmdline,SW_NORMAL
  
  endprog:

  'RELEASE SYSTEM RESOURCES
  '---------------------

  FreeMinWinLibraries

  '===========
  'END OF MAIN
  '===========


  '--------------------------------------------------------------------
  Function WinMain(sys inst, prevInst, asciiz*cmdline, sys show) as sys
  '====================================================================


  WndClass wc
  MSG      wm

  sys hwnd, wwd, wht, wtx, wty, tax, myButton, hFont

  wc.style = CS_HREDRAW or CS_VREDRAW
  wc.lpfnWndProc = @WndProc
  wc.cbClsExtra =0
  wc.cbWndExtra =0    
  wc.hInstance =inst
  wc.hIcon=LoadIcon 0, IDI_APPLICATION
  wc.hCursor=LoadCursor 0,IDC_ARROW
  wc.hbrBackground = GetStockObject WHITE_BRUSH
  wc.lpszMenuName =null
  wc.lpszClassName = strptr "Demo"

  RegisterClass (@wc)
 
  Wwd = 320 : Wht = 200
  Tax = GetSystemMetrics SM_CXSCREEN
  Wtx = (Tax - Wwd) /2
  Tax = GetSystemMetrics SM_CYSCREEN
  Wty = (Tax - Wht) /2
 
  hwnd = CreateWindowEx 0,wc.lpszClassName,"OXYGEN BASIC",WS_OVERLAPPEDWINDOW,Wtx,Wty,Wwd,Wht,0,0,inst,0

'---------- test zone
'      LOCAL myButton AS DWORD, hFont AS DWORD ' ok all as sys
'%WS_CHILD          = &H40000000
'%WS_VISIBLE        = &H10000000
'%BS_PUSHBUTTON      = &H00000000
'%BS_FLAT            = &H00008000
'%WM_SETFONT                  = &H0030
' I've included all in "MinWin.inc"

     myButton =  CreateWindowEx(0, _                                            
                                 "Button", _                                        
                                 "push me!", _                                      
                                 %WS_CHILD OR %WS_VISIBLE OR _                        
                                 %BS_PUSHBUTTON OR %BS_FLAT, _            
                                 22, 20, _                              
                                 80, 24, _                              
                                 hWnd, %Buttoni, _                      
                                 inst, 0)                              
    
      SendMessage myButton, WM_SETFONT, hFont, TRUE '1

'---------- test zone

ShowWindow hwnd,SW_SHOW
  UpdateWindow hwnd
  '
  sys bRet
  '
  do while bRet := GetMessage (@wm, 0, 0, 0)
    if bRet = -1 then
      'show an error message
    else
      TranslateMessage @wm
      DispatchMessage @wm
    end if
  wend

  End Function



  dim as rect crect 'for WndProc and TimerProc

  '------------------------------------------------------------------
  function WndProc ( sys hWnd, wMsg, wParam, lparam ) as sys callback
  '==================================================================

    static as sys hdc
    static as String txt
    static as PaintStruct Paintst
 
    '==========
    select wMsg
    '==========
        
      '--------------
      case WM_CREATE
      '=============

      GetClientRect  hWnd,&cRect

      '--------------  
      case WM_DESTROY
      '===============
          
      PostQuitMessage 0
        
      '------------
      case WM_PAINT
      '============


      'TEXT
      'http://msdn.microsoft.com/en-us/library/dd144821(v=VS.85).aspx

      'DRAWING AND PAINTING
      'http://msdn.microsoft.com/en-us/library/dd162760(v=VS.85).aspx

      GetClientRect  hWnd,&cRect
      hDC=BeginPaint hWnd,&Paintst
      'style
      '0x20 DT_SINGLELINE
      '0x04 DT_VCENTER
      '0x01 DT_CENTER
      '0x25

       SetBkColor   hdc,yellow
       SetTextColor hdc,red
       DrawText hDC,"Hello World!",-1,&cRect,0x25
       EndPaint hWnd,&Paintst
        
      '--------------  
      case WM_KEYDOWN
      '==============

      '============            
      Select wParam
      '============

Case 27 : SendMessage hwnd, WM_CLOSE, 0, 0      'ESCAPE

      End Select
      

      '--------        
      case else
      '========
          
        function=DefWindowProc hWnd,wMsg,wParam,lParam
        
    end select

  end function ' WndProc

 

I have token hellowin example from gui folder. best regards, frank

Frankolinox

  • Guest
Re: callbacks + buttons?
« Reply #3 on: June 22, 2012, 04:18:44 AM »
and here's the callback for the button with simple message box :)

that was easy...

Code: [Select]
 $ filename "t.exe"
  '#include "../../inc/RTL32.inc"
  '#include "../../inc/RTL64.inc"
  #include "../../inc/MinWin.inc"

  %Buttoni = 1001
  
  #lookahead ' for procedures
  s=error()
  '
  if s then
    print s
    goto endprog
  end if




  '==================
  'GLOBAL DEFINITIONS
  '==================


'  sys inst,hdc
'  sys xmax,ymax,r,idx,idy,xball,yball
'
'  r =15 : idx =5 : idy=5 : xball=200 : yball=100  



  '=========
  'MAIN CODE
  '=========
  
  dim cmdline as asciiz ptr, inst as sys
  &cmdline=GetCommandLine
  inst=GetModuleHandle 0
  '
  'WINDOWS
  '-------
  '
  WinMain inst,0,cmdline,SW_NORMAL
  
  endprog:

  'RELEASE SYSTEM RESOURCES
  '---------------------

  FreeMinWinLibraries

  '===========
  'END OF MAIN
  '===========


  '--------------------------------------------------------------------
  Function WinMain(sys inst, prevInst, asciiz*cmdline, sys show) as sys
  '====================================================================


  WndClass wc
  MSG      wm

  sys hwnd, wwd, wht, wtx, wty, tax, myButton, hFont

  wc.style = CS_HREDRAW or CS_VREDRAW
  wc.lpfnWndProc = @WndProc
  wc.cbClsExtra =0
  wc.cbWndExtra =0    
  wc.hInstance =inst
  wc.hIcon=LoadIcon 0, IDI_APPLICATION
  wc.hCursor=LoadCursor 0,IDC_ARROW
  wc.hbrBackground = GetStockObject WHITE_BRUSH
  wc.lpszMenuName =null
  wc.lpszClassName = strptr "Demo"

  RegisterClass (@wc)
 
  Wwd = 320 : Wht = 200
  Tax = GetSystemMetrics SM_CXSCREEN
  Wtx = (Tax - Wwd) /2
  Tax = GetSystemMetrics SM_CYSCREEN
  Wty = (Tax - Wht) /2
 
  hwnd = CreateWindowEx 0,wc.lpszClassName,"OXYGEN BASIC",WS_OVERLAPPEDWINDOW,Wtx,Wty,Wwd,Wht,0,0,inst,0

     myButton =  CreateWindowEx(0, _                                            
                                 "Button", _                                        
                                 "push me!", _                                      
                                 %WS_CHILD OR %WS_VISIBLE OR _                        
                                 %BS_PUSHBUTTON OR %BS_FLAT, _            
                                 22, 20, _                              
                                 80, 24, _                              
                                 hWnd, %Buttoni, _                      
                                 inst, 0)                              
    
      SendMessage myButton, WM_SETFONT, hFont, TRUE '1

ShowWindow hwnd,SW_SHOW
  UpdateWindow hwnd
  '
  sys bRet
  '
  do while bRet := GetMessage (@wm, 0, 0, 0)
    if bRet = -1 then
      'show an error message
    else
      TranslateMessage @wm
      DispatchMessage @wm
    end if
  wend

  End Function



  dim as rect crect 'for WndProc and TimerProc

  '------------------------------------------------------------------
  function WndProc ( sys hWnd, wMsg, wParam, lparam ) as sys callback
  '==================================================================

    static as sys hdc
    static as String txt
    static as PaintStruct Paintst
 
    '==========
    select wMsg
    '==========

    CASE WM_COMMAND
      IF wparam = %Buttoni THEN
          print "hello my oxygen button!"
      END IF
      
      '--------------
      case WM_CREATE
      '=============

      GetClientRect  hWnd,&cRect

      '--------------  
      case WM_DESTROY
      '===============
          
      PostQuitMessage 0
        
      '------------
      case WM_PAINT
      '============


      'TEXT
      'http://msdn.microsoft.com/en-us/library/dd144821(v=VS.85).aspx

      'DRAWING AND PAINTING
      'http://msdn.microsoft.com/en-us/library/dd162760(v=VS.85).aspx

      GetClientRect  hWnd,&cRect
      hDC=BeginPaint hWnd,&Paintst
      'style
      '0x20 DT_SINGLELINE
      '0x04 DT_VCENTER
      '0x01 DT_CENTER
      '0x25

       SetBkColor   hdc,yellow
       SetTextColor hdc,red
       DrawText hDC,"Hello World!",-1,&cRect,0x25
       EndPaint hWnd,&Paintst
        
      '--------------  
      case WM_KEYDOWN
      '==============

      '============            
      Select wParam
      '============

Case 27 : SendMessage hwnd, WM_CLOSE, 0, 0      'ESCAPE

      End Select
      

      '--------        
      case else
      '========
          
        function=DefWindowProc hWnd,wMsg,wParam,lParam
        
    end select

  end function ' WndProc

 

you'll find all in zip folder too.

best regards, frank

Frankolinox

  • Guest
Re:gui elements are welcome for oxygen?
« Reply #4 on: June 25, 2012, 12:41:20 AM »
after having done (just for fun) button and callback: Is it welcome here at the board to make progresses in gui features for oxygen ? I am meaning tabs, listviews and other controls. I am asking because I don't know what's status quo of other development here and if I should make this work for you. best regards, frank

Charles Pegge

  • Guest
Re: callbacks + buttons?
« Reply #5 on: June 25, 2012, 01:34:03 AM »
Hi Frank,

Thanks for your demos.

Apart from Aurel, we have not done much work on child windows / controls, so the field is wide open.

Some simple demos on lists, combo boxs, even scroll bars would be very welcome.

Charles

Frankolinox

  • Guest
Re: callbacks + buttons?
« Reply #6 on: June 27, 2012, 12:30:11 AM »
the examples for listbox and combobox are nearly ready, but the main problem is here how to define a "class" like "listbox" or "combobox". the "button" class oxygen has already known but not "listbox" and "combobox". is that necessary to define for this own class/method structures for oxygen? where to find source or infos in "inc" files or source code in oxygen folder?

Code: [Select]
$ filename "t.exe"
  '#include "../../inc/RTL32.inc"
  '#include "../../inc/RTL64.inc"
  #include "../../inc/MinWin.inc"

  %Buttoni = 1001
  %ID_LISTBOX = 1002
  %ID_Combobox = 1003
  
  #lookahead ' for procedures
  s=error()
  '
  if s then
    print s
    goto endprog
  end if




  '==================
  'GLOBAL DEFINITIONS
  '==================


'  sys inst,hdc
'  sys xmax,ymax,r,idx,idy,xball,yball
'
'  r =15 : idx =5 : idy=5 : xball=200 : yball=100  



  '=========
  'MAIN CODE
  '=========
  
  dim cmdline as asciiz ptr, inst as sys
  &cmdline=GetCommandLine
  inst=GetModuleHandle 0
  '
  'WINDOWS
  '-------
  '
  WinMain inst,0,cmdline,SW_NORMAL
  
  endprog:

  'RELEASE SYSTEM RESOURCES
  '---------------------

  FreeMinWinLibraries

  '===========
  'END OF MAIN
  '===========


  '--------------------------------------------------------------------
  Function WinMain(sys inst, prevInst, asciiz*cmdline, sys show) as sys
  '====================================================================


  WndClass wc
  MSG      wm

  sys hwnd, wwd, wht, wtx, wty, tax, myButton, hList, hCombo, hFont
  string szItem
  
  wc.style = CS_HREDRAW or CS_VREDRAW
  wc.lpfnWndProc = @WndProc
  wc.cbClsExtra =0
  wc.cbWndExtra =0    
  wc.hInstance =inst
  wc.hIcon=LoadIcon 0, IDI_APPLICATION
  wc.hCursor=LoadCursor 0,IDC_ARROW
  wc.hbrBackground = GetStockObject WHITE_BRUSH
  wc.lpszMenuName =null
  wc.lpszClassName = strptr "Demo"

  RegisterClass (@wc)
 
  Wwd = 320 : Wht = 200
  Tax = GetSystemMetrics SM_CXSCREEN
  Wtx = (Tax - Wwd) /2
  Tax = GetSystemMetrics SM_CYSCREEN
  Wty = (Tax - Wht) /2
 
  hwnd = CreateWindowEx 0,wc.lpszClassName,"OXYGEN BASIC",WS_OVERLAPPEDWINDOW,Wtx,Wty,Wwd,Wht,0,0,inst,0

     hList =  CreateWindowEx(0, _                                            
                                 "Listbox", _                                        
                                 "", _                                      
                                 %WS_CHILD OR %WS_VISIBLE OR _                        
                                 %BS_PUSHBUTTON OR %BS_FLAT, _            
                                 22, 20, _                              
                                 80, 24, _                              
                                 hWnd, %Listbox, _                      
                                 inst, 0)                              
    
      SendMessage hList, WM_SETFONT, hFont, TRUE '1

         SendMessage hList, %WM_SETREDRAW, %FALSE, 0
         szItem = "Hawkey 6"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem        
         szItem = "Ironman 5"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem
         szItem = "Black Widow 4"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem
         szItem = "Captain America 3"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem
         szItem = "Thor 2"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem
         szItem = "Spiderman 1"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem
         szItem = "Hulk 0"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem
         ' Turn on repainting
         SendMessage hList, %WM_SETREDRAW, %TRUE, 0
         InvalidateRect hList, 0, %TRUE
         UpdateWindow hList

ShowWindow hwnd,SW_SHOW
  UpdateWindow hwnd
  '
  sys bRet
  '
  do while bRet := GetMessage (@wm, 0, 0, 0)
    if bRet = -1 then
      'show an error message
    else
      TranslateMessage @wm
      DispatchMessage @wm
    end if
  wend

  End Function



  dim as rect crect 'for WndProc and TimerProc

  '------------------------------------------------------------------
  function WndProc ( sys hWnd, wMsg, wParam, lparam ) as sys callback
  '==================================================================

    static as sys hdc
    static as String txt
    static as PaintStruct Paintst
 
    '==========
    select wMsg
    '==========

    CASE WM_COMMAND
      IF wparam = %Buttoni THEN
          print "hello my oxygen button!"
      END IF
      
      '--------------
      case WM_CREATE
      '=============

      GetClientRect  hWnd,&cRect

      '--------------  
      case WM_DESTROY
      '===============
          
      PostQuitMessage 0
        
      '------------
      case WM_PAINT
      '============


      'TEXT
      'http://msdn.microsoft.com/en-us/library/dd144821(v=VS.85).aspx

      'DRAWING AND PAINTING
      'http://msdn.microsoft.com/en-us/library/dd162760(v=VS.85).aspx

      GetClientRect  hWnd,&cRect
      hDC=BeginPaint hWnd,&Paintst
      'style
      '0x20 DT_SINGLELINE
      '0x04 DT_VCENTER
      '0x01 DT_CENTER
      '0x25

       SetBkColor   hdc,yellow
       SetTextColor hdc,red
       DrawText hDC,"Hello World!",-1,&cRect,0x25
       EndPaint hWnd,&Paintst
        
      '--------------  
      case WM_KEYDOWN
      '==============

      '============            
      Select wParam
      '============

Case 27 : SendMessage hwnd, WM_CLOSE, 0, 0      'ESCAPE

      End Select
      

      '--------        
      case else
      '========
          
        function=DefWindowProc hWnd,wMsg,wParam,lParam
        
    end select

  end function ' WndProc
 
the "minwin.inc" I have changed too and added new equates. but in both example the class for "listbox" and "combobox" (createwindowex..) is still unknown ;)

best regards, frank

Charles Pegge

  • Guest
Re: callbacks + buttons?
« Reply #7 on: June 27, 2012, 02:03:52 AM »
Hi Frank,

I have added a whole bunch of equates for listboxes, comboboxes and scrollbars.

These are the Standard Chile control names listed on MSDN

 '
  '"Button"   The class for a button.
  '"ComboBox"   The class for a combo box.
  '"Edit"       The class for an edit control.
  '"ListBox"   The class for a list box.
  '"MDIClient"   The class for an MDI client window.
  '"ScrollBar"   The class for a scroll bar.
  '"Static"   The class for a static control.


New MinWin below

Aurel

  • Guest
Re: callbacks + buttons?
« Reply #8 on: June 27, 2012, 03:06:37 AM »
Currently in awinh.inc i have finished
BUTTON
EDIT
RICHEDIT
LISTBOX
CHECKBOX
RADIOBUTTON
PROGRESSBAR
TREEVIEW

still missing...
TAB
LISTVIEW
UPDOWN
CALENDAR
ANIMATE
SCROLLBAR
COMBO

But can be easy to add last 5 only much work
require TAB and LISTVIEW

Under topic WinH you can find latest awinh.inc
« Last Edit: June 27, 2012, 03:30:03 AM by Aurel »

Frankolinox

  • Guest
Re: callbacks + buttons?
« Reply #9 on: June 27, 2012, 06:21:27 AM »
here's the solution for listbox, combobox, I have forgotten to use the correct style equates for listbox and combobox and used unfortunately button equates, my mistake.

"minwin.inc" I have updated too, you can find in zip folder.

Code: [Select]
 $ filename "t.exe"
  '#include "../../inc/RTL32.inc"
  '#include "../../inc/RTL64.inc"
  #include "../../inc/MinWin.inc"

  %Buttoni = 1001
  %ID_LISTBOX = 1002
  %ID_Combobox = 1003
  
  #lookahead ' for procedures
  s=error()
  '
  if s then
    print s
    goto endprog
  end if




  '==================
  'GLOBAL DEFINITIONS
  '==================


'  sys inst,hdc
'  sys xmax,ymax,r,idx,idy,xball,yball
'
'  r =15 : idx =5 : idy=5 : xball=200 : yball=100  



  '=========
  'MAIN CODE
  '=========
  
  dim cmdline as asciiz ptr, inst as sys
  &cmdline=GetCommandLine
  inst=GetModuleHandle 0
  '
  'WINDOWS
  '-------
  '
  WinMain inst,0,cmdline,SW_NORMAL
  
  endprog:

  'RELEASE SYSTEM RESOURCES
  '---------------------

  FreeMinWinLibraries

  '===========
  'END OF MAIN
  '===========


  '--------------------------------------------------------------------
  Function WinMain(sys inst, prevInst, asciiz*cmdline, sys show) as sys
  '====================================================================


  WndClass wc
  MSG      wm

  sys hwnd, wwd, wht, wtx, wty, tax, myButton, hList, hCombo, hFont
  'string szItem
  asciiz*256 szItem
  
  wc.style = CS_HREDRAW or CS_VREDRAW
  wc.lpfnWndProc = @WndProc
  wc.cbClsExtra =0
  wc.cbWndExtra =0    
  wc.hInstance =inst
  wc.hIcon=LoadIcon 0, IDI_APPLICATION
  wc.hCursor=LoadCursor 0,IDC_ARROW
  wc.hbrBackground = GetStockObject WHITE_BRUSH
  wc.lpszMenuName =null
  wc.lpszClassName = strptr "Demo"

  RegisterClass (@wc)
 
  Wwd = 320 : Wht = 200
  Tax = GetSystemMetrics SM_CXSCREEN
  Wtx = (Tax - Wwd) /2
  Tax = GetSystemMetrics SM_CYSCREEN
  Wty = (Tax - Wht) /2
 
  hwnd = CreateWindowEx 0,wc.lpszClassName,"OXYGEN BASIC",WS_OVERLAPPEDWINDOW,Wtx,Wty,Wwd,Wht,0,0,inst,0

     hList =  CreateWindowEx(0, _                                            
                                 "Listbox", _                                        
                                 "", _                                                                        
                                 %WS_CHILD OR %WS_VISIBLE OR %WS_HSCROLL OR _  
                                 %WS_VSCROLL OR %WS_BORDER OR %LBS_SORT OR %LBS_NOTIFY OR %LBS_HASSTRINGS, _            
                                 22, 20, _                              
                                 160, 24, _                              
                                 hWnd, %ID_Listbox, _                      
                                 inst, 0)                              
    
      SendMessage hList, WM_SETFONT, hFont, TRUE '1

         szItem = "Paula 5"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem
         szItem = "Robert 4"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem
         szItem = "Jenny 3"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem
         szItem = "Laura 2"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem
         szItem = "Thomas 1"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem
         szItem = "Cesar 0"
         SendMessage hList, %LB_ADDSTRING, 0, @szItem
        
ShowWindow hwnd,SW_SHOW
  UpdateWindow hwnd
  '
  sys bRet
  '
  do while bRet := GetMessage (@wm, 0, 0, 0)
    if bRet = -1 then
      'show an error message
    else
      TranslateMessage @wm
      DispatchMessage @wm
    end if
  wend

  End Function



  dim as rect crect 'for WndProc and TimerProc

  '------------------------------------------------------------------
  function WndProc ( sys hWnd, wMsg, wParam, lparam ) as sys callback
  '==================================================================

    static as sys hdc
    static as String txt
    static as PaintStruct Paintst
 
    '==========
    select wMsg
    '==========

    CASE WM_COMMAND
      IF wparam = %Buttoni THEN
          print "hello my oxygen button!"
      END IF
      
      '--------------
      case WM_CREATE
      '=============

      GetClientRect  hWnd,&cRect

      '--------------  
      case WM_DESTROY
      '===============
          
      PostQuitMessage 0
        
      '------------
      case WM_PAINT
      '============


      'TEXT
      'http://msdn.microsoft.com/en-us/library/dd144821(v=VS.85).aspx

      'DRAWING AND PAINTING
      'http://msdn.microsoft.com/en-us/library/dd162760(v=VS.85).aspx

      GetClientRect  hWnd,&cRect
      hDC=BeginPaint hWnd,&Paintst
      'style
      '0x20 DT_SINGLELINE
      '0x04 DT_VCENTER
      '0x01 DT_CENTER
      '0x25

       SetBkColor   hdc,yellow
       SetTextColor hdc,red
       DrawText hDC,"Hello World!",-1,&cRect,0x25
       EndPaint hWnd,&Paintst
        
      '--------------  
      case WM_KEYDOWN
      '==============

      '============            
      Select wParam
      '============

Case 27 : SendMessage hwnd, WM_CLOSE, 0, 0      'ESCAPE

      End Select
      

      '--------        
      case else
      '========
          
        function=DefWindowProc hWnd,wMsg,wParam,lParam
        
    end select

  end function ' WndProc

2) how I can convert "Ubound" / "Lbound" command to oxygen? I need it for scroll window example. scroll bar I will check for next time too.

best regards, frank

 

Charles Pegge

  • Guest
Re: callbacks + buttons?
« Reply #10 on: June 27, 2012, 07:16:28 AM »
Oxygen arrays are very basic and there is no ubound function. I recommend using a global equate.

for instance


% UBOUNDa 100

sys aa[UBOUNDa]

for j=1 to UBOUNDa
  aa[j]=j
next


Lbound is 1 by default but many prefer to start with 0

This is set by using Indexbase

IndexBase 0


Charles