Here you go, should be easy to play with commented lines and reproduce, -dpiscale did fix it so you were correct in your suspicion. I still can't figure out where it is happening.
Code: Select all
#Include %A_ScriptDir%\..\GridGui.ahk
global_button_width := "100"
; Capn Odin: adding -dpiscale DOES fix the issue, removing it creates the margin. Try with and without.
gui_email_view_%item_id% := new GridGUI("Title", "+dpiscale", true)
lv_list1_%item_id% := new GridGUI.ListviewControl(gui_email_view_%item_id%.hwnd, "AltSubmit", "list1")
lv_list2_%item_id% := new GridGUI.ListviewControl(gui_email_view_%item_id%.hwnd, "AltSubmit", "list2")
lv_list3_%item_id% := new GridGUI.ListviewControl(gui_email_view_%item_id%.hwnd, "AltSubmit", "list3")
text_subject_%item_id% := gui_email_view_%item_id%.Add(1, 1, "Text", , "subject", 1, , 1, false )
text_sender_%item_id% := gui_email_view_%item_id%.Add(1, 2, "Text", , "sender", 1, , 1, false )
text_sent_%item_id% := gui_email_view_%item_id%.Add(1, 3, "Text", , "sent", 1, , 1, false )
edit_msgbody_%item_id% := gui_email_view_%item_id%.Add("1-3", 4, "Edit", , "Edit1", 1, 1, 1, 1)
text_list3_%item_id% := gui_email_view_%item_id%.Add(1, 6, "Text", , "list2", 1, , 1, false)
; Capn Odin: below, using exW and fillH or not using those and leaving width out corrects the margin issue when dpiscale is active.
btn_add_2 := gui_email_view_%item_id%.Add(3, 6, "Button", {text: "Add", options: "w" global_button_width})
;btn_add_2 := gui_email_view_%item_id%.Add(3, 6, "Button", {text: "Add", exW: 1, fillW: 1})
gui_email_view_%item_id%.AddControl("1-3", 7, lv_list3_%item_id% , 1, 1, 1, 1)
text_list1_%item_id% := gui_email_view_%item_id%.Add(4, 1, "Text", , "list1", 1, , 1, false)
btn_add_1 := gui_email_view_%item_id%.Add(6, 1, "Button", {text: "Add", options: "w" global_button_width})
;btn_add_1 := gui_email_view_%item_id%.Add(6, 1, "Button", {text: "Add", exW: 1, fillW: 1})
gui_email_view_%item_id%.AddControl("4-6", "2-4", lv_list1_%item_id% , 1, 1, 1, 1)
text_list2_%item_id% := gui_email_view_%item_id%.Add(4, 6, "Text", , "list2", 1, , 1, false)
btn_add_3 := gui_email_view_%item_id%.Add(6, 6, "Button", {text: "Add", options: "w" global_button_width})
;btn_add_3 := gui_email_view_%item_id%.Add(6, 6, "Button", {text: "Add", exW: 1, fillW: 1})
gui_email_view_%item_id%.AddControl("4-6", 7, lv_list2_%item_id% , 1, 1, 1, 1)
btn_add_1.callback := Func("test_func").Bind(A_Gui, "action")
gui_email_view_%item_id%.Show("w1200 h700 xCenter yCenter")
I think I found the problem, on line 787 of Grid.ahk, inside GetNeededWidth() in the final expression of the ternary sequence, this.cPos.w uses ControlGetPos() for the .w, which returns a DPI adjusted width, which creates the margin, and I think everything else here is dealing in pre-adjusted widths. Not sure how to fix yet... but maybe using this.ctrl.initialwidth, but that screws up other controls without a width that have no fillW.... I'll keep thinking.