Is there a way to make a button float on top of listview Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Is there a way to make a button float on top of listview

04 Aug 2021, 23:03

It doesn't have to stay there but at least when item in the list view is clicked on the button shows up, i tried but did not have any success. My real use is to do this with a picture control but for this demo its easier for me to share it with a button control.

Code: Select all

#NoEnv
#SingleInstance Force
SetWorkingDir %A_ScriptDir%

Gui Add, ListView, x53 y47 w356 h150 AltSubmit glv vlv, ListView
Gui Add, Button, x233 y112 w80 h23 vbt, &OK

Gui Show, w481 h266, Window
loop, 20
	lv_add("",a_index)
Return

lv:
guicontrol, show, bt
return

GuiEscape:
GuiClose:
    ExitApp
edit another attempt, button is created again and again but cannot be clicked

Code: Select all

#NoEnv
#SingleInstance Force
SetWorkingDir %A_ScriptDir%

Gui Add, ListView, x53 y47 w356 h150 AltSubmit glv vlv, ListView

Gui Show, w481 h266, Window
loop, 20
	lv_add("",a_index)
Return

lv:
Gui Add, Button, x233 y112 w80 h23 gbt, &OK
winset, redraw
;guicontrol, show, bt
return

bt:
MsgBox, OK
return

GuiEscape:
GuiClose:
    ExitApp
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: Is there a way to make a button float on top of listview

04 Aug 2021, 23:26

mikeyww wrote:
04 Aug 2021, 23:15

Code: Select all

GuiControl, MoveDraw, &OK
this is the updated test, is this correct? the button is not clickable still thanks

Code: Select all

#NoEnv
#SingleInstance Force
SetWorkingDir %A_ScriptDir%

Gui Add, ListView, x53 y47 w356 h150 AltSubmit glv vlv, ListView

Gui Show, w481 h266, Window
loop, 20
	lv_add("",a_index)
Return

lv:
Gui Add, Button, x233 y112 w80 h23 gbt, &OK
winset, redraw
GuiControl, MoveDraw, &OK
return

bt:
MsgBox, OK
return

GuiEscape:
GuiClose:
    ExitApp
User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Is there a way to make a button float on top of listview

05 Aug 2021, 06:34

I tried a few variations of GuiControl & WinSet. I was able to get the button to work, but selecting rows in the ListView still obscured the button. Sorry I did not find a solution to that issue. Others here may know.
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: Is there a way to make a button float on top of listview

05 Aug 2021, 07:53

mikeyww wrote:
05 Aug 2021, 06:34
I tried a few variations of GuiControl & WinSet. I was able to get the button to work, but selecting rows in the ListView still obscured the button. Sorry I did not find a solution to that issue. Others here may know.
thanks, my last resort is creating a second gui with just the control (ill use -caption etc)
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Is there a way to make a button float on top of listview  Topic is solved

05 Aug 2021, 17:00

Is this what you are looking for?

You can set it up to hide and show if you want that added in.

Code: Select all

#NoEnv
#SingleInstance Force
SetWorkingDir %A_ScriptDir%

Gui Add, Button, x233 y112 w80 h23 gbt, &OK  ;This goes before the LV

Gui Add, ListView, x53 y47 w356 h150 +0x4000000 vlv, ListView   ;+0x4000000:  Clips child windows relative to each other
																; that is, when a particular child window receives a WM_PAINT message, 
																; the WS_CLIPSIBLINGS style clips all other overlapping child windows out
																; of the region of the child window to be updated.

Gui Show, w481 h266, Window

loop, 20
	lv_add("",a_index)

return

bt:
	MsgBox, OK
	return

GuiEscape:
GuiClose:
    ExitApp
HTH
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: Is there a way to make a button float on top of listview

05 Aug 2021, 17:15

Hellbent wrote:
05 Aug 2021, 17:00
Is this what you are looking for?

You can set it up to hide and show if you want that added in.

Code: Select all

#NoEnv
#SingleInstance Force
SetWorkingDir %A_ScriptDir%

Gui Add, Button, x233 y112 w80 h23 gbt, &OK  ;This goes before the LV

Gui Add, ListView, x53 y47 w356 h150 +0x4000000 vlv, ListView   ;+0x4000000:  Clips child windows relative to each other
																; that is, when a particular child window receives a WM_PAINT message, 
																; the WS_CLIPSIBLINGS style clips all other overlapping child windows out
																; of the region of the child window to be updated.

Gui Show, w481 h266, Window

loop, 20
	lv_add("",a_index)

return

bt:
	MsgBox, OK
	return

GuiEscape:
GuiClose:
    ExitApp
HTH
works amazingly great, so happy that I won't have to use a second gui! thank you

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee and 145 guests