Listbox in black with white letters possible? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
OCP
Posts: 98
Joined: 28 Mar 2018, 19:28

Listbox in black with white letters possible?

26 Apr 2018, 23:19

hello

i have made a gui in mostly black based on watching a CivReborn vid it has 2 listboxes that burn my eyes so i was trying to get the color to change but i cant figure it out i i am no expert in programming

could someone point me in the right direction if there is one plz or perhaps a way to have a image as a background

currently it looks like the image i included but i want it to be white on black, i know how to change the text color but not for the listbox

any pointers are appreciated thank you
Attachments
1.jpg
1.jpg (70.92 KiB) Viewed 1505 times
Last edited by OCP on 26 Jul 2018, 22:40, edited 1 time in total.
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Listbox in black with white letters possible?  Topic is solved

26 Apr 2018, 23:26

Yes it is.

Code: Select all

Gui,Color,Black, Black
Gui,Add,Listbox,cWhite
questions?

BTW that's a nice looking quick run program you have there.
OCP
Posts: 98
Joined: 28 Mar 2018, 19:28

Re: Listbox in black with white letters possible?

26 Apr 2018, 23:33

Ha the man himself :) that worked great thank you so much this thing is just awesome i changed it to open at my current mouse position and also i open it with middle mouse down mouse wheel up and down to close very nice thnx for making the video :)

ill share the result with you
Last edited by OCP on 26 Jul 2018, 22:40, edited 1 time in total.
OCP
Posts: 98
Joined: 28 Mar 2018, 19:28

Re: Listbox in black with white letters possible?

26 Apr 2018, 23:48

oh yeah the edit knob was behaving badly i removed it because the edit box did the same thing

here is the script it has no visible borders and opens with middle mouse down then mouse wheel up and close it with Down
i might have to tweak the code a bit because if i scroll up to far the gui will jump to somewhere in the screen so far its handy and something i can get used to but it could be better

Code: Select all

#SingleInstance, force
SetWorkingDir,%A_ScriptDir%

; Pages and folders
Web_list1:= "DRIVE - C"
Web_list2:= ["C:\"]
;================================================================================================================================
; Programs and scripts
Programs_list1:= "AHK - Always On Top"
Programs_list2:= ["E:\Always On Top.exe"]
return
#InstallKeybdHook


GuiClose:
     Gui,1:Destroy
     Return
	
    
Run_Web_Page:
     ;Gui,1:Destroy
	 Gui,1:Submit,NoHide
     try 
          {
              Run,% Web_list2[Web_Box]
          }
     catch
          {
               MsgBox, 262192, ,Error
          }
     return
     
     
Run_Program:
     ;Gui,1:Destroy
	 Gui,1:Submit,NoHide
     try 
          {
              Run,% Programs_list2[Programs_Box]
          }
     catch
          {
               MsgBox, 262192, ,Error
          }
     return
     
     
Unlock:
     Lock1:=!Lock1
     if(Lock1=1)
          {
               GuiControl,1:Enable,Edit_Button
               GuiControl,1:Enable,Path_Button 
          }
     if(Lock1=0)
          {
               GuiControl,1:Disable,Edit_Button
               GuiControl,1:Disable,Path_Button 
          }
          

Edit_This_Script:
     Try
          {
               Run, Edit %A_WorkingDir%\Quik Run Mini.ahk     
          }
     catch
          {
               MsgBox, 262192, ,Error
          }
     return
     
Get_Path:
     Gui,1:Hide
     Clipboard:=""
     While(!GetKeyState("Ctrl"))
     Tooltip, Select the program you want to add and then press "CTRL"
     ToolTip,
     Sleep,50
     Send,^c
     Sleep,50
     temp:=Clipboard
     Sleep,50
     Clipboard:=temp
     Gui,1:Show,x1100 y50
     return
   
Exit:  
     Gui,1:Destroy
     return

~MButton & WheelUp::
     mouseGetPos,mx,my
     mx-=377
     my+=-190
     Gui,1:Destroy
     Gui,1:+AlwaysOnTop
     Gui,1:Color,Black
     Gui,1:Font, s12 w700 cBlack Verdana 
     Gui,1:Add,Groupbox, cWhite x10 y10 w278 h264 Section,>           Web and Folders            <
     Gui,1:Add,Button,xs+10 ys+24 w258 h20 gRun_Web_Page,Open Me
     Gui,1:Add,Listbox,cWhite xs+10 ys+50 w258 r10 AltSubmit vWeb_Box ,% Web_list1
     Gui,1:Add,Groupbox, cWhite xs+290 y10 w278 h304 Section,>        Programs and Script's       <
     Gui,1:Add,Button,xs+10 ys+24 w258 h20 gRun_Program,Run Me
     Gui,1:Add,ListBox,cWhite xs+10 ys+50 w258 r12 AltSubmit vPrograms_Box ,% Programs_list1 
     Gui,Add,Checkbox, cWhite x20 ys+276 vLock1 gUnlock,Edit Me
    ; Gui, Color, 000000
     Gui,Color,Black, Black
     WinSet, TransColor, 000000 
     Gui -Caption
     ;Gui,1:Add,Button,x+10 w40 h15 Disabled vEdit_Button  gEdit_This_Script,Edit
     Gui,1:Add,Button,x+10 w80 h18 Disabled vPath_Button  gGet_Path,Get Path
     Gui,1:Add,Button,x+15 w80 h18 vExit_button gExit,Close
	 Gui,1:Show,x%mx% y%my% ,Quick Run
     Gui,1:Submit,NoHide
     return
    
MButton & WheelDown:: 
     Send, {Esc}
     Gui,1:Destroy	
     Return
     
^Esc:: 
ExitApp
Last edited by OCP on 26 Jul 2018, 22:40, edited 1 time in total.
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Listbox in black with white letters possible?

27 Apr 2018, 00:30

ok here are the causes of a few of the problems.

The "Unlock" sub is missing a return at the end of it, so it is bleeding into the "Edit_This_Script" sub.

With that fixed you can re-add your "edit" button, but you will need to play with your spacing again.

In the video I had improvised adding the "Gui,destroy" to the top of the subs without really thinking on it, it should be after the "gui,submit" or the variables don't end up getting the new values. So if you drop them down a line you can start using them.



*Bonus*

Here is how you can move your window without having to add the caption back.

In the Gui, add a text control at the bottom, just before the gui,show

Code: Select all

Gui,1:Add,Text,x10 y0 w550 h30 BackgroundTrans gMove_Window,
Then add this label

Code: Select all

Move_Window:
     PostMessage,0xA1,2
     return
Questions?

**Edit**
You should also set the coordmode to screen.

At the top of your script, under "SingleInstance force", add:

Code: Select all

Coordmode,mouse,screen
That way the x & y of your window will always be where you are expecting it to be.

**Edit2** lol
You have this:

Code: Select all

 Gui,1:Font, s12 w700 cBlack Verdana
I think you are going for this:

Code: Select all

 Gui,1:Font, s12 cBlack, Verdana
Note the "," before the type
OCP
Posts: 98
Joined: 28 Mar 2018, 19:28

Re: Listbox in black with white letters possible?

27 Apr 2018, 06:12

cool thnx :) the thing now always appears where i want it to be plus the edit works as intended now very nice

if i remove Gui -Caption the gui is no longer transparent i don't understand why i would need that to begin with to be honest, the only place where the gui will appear not at my mouse position is when you use the get path function and when i do i want it to appear on the top right out out the way of things i need to edit then. (this position i still need to fine tune a bit)

Gui,1:Font, s12 w700 cBlack, Verdana (w700 sets the bold level here i got pretty bad eyes fixed the missing , )

i added closing the gui if you click open me or run me, everything now works as i had intended :)

already thinking about a hotkey version so i can remove some of the about 70 hotkeys from my keyboard into such an idea

thnx for all your help learned a lot doing this
Last edited by OCP on 26 Jul 2018, 22:40, edited 1 time in total.
OCP
Posts: 98
Joined: 28 Mar 2018, 19:28

Re: Listbox in black with white letters possible?

27 Apr 2018, 06:29

if someone is interested here is the new version (removed most of my links ofc)

Code: Select all

#SingleInstance, force
Coordmode,mouse,screen
SetWorkingDir,%A_ScriptDir%

; Pages and folders
Web_list1:= "DRIVE - C|WEB - Sort My List|WEB - Youtube||"
Web_list2:= ["C:\","http://sortmylist.com/","https://www.youtube.com/"]
;================================================================================================================================
; Programs and scripts
Programs_list1:= "WIN - Services|"
Programs_list2:= ["C:\Windows\system32\services.msc"]
return

GuiClose:
     Gui,1:Destroy
     Return
    
Run_Web_Page:     
	 Gui,1:Submit,NoHide
     Gui,1:Destroy
     try 
          {
              Run,% Web_list2[Web_Box]
              Gui, Destroy
          }
     catch
          {
               MsgBox, 262192, ,Error
          }
     return
     
Run_Program:
	 Gui,1:Submit,NoHide
     Gui,1:Destroy
     try 
          {
              Run,% Programs_list2[Programs_Box]
              Gui, Destroy
          }
     catch
          {
               MsgBox, 262192, ,Error
          }
     return
     
Unlock:
     Lock1:=!Lock1
     if(Lock1=1)
          {
               GuiControl,1:Enable,Edit_Button
               GuiControl,1:Enable,Path_Button 
          }
     if(Lock1=0)
          {
               GuiControl,1:Disable,Edit_Button
               GuiControl,1:Disable,Path_Button 
          }
          return

Edit_This_Script:
     Try
          {
               Run, Edit %A_WorkingDir%\Quik Run Mini.ahk
          }
     catch
          {
               MsgBox, 262192, ,Error
          }
     return
     
Get_Path:
     Gui,1:Hide
     Clipboard:=""
     While(!GetKeyState("Ctrl"))
     Tooltip, Select the program you want to add and then press "CTRL"
     ToolTip,
     Sleep,50
     Send,^c
     Sleep,50
     temp:=Clipboard
     Sleep,50
     Clipboard:=temp
     Gui,1:Show,x1100 y50
     return
   
Exit:  
     Gui,1:Destroy
     return

;Move_Window:
;     PostMessage,0xA1,2
;     return

~MButton & WheelUp::
     mouseGetPos,mx,my
     mx-=377
     my+=-190
     Gui,1:Destroy
     Gui,1:+AlwaysOnTop
     Gui,1:Color,Black
     Gui,1:Font, s12 w700 cBlack, Verdana 
     Gui,1:Add,Groupbox, cWhite x10 y10 w278 h264 Section,>       Web and Folders        <
     Gui,1:Add,Button,xs+10 ys+24 w258 h20 gRun_Web_Page,Open Me
     Gui,1:Add,Listbox,cWhite xs+10 ys+50 w258 r10 AltSubmit vWeb_Box ,% Web_list1

     Gui,1:Add,Groupbox, cWhite xs+290 y10 w278 h304 Section,>   Programs and Script's   <
     Gui,1:Add,Button,xs+10 ys+24 w258 h20 gRun_Program,Run Me
     Gui,1:Add,ListBox,cWhite xs+10 ys+50 w258 r12 AltSubmit vPrograms_Box ,% Programs_list1 

     Gui,Add,Checkbox, cWhite x20 ys+276 vLock1 gUnlock,Lock
     Gui,Color,Black, Black
     WinSet, TransColor, 000000 
     Gui -Caption
     Gui,1:Add,Button,x+10 w40 h18 Disabled vEdit_Button  gEdit_This_Script,Edit
     Gui,1:Add,Button,x+10 w50 h18 Disabled vPath_Button  gGet_Path,Path
     Gui,1:Add,Button,x+10 w80 h18 vExit_button gExit,Close
     ;Gui,1:Add,Text,x10 y0 w550 h30 BackgroundTrans gMove_Window,
	 Gui,1:Show,x%mx% y%my% ,Quick Run
     Gui,1:Submit,NoHide
     return
    
MButton & WheelDown:: 
     Send, {Esc}
     Gui,1:Destroy	
     Return
     
^Esc:: 
ExitApp
it looks like this
Attachments
new look.jpg
new look.jpg (80.78 KiB) Viewed 1445 times
Last edited by OCP on 26 Jul 2018, 22:41, edited 1 time in total.
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: Listbox in black with white letters possible?

27 Apr 2018, 20:28

OCP wrote:
if i remove Gui -Caption the gui is no longer transparent i don't understand why i would need that to begin with to be honest,
The -Caption option removes the title bar, border from your gui, it doesn't have anything to do with transparency.
Built into the title bar "Caption" is the ability to click and move your window around, The text control & "Move_Window" sub that I gave you would allow you to click at the top of the gui and move it around without having the caption.

As for your inclusion of the line " WinSet, TransColor, 000000 " , fortunately you didn't add the one thing that would have made this work.
To get the winset, transcolor to act on your gui, you would have needed to include in your guis options "+LastFound". If you had added that, everything on your gui that had the color "000000" (or Black) would have been entirely transparent to the point that you could click the stuff under your window. In your case, I don't think that this is what you are trying for, so I would remove that line. For fun you should try adding +Lastfound before you do that so you can see how it works :).

If you are unsure of where to add the +LastFound, just put it next to +AlwaysOnTop.
Sort of like this.
Gui,1:+AlwaysOnTop +LastFound
Winset,Transcolor,000000

Question?
OCP
Posts: 98
Joined: 28 Mar 2018, 19:28

Re: Listbox in black with white letters possible?

27 Apr 2018, 21:56

ok cool ill try that

already moved on to converting this into a fl studio shortcut launcher just a static one with knobs to get rid of the army of hotkeys on my keyboard, in that i need what you just posted thnx i already got some code like this but you explaining it rly helps.

yup i have a few questions to further increase my understanding :)

1 the way i open the launcher causes it to scroll down on the left side (i use middle mouse followed by mouse wheel up to open it. and middle mouse followed by mouse wheel down to close it)
Can this be set not to happen in some way? i kinda like how it opens so i would like to keep that for this launcher and then again its not a big deal but still the last thing i could improve on in this one function wise
2 sort the list of added links by alphabet in ListBox can this be done automatically ? or do i just need to insert at right place?
3 can you overlay images in gui in such a way you can still click on stuff? so i could use images as a color tool to make for example a box in yellow for all my shortcuts for... blue for shortcuts type... and so on?

the one thing that annoys me in gui is its ugly buttons shining at me, ive looked into that but its above my head for now all the color stuff seams to be complicated.

feel free to just point me to a tut or so :) you've helped me so much already thank you i appreciate it

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Mateusz53, MrDoge, peter_ahk and 343 guests