Author Topic: Re: PowerBasic equivalents and conversions  (Read 12706 times)

0 Members and 1 Guest are viewing this topic.

Mike Lobanovsky

  • Guest
Re: Re: PowerBasic equivalents and conversions
« Reply #45 on: February 08, 2017, 12:44:08 PM »
I hope that unsigned integers being evaluated for negative values are rare!

Actually there seems to be 288 of them all in all per approx. 7,000 #defines in the WINDOWS_LEAN_AND_MEAN  and Windows Common Controls set of C headers. :)

Charles Pegge

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #46 on: February 09, 2017, 02:03:54 AM »
Hi Chris,

re: user guides

The Oxygen_help manual, which is rather skeletal, can be found in inf/, along with a few technical docs.

This is all we have for users at present.

OxygenBasic has a minimal set of core functions and macros (around 200), but with a highly flexible syntax, which has stretched considerably since its inception, including OOP and C-notation. So creating the definitive manual is going to be quite a task.

Aurel

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #47 on: February 09, 2017, 03:54:52 PM »
chris
do you mean on something like this..
it is just old chm i have found

.

chrisc

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #48 on: February 10, 2017, 10:36:58 AM »
ThanX ,  but I need more documentation on O2, are there any links on the Internet where
I can search for them ? 

Aurel

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #49 on: February 10, 2017, 11:08:41 AM »
I think not...
One of option will be go trough examples
then explain in short what is what ...
my english is not very good but i can add few more things to this help.
I know some things about o2 but i am not sure that I will explain it very good  ::)

for example :
byte c at strptr(s)

but this one is clear :

string s="Oxygen"
p = cast (string) s
p = p + " Basic"
print p ' -> 'Oxygen Basic'
In this case p becomes string pointer of s and can be used like this
« Last Edit: February 10, 2017, 02:19:40 PM by Aurel »

Arnold

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #50 on: February 10, 2017, 03:49:33 PM »
Quote
p = cast (string) s

Interesting aspect. Does PowerBasic work this way?

I searched in \inf\oxygen_help.chm for "string" and there are many topics listed which indicate what is possible. There are many demos in examples\Basics\ e.g. Cast.o2bas or Strptr.o2bas which show the use of cast. I have just finished browsing all the demos of the OxygenBasic subfolders but I did not find the combination above which I think is simply not necessary for this example. But maybe this is new territory.

Which reminds me that I am still looking forward to the standard way of a LV statusbar example.

Aurel

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #51 on: February 10, 2017, 11:46:28 PM »
Quote
I have just finished browsing all the demos of the OxygenBasic subfolders but I did not find the combination above which I think is simply not necessary for this example

Yeah casting is funny things  :)
BUT when string casting work on this way it looks like in Cast.o2bas  example it
looks that not work ?
So is this a bug or something else ?

float f= 0.56
p = cast (int) f
print p ' ->  must be 1 but o2 throw - > #qNAN ..heh well known garbage


Quote
Which reminds me that I am still looking forward to the standard way of a LV statusbar
example

Arnold ..i dont get it what you mean when you say standard way.  ???
« Last Edit: February 11, 2017, 12:35:02 AM by Aurel »

Arnold

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #52 on: February 11, 2017, 02:36:21 AM »
Hi Aurel,

what is wrong with this:

float f= 3.9
int p = f

print p   '4 which is expected

Quote
what you mean when you say standard way. 

I refer to your message

Roland
« Last Edit: February 11, 2017, 02:52:32 AM by Arnold »

Aurel

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #53 on: February 11, 2017, 02:52:43 AM »
Hi Arnold
what you present is not casting float as int then
usual internal transformation.
so ...do you try my example?
and what result you get ?

unfortunately i get this ..look in screenshot
so..something is wrong?

.

Arnold

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #54 on: February 11, 2017, 03:17:16 AM »

Aurel

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #55 on: February 11, 2017, 03:39:12 AM »
Aha ..i see
then that is ok for me ...
but good thing is that string casting work on a simple way . :)
by the way do you translate pb listview to oxygen ?

Arnold

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #56 on: February 11, 2017, 10:29:24 AM »
This is a LV Statusbar completely without any .rc file (though James will recognize his code). Attached is the source file and a 64bit executable. It works like the dll version. The style of the code is sometimes a bit alike Freebasic (I think).

Code: OxygenBasic
  1. '=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
  2. '                   This source created by dlg2src
  3. '                      Target: Oxygen Basic
  4. 'Modified a little bit
  5. '=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
  6. $ filename "LV_StatBar.exe"
  7. includepath "$/inc/"
  8. '#include "RTL32.inc"
  9. '#include "RTL64.inc"
  10. #include "MinWin.inc"
  11. ! SetRect lib "user32.dll" alias "SetRect" (lpRect as RECT, byVal X1 as long, byVal Y1 as long, byVal X2 as long, byVal Y2 as long) as long
  12. ! MulDiv lib "kernel32.dll" alias "MulDiv" (byVal nNumber as long, byVal nNumerator as long, byVal nDenominator as long) as long
  13. ! IsDialogMessage Lib "user32.dll" (sys hDlg,lpMsg) as sys    
  14. ! GetDeviceCaps lib "gdi32.dll" alias "GetDeviceCaps" (byVal hDc as sys, byVal nIndex as long) as long
  15. ! GetDlgItem lib "user32.dll" (sys hWnd, int nIDDlgItem) as sys
  16. ! CreateStatusWindow lib "comctl32" alias"CreateStatusWindowA" (LONG style, char* lpszText, sys hwndParent, UINT wID) as sys
  17.  
  18. '------------------------------------------------------------------------------
  19. % COLOR_BTNFACE 15
  20. % HWND_DESKTOP 0
  21. % SM_CYCAPTION 4
  22. % SM_CYHSCROLL 3
  23. % SM_CXVSCROLL 2
  24. % SWP_NOACTIVATE 0X10
  25. % SWP_NOMOVE 0X2
  26. % SWP_NOZORDER 0X4
  27. % WM_NCCALCSIZE 0X83
  28. % SWP_NOSIZE 0X1
  29. % LOGPIXELSY 90
  30. % LVS_SINGLESEL 4
  31. % LVS_REPORT 1
  32. % LVS_EX_CHECKBOXES 4
  33. % LVS_EX_FULLROWSELECT 0x20
  34. % LVIS_STATEIMAGEMASK 0xF000
  35. % SB_SETPARTS 0x404
  36. % SB_SETTEXT 0x401
  37. % SBS_SIZEGRIP 16
  38. % CCS_BOTTOM 3
  39. % LVCF_TEXT 4
  40. % LVIF_TEXT 1
  41. % LVM_INSERTCOLUMN 0x101B
  42. % LVM_INSERTITEM 0x1007
  43. % LVM_SETCOLUMNWIDTH 0x101E
  44. % LVM_SETBKCOLOR 0x1001
  45. % LVM_SETITEM 0x1006
  46. % LVM_SETEXTENDEDLISTVIEWSTYLE 0x1036
  47. % LVM_GETITEMSTATE 0x102C
  48. % LVN_ITEMCHANGED  -101
  49. % NM_CLICK -2
  50. % IMAGE_ICON 1
  51. % LR_LOADFROMFILE 16
  52. % ICON_SMALL 0
  53. % ICON_BIG 1
  54. % WM_SETICON 0x80
  55.  
  56.  
  57. 'structures
  58. 'commctrl.h
  59. type LVCOLUMN
  60.   uint  mask
  61.   int   fmt
  62.   int   cx
  63.   char* pszText
  64.   int   cchTextMax
  65.   int   iSubItem
  66.   int   iImage
  67.   int   iOrder
  68.   int   cxMin
  69.   int   cxDefault
  70.   int   cxIdeal
  71. end type
  72. typedef LVCOLUMN LV_COLUMN
  73.  
  74. type LVITEM
  75.   uint   mask
  76.   int    iItem
  77.   int    iSubItem
  78.   uint   state
  79.   uint   stateMask
  80.   char*  pszText
  81.   int    cchTextMax
  82.   int    iImage       // index of the list view item's icon
  83.  sys    lParam       // 32-bit value to associate with item
  84.   int    iIndent
  85.   int    iGroupId
  86.   uint   cColumns
  87.   UINT   *puColumns
  88.   int    *piColFmt
  89.   int    iGroup
  90. end type
  91. typedef LVITEM LV_ITEM
  92.  
  93. type NMLISTVIEW
  94.   NMHDR hdr
  95.   int   iItem
  96.   int   iSubItem
  97.   uint  uNewState
  98.   uint  uOldState
  99.   uint  uChanged
  100.   POINT ptAction
  101.   sys   lParam
  102. end type
  103. typedef NMLISTVIEW NM_LISTVIEW
  104.  
  105.  
  106. macro ListView_InsertColumn(hwnd,iCol,pcol) (SendMessage(hwnd, LVM_INSERTCOLUMN, iCol, pcol))
  107. macro ListView_InsertItem(hwnd,pitem) (SendMessage(hwnd, LVM_INSERTITEM,0, pitem))
  108. macro ListView_SetColumnWidth(hwnd,iCol,cx) (SendMessage(hwnd, LVM_SETCOLUMNWIDTH, iCol, cx))
  109. macro ListView_SetItem(hwnd,pitem) (SendMessage(hwnd, LVM_SETITEM,0, pitem))
  110. macro ListView_GetCheckState(hwnd,i) ((SendMessage(hwnd, LVM_GETITEMSTATE, i, LVIS_STATEIMAGEMASK))>>12)-1
  111.  
  112. '------------------------------------------------------------------------------
  113. Declare Function WinMain ( Byval hInstance AS sys, _
  114.                            Byval hPrevInstance AS sys, _
  115.                            Byval szCmdLine AS ZSTRING PTR, _
  116.                            Byval nCmdShow AS LONG) AS LONG
  117. declare SUB UpdateStatusBar(sys hWnd)
  118. declare sub DispListView(BYVAL hListview AS DWORD,  BYVAL lColCnt AS LONG, BYVAL lRowCnt AS LONG) AS LONG                          
  119.  
  120. '==============================================================================
  121.    Dim cmdline As asciiz ptr, inst as sys
  122.     &cmdline=GetCommandLine
  123.     inst=GetModuleHandle 0
  124.     WinMain(inst, NULL, cmdline, SW_NORMAL)
  125.     END
  126. '==============================================================================
  127.  
  128. % ICC_LISTVIEW_CLASSES    &h1
  129. % ICC_TREEVIEW_CLASSES    &h2
  130. % ICC_BAR_CLASSES         &h4
  131. % ICC_TAB_CLASSES         &h8
  132. % ICC_UPDOWN_CLASS        &h10
  133. % ICC_PROGRESS_CLASS      &h20
  134. % ICC_HOTKEY_CLASS        &h40
  135. % ICC_ANIMATE_CLASS       &h80
  136. % ICC_WIN95_CLASSES       &hff
  137. % ICC_DATE_CLASSES        &h100
  138. % ICC_USEREX_CLASSES      &h200
  139. % ICC_COOL_CLASSES        &h400
  140. % ICC_INTERNET_CLASSES    &h800
  141. % ICC_PAGESCROLLER_CLASS  &h1000
  142. % ICC_NATIVEFNTCTL_CLASS  &h2000
  143. % ICC_STANDARD_CLASSES    &h4000
  144. % ICC_LINK_CLASS          &h8000
  145. '==============================================================================
  146. Function O2CreateFont(szFaceName As Zstring,Byval lPointSize As long) As sys
  147.     Dim tlf As LOGFONT
  148.     Dim hdc As sys
  149.     Dim nNum As long
  150.     hdc = GetDc(%HWND_DESKTOP)
  151.     nNum = GetDeviceCaps(hdc, %LOGPIXELSY)
  152.     tlf.lfHeight         = -MulDiv(lPointSize,nNum , 72)
  153.     tlf.lfWidth          =  0
  154.     tlf.lfEscapement     =  0
  155.     tlf.lfOrientation    =  0
  156.     tlf.lfWeight         =  0
  157.     tlf.lfItalic         =  0
  158.     tlf.lfUnderline      =  0
  159.     tlf.lfStrikeOut      =  0
  160.     tlf.lfCharSet        =  %ANSI_CHARSET
  161.     tlf.lfOutPrecision   =  %OUT_TT_PRECIS
  162.     tlf.lfClipPrecision  =  %CLIP_DEFAULT_PRECIS
  163.     tlf.lfQuality        =  %DEFAULT_QUALITY
  164.     tlf.lfPitchAndFamily =  %FF_DONTCARE
  165.     tlf.lfFaceName       =  szFaceName
  166.     ReleaseDC(%HWND_DESKTOP, hdc)
  167. Function = CreateFontIndirect(@tlf)
  168. End Function
  169. '==============================================================================
  170. Sub O2Center(sys hwnd)
  171.     Dim As RECT WndRect
  172.     Dim As sys x,y
  173.     GetWindowRect(hwnd,&WndRect)
  174.     x = (GETSYSTEMMETRICS(%SM_CXSCREEN) - (WndRect.Right-WndRect.Left))/2
  175.     y = (GETSYSTEMMETRICS(%SM_CYSCREEN) - (WndRect.Bottom-WndRect.Top+GETSYSTEMMETRICS(%SM_CYCAPTION)))/2
  176.     SetWindowPos (hWnd, NULL, x, y, 0, 0, SWP_NOSIZE OR SWP_NOZORDER)
  177. End Sub
  178. '==============================================================================
  179. Sub O2SetWindowClientSize(sys hwnd,W,H)
  180.     Dim As RECT rc,rcTemp
  181.     Dim As sys hMenu,swStyle,exStyle
  182.     SetRect(rc,0,0,W,H)
  183.     hMenu = GetMenu(hwnd)
  184.     dwStyle = GetWindowLong(hwnd,%GWL_STYLE)
  185.     AdjustWindowRectEx(rc, dwStyle, hMenu<>NULL , GetWindowLong(hwnd, GWL_EXSTYLE))
  186.     If hMenu <> NULL Then
  187.         @rcTemp = @rc
  188.         rcTemp.Bottom = &H7FFF
  189.         SendMessage(hwnd, WM_NCCALCSIZE, 0,  &rcTemp)
  190.         rc.Bottom = rc.Bottom + rcTemp.Top
  191.     End If
  192.     If (dwStyle AND WS_HSCROLL) = WS_HSCROLL Then
  193.         rc.Bottom = rc.Bottom + GetSystemMetrics(SM_CYHSCROLL)
  194.     End If
  195.     If (dwStyle AND WS_VSCROLL) = WS_VSCROLL Then
  196.         rc.Right = rc.Right + GetSystemMetrics(SM_CXVSCROLL)
  197.     End If
  198.     sys cx,cy
  199.     cx = rc.Right - rc.Left
  200.     cy = rc.Bottom - rc.Top
  201.     SetWindowPos(hwnd, NULL, 0, 0, cx, cy, SWP_NOZORDER OR SWP_NOMOVE OR SWP_NOACTIVATE)
  202. End Sub
  203. '==============================================================================
  204. % IDD_Main 1000
  205. % IDC_Statusbar 1060
  206. % IDC_ListView 1001
  207.  
  208. int CurrentRow, CurrentCol
  209. sys hStatus
  210.  
  211. '==============================================================================
  212. Function WinMain(Byval hInstance as sys, _
  213.                  Byval hPrevInstance As sys, _
  214.                  Byval szCmdLine As ZSTRING PTR, _
  215.                  Byval nCmdShow As LONG ) As sys
  216.     Dim wMsg As MSG
  217.     Dim wcls As WNDCLASS
  218.     Dim As sys hWin,hCtl,hFont
  219.  
  220.     With wcls
  221.        .style         = CS_HREDRAW OR CS_VREDRAW
  222.        .lpfnWndProc   = @WndProc
  223.        .cbClsExtra    = 0
  224.        .cbWndExtra    = 0
  225.        .hInstance     = hInstance
  226.        .hbrBackground = COLOR_BTNFACE+1
  227.        .hIcon         = LoadIcon(0, IDI_APPLICATION)
  228.        .hCursor       = LoadCursor( NULL, IDC_ARROW )
  229.        .lpszMenuName  = NULL
  230.        .lpszClassName = strptr"O2SdkWindow"
  231.     End With
  232.     If RegisterClass (@wcls) = FALSE Then
  233.         MessageBox( NULL, "Failed to register wcls", "Error", MB_ICONERROR )
  234.          Exit Function
  235.     End If
  236.     Dim As INITCOMMONCONTROLSEXt icc
  237.     icc.dwSize = SIZEOF(icc)
  238.     icc.dwICC = ICC_NATIVEFNTCTL_CLASS OR ICC_COOL_CLASSES OR ICC_BAR_CLASSES OR  _
  239.                 ICC_TAB_CLASSES OR ICC_USEREX_CLASSES OR ICC_WIN95_CLASSES OR  _
  240.                 ICC_STANDARD_CLASSES OR ICC_ANIMATE_CLASS OR ICC_DATE_CLASSES OR  _
  241.                 ICC_HOTKEY_CLASS OR ICC_INTERNET_CLASSES OR ICC_LISTVIEW_CLASSES OR  _
  242.                 ICC_PAGESCROLLER_CLASS OR ICC_PROGRESS_CLASS OR ICC_TREEVIEW_CLASSES OR  _
  243.                 ICC_UPDOWN_CLASS
  244.     InitCommonControlsEx(@icc)
  245.     hFont = O2CreateFont("Arial",9)
  246.  
  247.     hWin = CreateWindowEx(WS_EX_TRANSPARENT|WS_EX_TOPMOST,"O2SdkWindow","ListView - check",WS_VISIBLE|WS_CLIPCHILDREN|WS_OVERLAPPEDWINDOW,0,0,234,132,0,0,hInstance,NULL)
  248.     O2SetWindowClientSize(hWin,410,248)
  249.  
  250.     hStatus = CreateStatusWindow(WS_CHILD | WS_BORDER | WS_VISIBLE | SBS_SIZEGRIP | CCS_BOTTOM, "", hWin, IDC_Statusbar)
  251.     'Statusbar set parts
  252.    int statwidths[] = {100, -1}
  253.     SendMessage(hStatus, SB_SETPARTS, 2, &statwidths)
  254.     SendMessage(hStatus, SB_SETTEXT, 0, "Row : Col")
  255.     UpdateStatusBar(hWin)
  256.  
  257.     hListview = CreateWindowEx(WS_EX_CLIENTEDGE, "SysListView32",NULL,WS_CHILD | WS_TABSTOP | WS_VISIBLE | WS_BORDER|LVS_SINGLESEL|LVS_REPORT,5,0,389,225,hWin,%IDC_ListView,hInstance,BYVAL %NULL)
  258.     SendMessage(hListview,%WM_SETFONT,hFont,0)
  259.     'Listview setup
  260.    int lColCnt=3, lRowCnt=300
  261.     DispListView(hListview, lColCnt,lRowCnt)
  262.  
  263.     O2Center(hWin)
  264.     ShowWindow(hWin,nCmdShow)
  265.  
  266.     While(GetMessage(@wMsg,NULL,0,0) <> 0)
  267.         If IsDialogMessage (hWin,@wMsg) = 0 Then
  268.             TranslateMessage(@wMsg)
  269.             DispatchMessage(@wMsg)
  270.         End If
  271.     Wend
  272.     DeleteObject(hFont)
  273.     Function = wMsg.wParam
  274. End Function
  275. '==============================================================================
  276.  
  277. Function WndProc ( hWnd, wMsg, wParam, lparam ) as sys callback
  278.    Select Case wMsg
  279.    case WM_CREATE
  280.             hIcon = LoadImage(NULL, "ibeam blue.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE)
  281.             if hIcon then            
  282.                 SendMessage(hwnd, WM_SETICON, ICON_BIG, hIcon)            
  283.             else            
  284.                 MessageBox(hwnd, "Could not load large icon! Is it in the current working directory?", "Error", MB_OK or MB_ICONERROR)
  285.             end if
  286.  
  287.             hIconSm = LoadImage(NULL, "ibeam blue.ico", IMAGE_ICON, 16, 16, LR_LOADFROMFILE)
  288.             if hIconSm then            
  289.                 SendMessage(hwnd, WM_SETICON, ICON_SMALL, hIconSm)            
  290.             else            
  291.                 MessageBox(hwnd, "Could not load small icon! Is it in the current working directory?", "Error", MB_OK or MB_ICONERROR)
  292.             end if
  293.        
  294.    case WM_SIZE
  295.       RECT rcStatus
  296.       int iStatusHeight
  297.  
  298.       // Size Status bar and ListView
  299.       hListview = GetDlgItem(hWnd, IDC_LISTVIEW)
  300.       MoveWindow(hListview,0, 0, loword(lParam), hiword(lParam)-20, true)
  301.       hStatus = GetDlgItem(hWnd, IDC_Statusbar)
  302.       SendMessage(hStatus, WM_SIZE, 0, 0)
  303.  
  304.       GetWindowRect(hStatus, &rcStatus)
  305.       iStatusHeight = rcStatus.bottom - rcStatus.top
  306.  
  307.    case WM_NOTIFY
  308.       'address of pnmh=lParam (keeps the notification message header )
  309.      NMHDR pnmh at lParam
  310.       if pnmh.idFrom = IDC_LISTVIEW then
  311.         NM_LISTVIEW NMLV at lParam  'address
  312.  
  313.         SELECT CASE (int) NMLV.hdr.code
  314.  
  315.           CASE LVN_ITEMCHANGED
  316.               ' when a check box is checked or unchecked it displays
  317.              ' its status at the caption
  318.              hListView=GetDlgItem(hWnd, IDC_LISTVIEW)
  319.               Checked = ListView_GetCheckState(hListView, NMLV.iItem)
  320.  
  321.               IF Checked = TRUE THEN
  322.                   SendMessage(hWnd, WM_SETTEXT, 0, "Row " + STR(NMLV.iItem+1) +" Checked: " + str(Checked))
  323.               ELSE
  324.                 ' when unchecked
  325.                  SendMessage(hWnd, WM_SETTEXT, 0, "Row " + STR$(NMLV.iItem+1) +" Checked: " + STR(Checked))
  326.               END IF
  327.  
  328.           CASE NM_CLICK     ' click on a cell
  329.                 NM_LISTVIEW lPlvNm at lParam  'address
  330.                 CurrentRow = LpLvNm.iiTem + 1
  331.                  CurrentCol = LpLvNm.iSubItem + 1
  332.                  UpdateStatusBar(hWnd)
  333.  
  334.         END SELECT
  335.       end if
  336.  
  337.  
  338.    Case WM_COMMAND
  339.       Select Case LOWORD(wParam)
  340.           Case IDCANCEL
  341.              If HIWORD(wParam) = BN_CLICKED Then
  342.                SendMessage(hWnd,WM_CLOSE,0,0)
  343.              Exit Function
  344.           End If
  345.       End Select
  346.    Case WM_DESTROY
  347.       PostQuitMessage(0)
  348.       Exit Function
  349.    End Select
  350.    Function = DefWindowProc(hWnd, wMsg, wParam, lParam)
  351. End Function
  352.  
  353.  
  354. '=====================
  355. ' The status bar displaying the current position of cursor
  356. ' and help text for each column
  357. SUB UpdateStatusBar(sys hWnd)
  358.  
  359.    hStatus=GetDlgItem(hWnd, IDC_Statusbar)
  360.    SendMessage(hStatus, SB_SETTEXT, 0, "Row " & str(CurrentRow) & ":" & "Col " & str(CurrentCol))
  361.  
  362.  ' Help text for each column when a particular column is clicked
  363.   SELECT CASE CurrentCol
  364.        CASE 1
  365.             SendMessage(hStatus, SB_SETTEXT, 1, "Enter characters only")
  366.        CASE 2
  367.             SendMessage(hStatus, SB_SETTEXT, 1, "Enter numbers only")
  368.        CASE 3
  369.             SendMessage(hStatus, SB_SETTEXT, 1, "Enter Alphanumeric here")
  370.    END SELECT
  371. END SUB
  372.  
  373. '===============================
  374. ' Display and load in the data for the ListView
  375. sub DispListView(BYVAL hListview AS DWORD,  BYVAL lColCnt AS LONG, _
  376.         BYVAL lRowCnt AS LONG) AS LONG
  377.    LOCAL lCol   AS LONG
  378.    LOCAL lRow   AS LONG
  379.  
  380.    SendMessage(hListView, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_CHECKBOXES OR LVS_EX_FULLROWSELECT )
  381.  
  382.    #indexbase 0
  383.  
  384.   ' Load column headers.
  385.   LV_COLUMN lvc
  386.    lvc.mask = LVCF_TEXT
  387.  
  388.    dim as string Column$[3]
  389.  
  390.    Column$[0] = "Column 1"
  391.    Column$[1] = "Column 2"
  392.    Column$[2] = "Column 3"
  393.  
  394.    FOR i = 0 TO 2
  395.       lvc.mask = LVCF_TEXT
  396.       lvc.pszText = Column$[i]
  397.       ListView_InsertColumn(hListview, i, lvc)
  398.    NEXT
  399.  
  400.    for i=0 to 2
  401.       ListView_SetColumnWidth(hListview, i, 65)
  402.    next
  403.  
  404.  
  405. ' Load sample data.
  406. '==========================
  407.  LV_ITEM lvItem
  408. '==========================
  409.  
  410.   lvItem.mask      =  LVIF_TEXT
  411.   string text
  412.  
  413.   for r = lRowCnt to 1 step -1
  414.     text="Column 1 " & "Row " & r
  415.     lvItem.pszText   = text
  416.     lvItem.iSubItem  =  0
  417.     ListView_InsertItem(hListview, &lvItem)
  418.  
  419.     text="Column 1 " & "Row " & r
  420.     lvItem.pszText   = text
  421.     lvItem.iSubItem  =  1
  422.     ListView_SetItem(hListview, &lvItem)
  423.  
  424.     text="Column 1 " & "Row " & r
  425.     lvItem.pszText   = text
  426.     lvItem.iSubItem  =  2
  427.     ListView_SetItem(hListview, &lvItem)
  428.  
  429.   next r
  430.  
  431.   ' Auto size columns.
  432.  for i=0 to 2
  433.      ListView_SetColumnWidth(hListview, i, -2)
  434.   next
  435.  
  436. end sub
  437.  
  438.  

.

Aurel

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #57 on: February 11, 2017, 12:01:53 PM »
Ok Arnold
and fine with small changes with includes i compile this program on win32.
It seems that app work properly , just a small thing main window
flickering like hell when we move or resize but this is problem because
is not added WS_CLIPCHILDREN into window style.
By the way i have similar problem with TAB control even is this contant added ..hmmm.

.

Emil_halim

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #58 on: February 16, 2017, 06:48:32 AM »
Hi Aurel,

from where can i get your Editor please?

JRS

  • Guest
Re: PowerBasic equivalents and conversions
« Reply #59 on: February 16, 2017, 03:40:32 PM »


Believe it or not this is not Bob Zale but Dr. Konstantin Malkov.