Started by philbar, May 27, 2022, 03:39:11 AM
' frmMain form code file''''''These constants are enumerated in afx/clayout.inc' AFX_ANCHOR_NONE = 0' AFX_ANCHOR_WIDTH' AFX_ANCHOR_RIGHT' AFX_ANCHOR_CENTER_HORZ' AFX_ANCHOR_HEIGHT' AFX_ANCHOR_HEIGHT_WIDTH' AFX_ANCHOR_HEIGHT_RIGHT' AFX_ANCHOR_BOTTOM' AFX_ANCHOR_BOTTOM_WIDTH' AFX_ANCHOR_BOTTOM_RIGHT' AFX_ANCHOR_CENTER_HORZ_BOTTOM' AFX_ANCHOR_CENTER_VERT' AFX_ANCHOR_CENTER_VERT_RIGHT' AFX_ANCHOR_CENTERdim shared as clayout ptr playout 'A shared pointer so it can be seen in all functionsdim shared as boolean form_ready=false 'Prevents a hard-to-debug crashFunction frmMain_Load( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT dim as long ngrip=frmmain.getnextctrlid() playout = new clayout(frmmain.hwindow) 'assigns a layout manager to this window 'This is optional. Adds the little gripper spot to the bottom right corner. frmmain.pwindow->addcontrol("SizeGrip", frmmain.hWindow, ngrip) 'Decide how each control is to be sized playout->anchorcontrol(frmmain.text1.hwindow, afx_anchor_width) playout->anchorcontrol(frmmain.text2.hwindow, afx_anchor_height_width) playout->anchorcontrol(frmmain.frame1.hwindow, afx_anchor_height_right) playout->anchorcontrol(frmmain.list1.hwindow, afx_anchor_height_right) playout->anchorcontrol(ngrip, afx_anchor_bottom_right) Function = 0End Function''''Function frmMain_Resize( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT if form_ready then 'This prevents the crash. playout->adjustcontrols 'This does the resizing end if Function = 0End Function''''Function frmMain_FormClosed( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT delete playout 'Wouldn't want a memory leak Function = 0End Function''''Function frmMain_AllEvents( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT 'This part taken from JosÃ©'s example layout manager programs. 'Who knew there was such a thing? 'I could have just put a test in the RESIZE event. if e.Message = wm_getminmaxinfo then dim ptmmi as MINMAXINFO ptr = cast(minmaxinfo ptr, e.lParam ) ptmmi->ptmintracksize.x = 300 ptmmi->ptmintracksize.y = 180 end if Function = 0 End Function''''Function frmMain_FormReady( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT 'Sometimes a Resize event happens before Form_Load is done. 'That causes a nasty crash. form_ready=true Function = 0End Function
dim shared as clayout ptr playout
ERROR 14: Expected identifier, found 'clayout'
QuoteBut when i start the form using formwindowstate.maximized then it completely messes up the controls.