Home Grootte veranderen MSGBOX Kolommen & TABS DLL bestanden Printen Geluid afspelen PB en de Euro Menu's

Omhoog

Email me

Kolom uitlijnen met TABS

source as a downloadable BAS
readily compiled file

'demonstration how TABstops work in a dialog listbox
'Henk Broekhuizen, find more at http://pb.doorhet.net
'put together with the valuable help of Lance of PowerBASIC
'for others to learn, to improve and to use

$INCLUDE "win32api.inc"
GLOBAL hDlgMain AS LONG
GLOBAL Txt() AS STRING
%IDArray = 201
'=====================================================

FUNCTION PBMAIN() AS LONG
LOCAL r AS LONG
LOCAL tablist() AS LONG

DIM tablist(4) '4 tabstop to be defined
'tab stops are defined in dialog units!!!! not character porsitions!
tablist(1)=200: tablist(2)=360 : tablist(3)=280 : tablist(4)=290

DIM Txt(1:40)
'make text with three colomns, separted with CHR$(9) with variable lengths
FOR r=1 TO 40
    Txt(r)=STRING$(r,CHR$(48+r))+CHR$(9)+"list items"+STRING$(r,".")+CHR$(9)+CHR$(48+r)
NEXT
'
'the WWWWWWW will be too wide, watch the effect on screen!

'make a dialog
DIALOG NEW 0, "Dialog with TABstops",,, 400, 340,%WS_SYSMENU TO hDlgMain
    CONTROL ADD LISTBOX, hDlgMain, %IDArray, Txt(), 5, 5, 390, 290, %WS_VSCROLL OR %LBS_USETABSTOPS
    'say we will use tabstops for making colomns                                     ^^^^^^^^^^^^^^^^
    CONTROL SEND hDlgMain, %IDArray, %LB_SETTABSTOPS, 4, VARPTR(tablist(1))
    'send a message to the control defining tabstops
    '                      ^^^^^^^^^^ control ID of the array
    '  we gonna define tabstops       ^^^^^^^^^^^^^^^ (constant from WIN32API.INC)
    '  number of tabstops definitions in the array   ^^^
    '  pointer to the array with tabstops                 ^^^^^^^^^^^^^^^^^
    DIALOG SHOW MODAL hDlgMain 'no callbacks in this sample, close with the system X

'when we're finished delete the dialog
DIALOG END hDlgMain,0
END FUNCTION

Bezoek het PB forum in het Nederlands en/of teken mijn gastenboek.

Datum laatste aanpassing:
09 April 2003 23:59:20

Email mij voor reacties,
aanvullingen en correcties