BCX_SPLITTER function
Purpose: BCX_SPLITTER, used with BCX_SETSPLITPOS, creates a child window containing a horizontal or vertical splitter control. When BCX_SPLITTER is invoked, the global variables (case sensitive) SplitBarFG and SplitBarBG, are defined automatically. SplitBarFG defines the foreground color of the splitter bar and is initialized with a default value RGB(0,0,255). SplitBarBG defines the background color of the splitter bar and is initialized with a default value RGB(212,212,212). For an implementation example see the demo below.
Syntax: hCtl = BCX_SPLITTER(hWndParent, _ CtlID% _ [, SplitType%] _ [, BarStyle%] _ [, Xpos%] _ [, Ypos%] _ [, Width%] _ [, Height%]) Parameters:
Return Value:
|
Example:
$BCXVERSION"5.08"GUI"ColorSplitterDemo",PIXELSENUMIDC_Edit1=50IDC_Edit2 IDC_List1 IDC_Split1 IDC_Split2 IDC_Button IDC_ComboFG IDC_ComboBGENDENUMCONSTComboStyle=WS_BORDER | WS_TABSTOP |WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLISTGLOBALForm1ASHWNDGLOBALEdit1ASCONTROLGLOBALEdit2ASCONTROLGLOBALList1ASCONTROLGLOBALSplit1ASCONTROLGLOBALSplit2ASCONTROLGLOBALButtonASCONTROLGLOBALComboExFGASCONTROLGLOBALComboExBGASCONTROLSUBFORMLOAD Form1=BCX_FORM("BCX Splitter Demo",0,0,640,480)Split1=BCX_SPLITTER(Form1,IDC_Split1, HS_VERTICAL,1)List1=BCX_LISTVIEW("Listview1", Split1, IDC_List1,0,0,10,10,0,WS_EX_CLIENTEDGE)Split2=BCX_SPLITTER(Split1, IDC_Split2, HS_HORIZONTAL, TRUE)Edit1=BCX_RICHEDIT("", Split2, IDC_Edit1,0,0,10,10)Edit2=BCX_INPUT("", Split2,IDC_Edit2,0,0,200,240)Button=BCX_BUTTON("EXIT DEMO", Form1, IDC_Button,5,5)ComboExFG=BCX_CONTROL(WC_COMBOBOXEX, Form1,"", IDC_ComboFG,180,5,175,180, ComboStyle,0)ComboExBG=BCX_CONTROL(WC_COMBOBOXEX, Form1,"", IDC_ComboBG,360,5,175,180, ComboStyle,0)MakeColorCombobox(ComboExFG)MakeColorCombobox(ComboExBG)SNDMSG(ComboExFG, CB_SETCURSEL,9,0)SNDMSG(ComboExBG, CB_SETCURSEL,23,0)MODSTYLE(List1,LVS_SHOWSELALWAYS ,LVS_EDITLABELS)BCX_SETSPLITPOS(Split2,80)BCX_SETSPLITPOS(Split1,25)'-----------------------------------------------------------------' This should be called if the splitter will follow the form size'-----------------------------------------------------------------MoveWindow(Form1,0,0,640,480, TRUE)'-----------------------------------------------------' Removes CS_VREDRAW and CS_HREDRAW to reduce flicker'-----------------------------------------------------SetClassLong(Form1,GCL_STYLE,CS_OWNDC)CENTER(Form1)SHOW(Form1)LOCALlvItemASLV_ITEM lvItem.mask=LVIF_TEXT lvItem.pszText=(LPSTR)"splitter movement"ListView_InsertItem(List1,&lvItem)lvItem.pszText=(LPSTR)"traditional style"ListView_InsertItem(List1,&lvItem)lvItem.pszText=(LPSTR)"splitter uses the"ListView_InsertItem(List1,&lvItem)lvItem.pszText=(LPSTR)"This --->"ListView_InsertItem(List1,&lvItem)ListView_SetColumnWidth(List1,0,125)BCX_SET_TEXTEdit2,"The HORIZONTAL SPLITTER above uses the new splitter bar"EDITLOADFILE(Edit1,APPEXEPATH$+"ColorSplitterDemo.bas")ENDSUBBEGINEVENTSSELECTCASECBMSG'---------------------------CASEWM_COMMAND'---------------------------IFHIWORD(wParam)=CBN_SELCHANGETHENDIMRAWcursel=SNDMSG((HWND)lParam,CB_GETCURSEL,0,0)IFcursel <> CB_ERRANDcursel <32THENIFCBCTL=IDC_ComboFGTHENSplitBarFG=QBCOLOR(cursel)ELSEIFCBCTL=IDC_ComboBGTHENSplitBarBG=QBCOLOR(cursel)ENDIFSetFocus(Edit1)ENDIFENDIFIFCBCTL=IDC_ButtonTHENDestroyWindow(Form1)'---------------------------CASEWM_EXITSIZEMOVE'---------------------------REFRESH(hWnd)'---------------------------CASEWM_SIZE'---------------------------DIMRAWrcASRECTDIMSTATIC ZoomedIFwParam <> SIZE_MINIMIZEDTHENGetClientRect(hWnd,&rc)MoveWindow(Split1,0,36, rc.right-rc.left,(rc.bottom-rc.top)-36, FALSE)IFZoomedTHENREFRESH(hWnd): Zoomed=0ENDIFIFwParam=SIZE_MAXIMIZEDTHENZoomed=TRUEENDSELECTENDEVENTSSUBMakeColorCombobox(hWndASHWND)DIMRAWcbeiASCOMBOBOXEXITEMDIMRAWg_himlASHIMAGELISTDIMRAWiCntSHAREDSETpszText[]ASLPSTR" 0 Black"," 1 Blue"," 2 Green"," 3 Cyan"," 4 Red"," 5 Magenta"," 6 Brown"," 7 Light Gray"," 8 Gray"," 9 Light Blue","10 Light Green","11 Light Cyan","12 Light Red","13 Light Magenta","14 Light Yellow","15 Bright White","16 Soft Black","17 Soft Blue","18 Soft Green","19 Soft Cyan","20 Soft Red","21 Soft Magenta","22 Soft Yellow","23 Soft White","24 Soft Gray","25 Soft Light Blue","26 Soft Light Green","27 Soft Light Cyan","28 Soft Light Red","29 Soft Light Magenta","30 Soft Light Yellow","31 Soft Bright White"'"User Defined"ENDSETg_himl=ImageList_Create(24,16, ILC_COLOR24|ILC_MASK,0,33)' Assign the image list to the ComboBoxEx controlSNDMSG(hWnd,CBEM_SETIMAGELIST,0,(LPARAM)g_himl)'Initialize the COMBOBOXEXITEM struct.'Set the mask common to all items.CLEAR(cbei)cbei.mask=CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGEFORiCnt=0TO31ImageList_AddMasked(g_himl, RoundRectBmp(QBCOLOR(iCnt)),RGB(254,0,254))cbei.iItem=iCnt cbei.pszText=pszText[iCnt]cbei.iImage=iCnt cbei.iSelectedImage=iCntIFSNDMSG(hWnd,CBEM_INSERTITEM,0,&cbei)=-1THENEXITFORNEXTSNDMSG(hWnd,CB_SETCURSEL,0,0)'Set DefaultENDSUBFUNCTIONRoundRectBmp(clASCOLORREF)ASHBITMAPDIMSTATIC custbmpASHBITMAPDIMRAWoldobjASHGDIOBJDIMRAWhdcASHDCDIMAUTObiASBITMAPINFOIFcustbmpTHENDeleteObject(custbmp)bi.bmiHeader.biSize=SIZEOF(BITMAPINFOHEADER)bi.bmiHeader.biWidth=24bi.bmiHeader.biHeight=16bi.bmiHeader.biPlanes=1bi.bmiHeader.biBitCount=24bi.bmiHeader.biCompression=BI_RGB hdc=CreateCompatibleDC(NULL)custbmp=CreateDIBSection(hdc,&bi,DIB_RGB_COLORS, NULL, NULL,0)oldobj=SelectObject(hdc,custbmp)'fill with mask colorBCX_RECTANGLE(0,0,0,24,16,RGB(254,0,254), TRUE, hdc)'Draw black outline and fill with colorBCX_ROUNDRECT(0,0,2,24,14,4,2, cl, TRUE, hdc)BCX_ROUNDRECT(0,0,1,24,15,4,2,RGB(0,0,0), FALSE, hdc)SelectObject(hdc,oldobj)DeleteDC(hdc)FUNCTION=custbmpENDFUNCTION