I'm trying to have the tabs in a listbox change on the resize message, so for a test I whipped up a quick dialog in easyGUI and set everything to look like one of the dialogs of an app I'm working on. next I set the list boxes to resize and all is fine. I set the tab stops and things are still good, import some dummy data and the tabs are fine... BUT after the text is in the window and I resize it, the only text that moves is the selected row or the top row. If I cover the dialog then uncover it (like a minimise) then all the text moves into place so the problem I'm having is that the screen itself is not refreshing.
Is there a msg I can send to the listbox to refresh it? Thanks
Here a working piece of code, just compile and your away. Click File->ImportFile to load dummy data then rezise the window and you'll see right away what I mean.
------------------
Paul Dwyer
Network Engineer
Aussie in Tokyo
Is there a msg I can send to the listbox to refresh it? Thanks
Here a working piece of code, just compile and your away. Click File->ImportFile to load dummy data then rezise the window and you'll see right away what I mean.
Code:
#Compile Exe #Include "win32api.inc" ' ---------------------------------------------------------- %frm_Import_MnuFile = 500 ' ---------------------------------------------------------- %frm_Import_MnuImportFile = 505 %frm_Import_MnuSaveReport = 510 %frm_Import_SEPARATOR_515 = 515 %frm_Import_MnuImpClose = 520 ' ---------------------------------------------------------- %frm_Import_MnuAction = 600 ' ---------------------------------------------------------- %frm_Import_Add_List_to_Domain = 605 ' ---------------------------------------------------------- %frm_Import_MnuHelp = 700 ' ---------------------------------------------------------- %frm_Import_CSV_Format_Info = 705 %FRM_IMPORT_LST_CSV = 100 %FRM_IMPORT_LST_RESULT = 105 ' -------------------------------------------------- Declare Sub ShowDialog_frm_Import(ByVal hParent&) Declare CallBack Function frm_Import_DLGPROC ' -------------------------------------------------- ' ------------------------------------------------ Declare Sub frm_Import_MnuImportFile_Select() Declare Sub frm_Import_MnuSaveReport_Select() Declare Sub frm_Import_MnuImpClose_Select() Declare Sub frm_Import_Add_List_to_Domain_Select() Declare Sub frm_Import_CSV_Format_Info_Select() Declare CallBack Function CBF_FRM_IMPORT_LST_CSV() Declare CallBack Function CBF_FRM_IMPORT_LST_RESULT() ' (1) Put NEXT DIALOG Constant and Declare code after here : Global hfrm_Import& ' Dialog handle ' Global Handles for menus Global hfrm_Import_Menu0& Global hfrm_Import_Menu1& Global hfrm_Import_Menu2& Global hfrm_Import_Menu3& Function PbMain() As Long Call ShowDialog_frm_Import(0) End Function ' (2) Put NEXT DIALOG Globals code after here : Sub ShowDialog_frm_Import(ByVal hParent&) Local Style&, ExStyle& Local N&, CT& ' Variables used for Reading Data in Arrays for Listbox and Combobox ' hParent& = 0 if no parent Dialog Style& = %WS_CAPTION Or %WS_MINIMIZEBOX Or %WS_SYSMENU Or %DS_CENTER Or %WS_OVERLAPPEDWINDOW ExStyle& = 0 Dialog New hParent&, "Import Users from CSV File", 0, 0, 200, 144, Style&, ExStyle& To hfrm_Import& ' EZLIB_FixSize hfrm_Import&, Style&, 1 ' --------------------------- Menu New Bar To hfrm_Import_Menu0& ' --------------------------- Menu New Popup To hfrm_Import_Menu1& Menu Add Popup, hfrm_Import_Menu0& ,"&File", hfrm_Import_Menu1&, %MF_ENABLED ' - - - - - - - - - - - - - - Menu Add String, hfrm_Import_Menu1&, "&Import File", %frm_Import_MnuImportFile, %MF_ENABLED Menu Add String, hfrm_Import_Menu1&, "&Save Report", %frm_Import_MnuSaveReport, %MF_ENABLED Menu Add String, hfrm_Import_Menu1&, "-", %frm_Import_SEPARATOR_515, %MF_ENABLED Menu Add String, hfrm_Import_Menu1&, "&Close", %frm_Import_MnuImpClose, %MF_ENABLED Menu New Popup To hfrm_Import_Menu2& Menu Add Popup, hfrm_Import_Menu0& ,"&Action", hfrm_Import_Menu2&, %MF_ENABLED ' - - - - - - - - - - - - - - Menu Add String, hfrm_Import_Menu2&, "&Add List to Domain", %frm_Import_Add_List_to_Domain, %MF_ENABLED Menu New Popup To hfrm_Import_Menu3& Menu Add Popup, hfrm_Import_Menu0& ,"&Help", hfrm_Import_Menu3&, %MF_ENABLED ' - - - - - - - - - - - - - - Menu Add String, hfrm_Import_Menu3&, "CSV Format Info", %frm_Import_CSV_Format_Info, %MF_ENABLED Menu Attach hfrm_Import_Menu0&, hfrm_Import& ' Layer # 0 ' - - - - - - - - - - - - - - - - - - - - - - - - - Dim LST_CSV_List(0) As Local String ' - - - - - - - - - - - - - - - - - - - - - - - - - Control Add ListBox, hfrm_Import&, %FRM_IMPORT_LST_CSV, LST_CSV_List(), 0, 0, 200, 70, _ %WS_CHILD Or %WS_VISIBLE Or %LBS_NOTIFY Or %LBS_USETABSTOPS Or %LBS_NOINTEGRALHEIGHT Or %WS_VSCROLL Or %WS_TABSTOP, _ %WS_EX_CLIENTEDGE Call CBF_FRM_IMPORT_LST_CSV ' - - - - - - - - - - - - - - - - - - - - - - - - - Dim LST_RESULT_List(0) As Local String ' - - - - - - - - - - - - - - - - - - - - - - - - - Control Add ListBox, hfrm_Import&, %FRM_IMPORT_LST_RESULT, LST_RESULT_List(), 0, 72, 200, 72, _ %WS_CHILD Or %WS_VISIBLE Or %LBS_NOTIFY Or %LBS_USETABSTOPS Or %LBS_NOINTEGRALHEIGHT Or %WS_VSCROLL Or %WS_TABSTOP, _ %WS_EX_CLIENTEDGE Call CBF_FRM_IMPORT_LST_RESULT Dialog Show Modal hfrm_Import& , Call frm_Import_DLGPROC End Sub ' ************************************************************* ' Dialog Callback Procedure ' for Form frm_Import ' uses Global Handle - hfrm_Import& ' ************************************************************* CallBack Function frm_Import_DLGPROC Select Case CbMsg ' Common Windows Messages you may want to process ' ----------------------------------------------- Case %WM_TIMER Case %WM_HSCROLL Case %WM_VSCROLL Case %WM_SIZE Local Dialog_H As Long Local Dialog_W As Long Local Pixel_H As Word Local Pixel_W As Word Dim lstTabs(4) As Long Pixel_H = HiWrd(CbLparam) Pixel_W = LoWrd(CbLparam) Dialog Pixels hfrm_Import&, Pixel_W, Pixel_H To Units Dialog_W, Dialog_H 'MsgBox Str$(Pixel_W * 0.25) lsttabs(0) = Pixel_W * 0.10 lsttabs(1) = Pixel_W * 0.20 lsttabs(2) = Pixel_W * 0.30 lsttabs(3) = Pixel_W * 0.40 Control Send hfrm_Import&, %FRM_IMPORT_LST_CSV, %LB_SETTABSTOPS ,4, VarPtr(lsttabs(0)) Control Send hfrm_Import&, %FRM_IMPORT_LST_CSV, %WM_PAINT,0,0 Control Set Size hfrm_Import&, %FRM_IMPORT_LST_CSV, Dialog_W , Dialog_H /2 Control Set Loc hfrm_Import&, %FRM_IMPORT_LST_RESULT, 0, (Dialog_H /2) + 1 Control Set Size hfrm_Import&, %FRM_IMPORT_LST_RESULT, Dialog_W , Dialog_H /2 Case %WM_CLOSE Case %WM_DESTROY Case %WM_SYSCOMMAND 'Case %WM_PAINT ' ----------------------------------------------- 'Case %WM_CTLCOLORMSGBOX , %WM_CTLCOLORBTN, %WM_CTLCOLOREDIT,_ ' %WM_CTLCOLORSTATIC, %WM_CTLCOLORSCROLLBAR, %WM_CTLCOLORLISTBOX ' ' Control colors ' Select Case GetDlgCtrlID(CbLparam) ' Case Else ' Function=0 ' End Select 'Case %WM_NOTIFY 'If EZLIB_IsTooltip(CbLparam) Then ' Select Case EZLIB_TooltipID(CbLparam) ' Case Else ' End Select 'End If 'If EZLIB_IsTab(CbLparam) Then ' Select Case EZLIB_TabID(CbLparam) ' Case Else ' End Select ' End If Case %WM_COMMAND ' Process Messages to Controls that have no Callback Function ' and Process Messages to Menu Items Select Case CbCtl Case %frm_Import_MnuImportFile ' Popup Menu Item Selected frm_Import_MnuImportFile_Select Case %frm_Import_MnuSaveReport ' Popup Menu Item Selected frm_Import_MnuSaveReport_Select Case %frm_Import_SEPARATOR_515 ' Popup Menu Item Selected Case %frm_Import_MnuImpClose ' Popup Menu Item Selected frm_Import_MnuImpClose_Select Case %frm_Import_Add_List_to_Domain ' Popup Menu Item Selected frm_Import_Add_List_to_Domain_Select Case %frm_Import_CSV_Format_Info ' Popup Menu Item Selected frm_Import_CSV_Format_Info_Select Case Else End Select Case Else End Select End Function ' (3) Put NEXT DIALOG Creation / Dialog Procedure code after here : ' ------------------------------------------------ Sub frm_Import_MnuImportFile_Select() Dim ImportList(5) As String Dim i As Long For I = 0 To 5 ImportList(i) = "Column1" & Chr$(9) & "Column2" & Chr$(9) & "Column3" & Chr$(9) & "Column4" ListBox Add hfrm_Import&, %FRM_IMPORT_LST_CSV, ImportList(i) Next End Sub ' ------------------------------------------------ ' ------------------------------------------------ Sub frm_Import_MnuSaveReport_Select() End Sub ' ------------------------------------------------ ' ------------------------------------------------ Sub frm_Import_MnuImpClose_Select() End Sub ' ------------------------------------------------ ' ------------------------------------------------ Sub frm_Import_Add_List_to_Domain_Select() End Sub ' ------------------------------------------------ ' ------------------------------------------------ Sub frm_Import_CSV_Format_Info_Select() End Sub ' ------------------------------------------------ ' ------------------------------------------------ CallBack Function CBF_FRM_IMPORT_LST_CSV Local CVal& ' Return Current Selection in CVal& Control Send CbHndl , CbCtl, %LB_GETCURSEL, 0,0 To CVal& If CbCtlMsg=%LBN_SELCHANGE Then End If If CbCtlMsg=%LBN_DBLCLK Then End If If CbCtlMsg=%LBN_SETFOCUS Then End If If CbCtlMsg=%LBN_KILLFOCUS Then End If End Function ' ------------------------------------------------ ' ------------------------------------------------ CallBack Function CBF_FRM_IMPORT_LST_RESULT Local CVal& ' Return Current Selection in CVal& Control Send CbHndl , CbCtl, %LB_GETCURSEL, 0,0 To CVal& If CbCtlMsg=%LBN_SELCHANGE Then End If If CbCtlMsg=%LBN_DBLCLK Then End If If CbCtlMsg=%LBN_SETFOCUS Then End If If CbCtlMsg=%LBN_KILLFOCUS Then End If End Function ' ------------------------------------------------
Paul Dwyer
Network Engineer
Aussie in Tokyo
Comment