delphi - How to pull a MDI child window out of the main form? -
i want create mdi application it's own task bar user can have fast access child windows he/she wants bring front. had idea user works 2 or more monitors drag on of child windows inside main form of application outside of it, monitor example.
how can done?
maybe example mdi client form code serves inspiration:
unit unit3; interface uses windows, messages, controls, forms; type tform3 = class(tform) private fsizing: boolean; procedure wmncmouseleave(var message: tmessage); message wm_ncmouseleave; procedure wmwindowposchanged(var message: twmwindowposchanged); message wm_windowposchanged; protected procedure createparams(var params: tcreateparams); override; procedure resize; override; end; implementation {$r *.dfm} { tform3 } var fdragging: boolean = false; procedure tform3.createparams(var params: tcreateparams); begin inherited createparams(params); if formstyle = fsnormal params.exstyle := params.exstyle or ws_ex_appwindow else params.exstyle := params.exstyle , not ws_ex_appwindow; end; procedure tform3.resize; begin inherited resize; fsizing := true; end; procedure tform3.wmncmouseleave(var message: tmessage); begin inherited; fdragging := false; end; procedure tform3.wmwindowposchanged(var message: twmwindowposchanged); var p: tpoint; f: tcustomform; r: trect; begin inherited; if not fdragging , not fsizing , not (fsshowing in formstate) , (windowstate = wsnormal) begin f := application.mainform; p := f.screentoclient(mouse.cursorpos); r := f.clientrect; inflaterect(r, -5, -5); if not ptinrect(r, p) , (formstyle = fsmdichild) begin fdragging := true; formstyle := fsnormal; top := top + f.top; left := left + f.left; end else if ptinrect(r, p) , (formstyle = fsnormal) begin fdragging := true; formstyle := fsmdichild; end; end; fsizing := false; end; end.
Comments
Post a Comment