*****Version 2 available here*****
viewtopic.php?f=6&t=109733&p=494966#p494966
. .
Version 1 Window 7+
I made this overlay for a POS system that someone else might find useful.
The way you use this is much the way you would use other ahk gui controls ( listbox, listview, DDL, ComboBox, etc.)
This is the control, you do the coding.
To use this script you will need a copy of the GDI+ lib for ahk found here on the forum.
Once you have the GDI+ lib you can create a new script and paste this into it ( menu code ).
Code: Select all
;************
;POS_Control Class v1.2
;Written By: Hellbent
;**************************************************************************************************************************************************************************
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;**************************************************************************************************************************************************************************
class POS_Control {
static init := POS_Control.SetUp()
TabMoveButton_Y[]{
Get{
return This.TabMoveAllButton_Y + This.TabMoveAllButton_H + This.TabMargin
}
}
TabMoveButton_H[]{
Get{
return This.TabWindow.H - This.TabMoveAllButton_H - 3 * This.TabMargin
}
}
TabDisplayArea_W[]{
Get{
return This.TabWindow.W - This.TabMoveButton_W - 3 * This.TabMargin - This.TabMoveButton_W - This.TabMargin
}
}
TabDisplayArea_H[]{
Get{
return This.TabWindow.H - 2 * This.TabMargin
}
}
TabUPButton_X[]{
Get{
return This.TabMoveButton_W + This.TabDisplayArea_W + 3 * This.TabMargin
}
}
TabDownButton_X[]{
Get{
return This.TabUPButton_X
}
}
TabResizeButton_X[]{
Get{
return This.TabWindow.W - 28
}
}
TabResizeButton_Y[]{
Get{
return This.TabWindow.H - 28
}
}
ButtonMoveButton_Y[]{
Get{
return This.ButtonMoveAllButton_Y + This.ButtonMoveAllButton_H + This.ButtonMargin
}
}
ButtonMoveButton_H[]{
Get{
return This.ButtonWindow.H - This.ButtonMoveAllButton_H - 3 * This.ButtonMargin
}
}
ButtonDisplayArea_W[]{
Get{
return This.ButtonWindow.W - This.ButtonMoveButton_W - 3 * This.ButtonMargin - This.ButtonMoveButton_W - This.ButtonMargin
}
}
ButtonDisplayArea_H[]{
Get{
return This.ButtonWindow.H - 2 * This.ButtonMargin
}
}
ButtonUPButton_X[]{
Get{
return This.ButtonMoveButton_W + This.ButtonDisplayArea_W + 3 * This.ButtonMargin
}
}
ButtonDownButton_X[]{
Get{
return This.ButtonUPButton_X
}
}
ButtonResizeButton_X[]{
Get{
return This.ButtonWindow.W - 28
}
}
ButtonResizeButton_Y[]{
Get{
return This.ButtonWindow.H - 28
}
}
TabUnit_Width[]{
Get{
return ( out := Floor( This.TabDisplayArea_W - This.TabMargin ) / ( This.TabWidth + This.TabMargin ) ) ? ( floor( out ) ) : ( 1 )
}
}
TabUnit_Height[]{
Get{
return ( out := Floor( This.TabDisplayArea_H - This.TabMargin ) / ( This.TabHeight + This.TabMargin ) ) ? ( Floor( out ) ) : ( 1 )
}
}
TabUnit_Area[]{
Get{
return ( This.TabUnit_Width * ( This.TabSelectedRow - 1 ) + This.TabUnit_Width * This.TabUnit_Height )
}
}
ButtonUnit_Width[]{
Get{
return ( out := Floor( This.ButtonDisplayArea_W - This.ButtonMargin ) / ( This.ButtonWidth + This.ButtonMargin ) ) ? ( floor( out ) ) : ( 1 )
}
}
ButtonUnit_Height[]{
Get{
return ( out := Floor( This.ButtonDisplayArea_H - This.ButtonMargin ) / ( This.ButtonHeight + This.ButtonMargin ) ) ? ( Floor( out ) ) : ( 1 )
}
}
ButtonUnit_Area[]{
Get{
return ( This.ButtonUnit_Width * ( This.ButtonSelectedRow - 1 ) + This.ButtonUnit_Width * This.ButtonUnit_Height )
}
}
ButtonMinWidth[]{
Get{
return This.ButtonWidth + This.ButtonMoveAllButton_W + This.ButtonUPButton_W + 6 * This.ButtonMargin
}
}
ButtonMinHeight[]{
Get{
if( This.ButtonHeight + 4 * This.ButtonMargin < 120 )
return 120
else
return This.ButtonHeight + 4 * This.ButtonMargin
}
}
TabMinWidth[]{
Get{
return This.TabWidth + This.TabMoveAllButton_W + This.TabUPButton_W + 6 * This.TabMargin
}
}
TabMinHeight[]{
Get{
if( ( This.TabHeight + 4 * This.TabMargin ) < 120 )
return 120
else
return This.TabHeight + 4 * This.TabMargin
}
}
SetUp(){
Gdip_Startup()
This.Tabs := []
;*****************************
;*****************************
;*****************************
This.TabWindow := New PopUpWindow( { AutoShow: 1 , X: "Center" , Y: 200 , W: 500 , H: 300 , Options: " -DPIScale +AlwaysOnTop +ToolWindow" } )
This.TabWidth := 180
This.TabHeight := 80
This.TabMargin := 10
This.TabBackgroundColor := "0xFF62666a"
This.TabMoveAllButton_Color := "0xFF3399cc"
This.TabMoveButton_Color := This.TabMoveAllButton_Color
This.TabDisplayArea_Color := "0xfff0f0f0"
This.TabUPButton_Color := This.TabMoveAllButton_Color
This.TabDownButton_Color := This.TabMoveAllButton_Color
This.TabResizeButton_Color := "0xFFFFFF00"
This.TabControlBackgroundColor := "0xFF22262a"
This.TabMoveAllButton_X := This.TabMargin
This.TabMoveAllButton_Y := This.TabMargin
This.TabMoveAllButton_W := 20
This.TabMoveAllButton_H := 30
This.TabMoveButton_X := This.TabMargin
This.TabMoveButton_W := 20
This.TabDisplayArea_X := This.TabMoveButton_W + 2 * This.TabMargin
This.TabDisplayArea_Y := This.TabMargin
This.TabUPButton_Y := This.TabMargin
This.TabUPButton_W := 20
This.TabUPButton_H := 30
This.TabDownButton_Y := This.TabUPButton_H + 2 * This.TabMargin
This.TabDownButton_W := 20
This.TabDownButton_H := 30
This.TabResizeButton_W := 20
This.TabResizeButton_H := 20
This.TabSelectedTab := 1
This.TabSelectedRow := 1
;*****************************
;*****************************
;*****************************
This.ButtonWindow := New PopUpWindow( { AutoShow: 1 , X: This.TabWindow.X + This.TabWindow.W , Y: 200 , W: 300 , H: 300 , Options: " -DPIScale +AlwaysOnTop +ToolWindow" } )
This.ButtonWidth := 80
This.ButtonHeight := 80
This.ButtonMargin := 10
This.ButtonMoveAllButton_Color := "0xFF3377aa"
This.ButtonMoveButton_Color := This.ButtonMoveAllButton_Color
This.ButtonDisplayArea_Color := "0xFF22262a"
This.ButtonUPButton_Color := This.ButtonMoveAllButton_Color
This.ButtonDownButton_Color := This.ButtonMoveAllButton_Color
This.ButtonResizeButton_Color := "0xFFFFFF00"
This.ButtonControlBackgroundColor := "0xFF22262a"
This.ButtonMoveAllButton_X := This.ButtonMargin
This.ButtonMoveAllButton_Y := This.ButtonMargin
This.ButtonMoveAllButton_W := 20
This.ButtonMoveAllButton_H := 30
This.ButtonMoveButton_X := This.ButtonMargin
This.ButtonMoveButton_W := 20
This.ButtonDisplayArea_X := This.ButtonMoveButton_W + 2 * This.ButtonMargin
This.ButtonDisplayArea_Y := This.ButtonMargin
This.ButtonUPButton_Y := This.ButtonMargin
This.ButtonUPButton_W := 20
This.ButtonUPButton_H := 30
This.ButtonDownButton_Y := This.ButtonUPButton_H + 2 * This.ButtonMargin
This.ButtonDownButton_W := 20
This.ButtonDownButton_H := 30
This.ButtonResizeButton_W := 20
This.ButtonResizeButton_H := 20
This.ButtonSelectedTab := 0
This.ButtonSelectedRow := 1
This.ButtonActiveTab := 0
;*****************************
;*****************************
;*****************************
OnMessage( 0x201 , This.OnClick.Bind( This ) )
OnMessage( 0x020A , This.OnWheelChange.Bind( This ) )
}
AddNewTab( position := "" , obj := "" ){
local TabObj := {} , k , v
if( !position )
position := This.Tabs.MaxIndex() + 1
TabObj.Text := ""
TabObj.Color := "0xFFFF0000"
TabObj.FontType := "Segoe UI"
TabObj.FontSize := 12
TabObj.FontOptions := " Center vCenter Bold "
TabObj.FontColor := "0xFF000000"
if( IsObject( obj ) ){
for k , v in obj {
if( TabObj.HasKey( k ) )
TabObj[ k ] := obj[ k ]
}
}
This.Tabs[ Position ] := TabObj
This.Tabs[ Position ].Buttons := []
if( obj.Haskey( "B64" ) ){
This.Tabs[ Position ].Icon := This.B64ToPBitmap( obj.B64 )
}else if( obj.Haskey( "pBitmap" ) ){
This.Tabs[ Position ].Icon := obj.pBitmap
}
}
AddNewButton( Tab := "" , position := "" , obj := "" ){
local ButtonObj := {} , k , v
if( !Tab )
Tab := This.Tabs.MaxIndex()
if( !position ){
position := This.Tabs[ Tab ].Buttons.MaxIndex() + 1
if( !position )
position := 1
}
ButtonObj.Text := ""
ButtonObj.Color := "0xFFFF0000"
ButtonObj.FontType := "Segoe UI"
ButtonObj.FontSize := 12
ButtonObj.FontOptions := " Center vCenter Bold "
ButtonObj.FontColor := "0xFF000000"
if( IsObject( obj ) ){
for k , v in obj {
if( ButtonObj.HasKey( k ) )
ButtonObj[ k ] := obj[ k ]
}
}
This.Tabs[ Tab ].Buttons[ position ] := ButtonObj
if( obj.HasKey( "Label" ) )
This.Tabs[ Tab ].Buttons[ position ].Label := obj.Label
if( obj.Haskey( "B64" ) ){
This.Tabs[ Tab ].Buttons[ position ].Icon := This.B64ToPBitmap( obj.B64 )
}else if( obj.Haskey( "pBitmap" ) ){
This.Tabs[ Tab ].Buttons[ position ].Icon := obj.pBitmap
}
}
MoveWindow( Window := "Tab" , all := 0 ){
local x , y
if( all ){
if( window = "tab" ){
This.WinVector := New Vector( This.ButtonWindow.X , This.ButtonWindow.Y )
This.WinVector.Sub( This.TabWindow.X , This.TabWindow.Y )
PostMessage, 0xA1, 2
While( GetKeyState( "LButton" , "P" ) )
Sleep 30
WinGetPos, x, y,,, % "ahk_id " This.TabWindow.Hwnd
This.TabWindow.UpdateSettings( { X: x , Y: y } )
This.ButtonWindow.UpdateSettings( { X: x + This.WinVector.X , Y: y + This.WinVector.Y } )
This.DrawButtonWindow()
}else{
This.WinVector := New Vector( This.TabWindow.X , This.TabWindow.Y )
This.WinVector.Sub( This.ButtonWindow.X , This.ButtonWindow.Y )
PostMessage, 0xA1, 2
While( GetKeyState( "LButton" , "P" ) )
Sleep 30
WinGetPos, x, y,,, % "ahk_id " This.ButtonWindow.Hwnd
This.ButtonWindow.UpdateSettings( { X: x , Y: y } )
This.TabWindow.UpdateSettings( { X: x + This.WinVector.X , Y: y + This.WinVector.Y } )
This.DrawTabWindow()
}
}else{
PostMessage, 0xA1, 2
While( GetKeyState( "LButton" , "P" ) )
Sleep 30
WinGetPos, x, y,,, % "ahk_id " This[ window "Window" ].Hwnd
This[ window "Window" ].UpdateSettings( { X: x , Y: y } )
}
}
ResizeWindow( window := "Tab" ){
local lx , ly , x , y
CoordMode, Mouse, Screen
This[ window "SelectedRow" ] := 1
While( GetKeyState( "LButton" , "P" ) ){
MouseGetPos, x , y
if( x != lx || y != ly ){
lx := x , ly := y
if( ( This[ window "Window" ].W := x - This[ window "Window" ].X ) < This[ window "MinWidth" ] )
This[ window "Window" ].W := This[ window "MinWidth" ]
if( ( This[ window "Window" ].H := y - This[ window "Window" ].Y ) < This[ window "MinHeight" ] )
This[ window "Window" ].H := This[ window "MinHeight" ]
This[ window "Window" ].UpdateSettings( "" , 1 )
This[ "Draw" Window "Window" ]()
}
}
}
CheckWindowTriggers( Window := "Tab" ){
local x , y , k , v
CoordMode, Mouse, Client
MouseGetPos, x , y
for k , v in [ Window "MoveAllButton_" , Window "MoveButton_" , Window "DisplayArea_" , Window "UPButton_" , Window "DownButton_" , Window "ResizeButton_" ]{
if( x >= This[ v "X" ] && x <= This[ v "X" ] + This[ v "W" ] && y >= This[ v "Y" ] && y <= This[ v "Y" ] + This[ v "H" ]){
return A_Index
}
}
}
CheckTabControls(){
local x , y , k , v , index , mx , my
CoordMode, Mouse, Client
MouseGetPos, mx , my
index := 1 + ( This.TabUnit_Width * ( This.TabSelectedRow - 1 ) )
y := This.TabDisplayArea_Y + This.TabMargin
Loop, % This.TabUnit_Height {
x := This.TabDisplayArea_X + This.TabMargin
Loop, % This.TabUnit_Width {
if( IsObject( This.Tabs[ index ] ) ){
if( mx >= x && mx <= x + This.TabWidth && my >= y && my <= y + This.TabHeight ){
return index
}
}
x += This.TabWidth + This.TabMargin
index++
}
y += This.TabHeight + This.TabMargin
}
}
CheckButtonControls(){
local x , y , mx , my , index
CoordMode, Mouse, Client
MouseGetPos, mx , my
index := 1 + ( This.ButtonUnit_Width * ( This.ButtonSelectedRow - 1 ) )
y := This.ButtonDisplayArea_Y + This.ButtonMargin
Loop, % This.ButtonUnit_Height {
x := This.ButtonDisplayArea_X + This.ButtonMargin
Loop, % This.ButtonUnit_Width {
if( IsObject( This.Tabs[ This.TabSelectedTab ].Buttons[ index ] ) ){
if( mx >= x && mx <= x + This.ButtonWidth && my >= y && my <= y + This.ButtonHeight ){
return index
}
}
x += This.ButtonWidth + This.ButtonMargin
index++
}
y += This.ButtonHeight + This.ButtonMargin
}
}
OnWheelChange( input , w , m , hwnd ){
local dir , sel , test
if( This.Active )
return
This.Active := 1
if( hwnd = This.TabWindow.Hwnd )
sel := "Tab"
else
sel := "Button"
dir := ( ( input >> 16 ) > 0x7FFF ) || ( ( input < 0 ) ? ( 1 ) : ( 0 ) )
if( !dir ){
if( This[ sel "SelectedRow" ] > 1 ){
--This[ sel "SelectedRow" ]
This[ "Draw" sel "Window" ]()
}
}else{
if( sel = "Tab" ){
if( This.TabUnit_Area < This.Tabs.MaxIndex() ){
This.TabSelectedRow++
This.DrawTabWindow()
}
}else{
if( This.ButtonUnit_Area < This.Tabs[ This.TabSelectedTab ].Buttons.MaxIndex() ){
This.ButtonSelectedRow++
This.DrawButtonWindow()
}
}
}
Sleep, 30
This.Active := 0
}
OnClick( l , w , m , hwnd ){
local sel
if( hwnd = This.TabWindow.Hwnd ){
if( control := This.CheckWindowTriggers( "Tab" ) ){
if( control = 1 ){
This.MoveWindow( "Tab" , 1 )
}else if( control = 2 ){
This.MoveWindow( "Tab" )
}else if( control = 3 ){
if( sel := This.CheckTabControls() ){
This.TabSelectedTab := sel
This.ButtonSelectedRow := 1
This.DrawTabWindow()
This.DrawButtonWindow()
}
}else if( control = 4 ){
if( This.TabSelectedRow > 1 ){
--This.TabSelectedRow
This.DrawTabWindow()
}
}else if( control = 5 ){
if( This.TabUnit_Area < This.Tabs.MaxIndex() ){
This.TabSelectedRow++
This.DrawTabWindow()
}
}else if( control = 6 ){
This.ResizeWindow( "Tab" )
}
}
return 1
}else if( hwnd = This.ButtonWindow.Hwnd ){
if( control := This.CheckWindowTriggers( "Button" ) ){
if( control = 1 ){
This.MoveWindow( "Button" , 1 )
}else if( control = 2 ){
This.MoveWindow( "Button" )
}else if( control = 3 ){
if( sel := This.CheckButtonControls() ){
This.ButtonSelectedTab := sel
This.DrawButtonWindow()
While( GetKeyState( "LButton" , "P" ) )
Sleep, 30
if( This.Tabs[ This.TabSelectedTab ].Buttons[ This.ButtonSelectedTab ].Label ){
This.ButtonActiveTab := This.ButtonSelectedTab
SetTimer, % This.Tabs[ This.TabSelectedTab ].Buttons[ This.ButtonSelectedTab ].Label , -30
;~ gosub, % This.Tabs[ This.TabSelectedTab ].Buttons[ This.ButtonSelectedTab ].Label
}
This.ButtonSelectedTab := 0
This.DrawButtonWindow()
}
}else if( control = 4 ){
if( This.ButtonSelectedRow > 1 ){
--This.ButtonSelectedRow
This.DrawButtonWindow()
}
}else if( control = 5 ){
if( This.ButtonUnit_Area < This.Tabs[ This.TabSelectedTab ].Buttons.MaxIndex() ){
This.ButtonSelectedRow++
This.DrawButtonWindow()
}
}else if( control = 6 ){
This.ResizeWindow( "Button" )
}
}
return 1
}
return 0
}
DrawTabWindow(){
This.TabWindow.ClearWindow()
;Paint Background
This.TabWindow.PaintBackground( { Color: This.TabBackgroundColor , X: 2 , Y: 2 , W: This.TabWindow.W - 4 , H: This.TabWindow.H - 4 , Round: 5 } )
;Paint Move all button
This.TabWindow.PaintBackground( { Color: This.TabMoveAllButton_Color , X: This.TabMoveAllButton_X , Y: This.TabMoveAllButton_Y , W: This.TabMoveAllButton_W , H: This.TabMoveAllButton_H , Round: 5 } )
;Paint Move Button
This.TabWindow.PaintBackground( { Color: This.TabMoveButton_Color , X: This.TabMoveButton_X , Y: This.TabMoveButton_Y , W: This.TabMoveButton_W , H: This.TabMoveButton_H , Round: 5 } )
;Paint Resize Button
This.TabWindow.PaintBackground( { Color: This.TabResizeButton_Color , X: This.TabResizeButton_X , Y: This.TabResizeButton_Y , W: This.TabResizeButton_W , H: This.TabResizeButton_H , Round: 5 } )
;Paint display area
This.TabWindow.PaintBackground( { Color: This.TabDisplayArea_Color , X: This.TabDisplayArea_X , Y: This.TabDisplayArea_Y , W: This.TabDisplayArea_W , H: This.TabDisplayArea_H , Round: 5 } )
;Paint Up Button
This.TabWindow.PaintBackground( { Color: This.TabUPButton_Color , X: This.TabUPButton_X , Y: This.TabUPButton_Y , W: This.TabUPButton_W , H: This.TabUPButton_H , Round: 5 } )
;Paint Down Button
This.TabWindow.PaintBackground( { Color: This.TabDownButton_Color , X: This.TabDownButton_X , Y: This.TabDownButton_Y , W: This.TabDownButton_W , H: This.TabDownButton_H , Round: 5 } )
index := 1 + ( This.TabUnit_Width * ( This.TabSelectedRow - 1 ) )
y := This.TabDisplayArea_Y + This.TabMargin
Loop, % This.TabUnit_Height {
x := This.TabDisplayArea_X + This.TabMargin
Loop, % This.TabUnit_Width {
if( IsObject( This.Tabs[ index ] ) ){
if( This.Tabs[ index ].Haskey( "Icon" ) ){
This.TabWindow.PaintBackground( { Color: ( index = This.TabSelectedTab ) ? ( "0xFFFF0000" ) : ( "0xFF000000" ) , X: x - 4 , Y: y - 4 , W: This.TabWidth + 8 , H: This.TabHeight + 8 , Round: 5 } )
This.TabWindow.PaintBackground( { Color: This.Tabs[ index ].Color , X: x , Y: y , W: This.TabWidth , H: This.TabHeight , Round: 5 } )
This.TabWindow.DrawBitmap( This.Tabs[ index ].Icon , { X: x , Y: y , W: ( This.TabWidth <= This.TabHeight ) ? ( w := This.TabWidth ) : ( w := This.TabHeight ) , H: w } , 0 )
DrawText( This.TabWindow.G , x , y , This.Tabs[ index ].text , This.Tabs[ index ].FontColor , This.TabWidth , This.TabHeight , This.Tabs[ index ].FontOptions " s" This.Tabs[ index ].FontSize , This.Tabs[ index ].FontType )
}else{
This.TabWindow.PaintBackground( { Color: ( index = This.TabSelectedTab ) ? ( "0xFFFF0000" ) : ( "0xFF000000" ) , X: x - 4 , Y: y - 4 , W: This.TabWidth + 8 , H: This.TabHeight + 8 , Round: 5 } )
This.TabWindow.PaintBackground( { Color: This.Tabs[ index ].Color , X: x , Y: y , W: This.TabWidth , H: This.TabHeight , Round: 5 } )
DrawText( This.TabWindow.G , x , y , This.Tabs[ index ].text , This.Tabs[ index ].FontColor , This.TabWidth , This.TabHeight , This.Tabs[ index ].FontOptions " s" This.Tabs[ index ].FontSize , This.Tabs[ index ].FontType )
}
}
x += This.TabWidth + This.TabMargin
index++
}
y += This.TabHeight + This.TabMargin
}
This.TabWindow.UpdateWindow()
}
DrawButtonWindow(){
This.ButtonWindow.ClearWindow()
;Paint Background
This.ButtonWindow.PaintBackground( { Color: "0x66000000" , X: 2 , Y: 2 , W: This.ButtonWindow.W - 4 , H: This.ButtonWindow.H - 4 , Round: 5 } )
;Paint Move all button
This.ButtonWindow.PaintBackground( { Color: This.ButtonMoveAllButton_Color , X: This.ButtonMoveAllButton_X , Y: This.ButtonMoveAllButton_Y , W: This.ButtonMoveAllButton_W , H: This.ButtonMoveAllButton_H , Round: 5 } )
;Paint Move Button
This.ButtonWindow.PaintBackground( { Color: This.ButtonMoveButton_Color , X: This.ButtonMoveButton_X , Y: This.ButtonMoveButton_Y , W: This.ButtonMoveButton_W , H: This.ButtonMoveButton_H , Round: 5 } )
;Paint Resize Button
This.ButtonWindow.PaintBackground( { Color: This.ButtonResizeButton_Color , X: This.ButtonResizeButton_X , Y: This.ButtonResizeButton_Y , W: This.ButtonResizeButton_W , H: This.ButtonResizeButton_H , Round: 5 } )
;Paint display area
This.ButtonWindow.PaintBackground( { Color: This.ButtonDisplayArea_Color , X: This.ButtonDisplayArea_X , Y: This.ButtonDisplayArea_Y , W: This.ButtonDisplayArea_W , H: This.ButtonDisplayArea_H , Round: 5 } )
;Paint Up Button
This.ButtonWindow.PaintBackground( { Color: This.ButtonUPButton_Color , X: This.ButtonUPButton_X , Y: This.ButtonUPButton_Y , W: This.ButtonUPButton_W , H: This.ButtonUPButton_H , Round: 5 } )
;Paint Down Button
This.ButtonWindow.PaintBackground( { Color: This.ButtonDownButton_Color , X: This.ButtonDownButton_X , Y: This.ButtonDownButton_Y , W: This.ButtonDownButton_W , H: This.ButtonDownButton_H , Round: 5 } )
index := 1 + ( This.ButtonUnit_Width * ( This.ButtonSelectedRow - 1 ) )
y := This.ButtonDisplayArea_Y + This.ButtonMargin
Loop, % This.ButtonUnit_Height {
x := This.ButtonDisplayArea_X + This.ButtonMargin
Loop, % This.ButtonUnit_Width {
if( IsObject( This.Tabs[ This.TabSelectedTab ].Buttons[ index ] ) ){
if( This.Tabs[ This.TabSelectedTab ].Buttons[ index ].Haskey( "Icon" ) ){
This.ButtonWindow.PaintBackground( { Color: ( This.ButtonSelectedTab = index ) ? ( "0xFFFF0000" ) : ( This.ButtonControlBackgroundColor ) , X: x - 4 , Y: y - 4 , W: This.ButtonWidth + 8 , H: This.ButtonHeight + 8 , Round: 5 } )
This.ButtonWindow.PaintBackground( { Color: This.Tabs[ This.TabSelectedTab ].Buttons[ index ].Color , X: x , Y: y , W: This.ButtonWidth , H: This.ButtonHeight , Round: 5 } )
This.ButtonWindow.DrawBitmap( This.Tabs[ This.TabSelectedTab ].Buttons[ index ].Icon , { X: x , Y: y , W: ( This.ButtonWidth <= This.ButtonHeight ) ? ( w := This.ButtonWidth ) : ( w := This.ButtonHeight ) , H: w } , 0 )
DrawText( This.ButtonWindow.G , x , y , This.Tabs[ This.TabSelectedTab ].Buttons[ index ].text , This.Tabs[ This.TabSelectedTab ].Buttons[ index ].FontColor , This.ButtonWidth , This.ButtonHeight , This.Tabs[ This.TabSelectedTab ].Buttons[ index ].FontOptions " s" This.Tabs[ This.TabSelectedTab ].Buttons[ index ].FontSize , This.Tabs[ This.TabSelectedTab ].Buttons[ index ].FontType )
}else{
This.ButtonWindow.PaintBackground( { Color: ( This.ButtonSelectedTab = index ) ? ( "0xFFFF0000" ) : ( This.ButtonControlBackgroundColor ) , X: x - 4 , Y: y - 4 , W: This.ButtonWidth + 8 , H: This.ButtonHeight + 8 , Round: 5 } )
This.ButtonWindow.PaintBackground( { Color: This.Tabs[ This.TabSelectedTab ].Buttons[ index ].Color , X: x , Y: y , W: This.ButtonWidth , H: This.ButtonHeight , Round: 5 } )
DrawText( This.ButtonWindow.G , x , y , This.Tabs[ This.TabSelectedTab ].Buttons[ index ].text , This.Tabs[ This.TabSelectedTab ].Buttons[ index ].FontColor , This.ButtonWidth , This.ButtonHeight , This.Tabs[ This.TabSelectedTab ].Buttons[ index ].FontOptions " s" This.Tabs[ This.TabSelectedTab ].Buttons[ index ].FontSize , This.Tabs[ This.TabSelectedTab ].Buttons[ index ].FontType )
}
}
x += This.ButtonWidth + This.ButtonMargin
index++
}
y += This.ButtonHeight + This.ButtonMargin
}
This.ButtonWindow.UpdateWindow()
}
B64ToPBitmap( Input ){
local ptr , uptr , pBitmap , pStream , hData , pData , Dec , DecLen , B64
VarSetCapacity( B64 , strlen( Input ) << !!A_IsUnicode )
B64 := Input
If !DllCall("Crypt32.dll\CryptStringToBinary" ( ( A_IsUnicode ) ? ( "W" ) : ( "A" ) ), Ptr := A_PtrSize ? "Ptr" : "UInt" , &B64, "UInt", 0, "UInt", 0x01, Ptr, 0, "UIntP", DecLen, Ptr, 0, Ptr, 0)
Return False
VarSetCapacity( Dec , DecLen , 0 )
If !DllCall("Crypt32.dll\CryptStringToBinary" (A_IsUnicode ? "W" : "A"), Ptr, &B64, "UInt", 0, "UInt", 0x01, Ptr, &Dec, "UIntP", DecLen, Ptr, 0, Ptr, 0)
Return False
DllCall("Kernel32.dll\RtlMoveMemory", Ptr, pData := DllCall("Kernel32.dll\GlobalLock", Ptr, hData := DllCall( "Kernel32.dll\GlobalAlloc", "UInt", 2, UPtr := A_PtrSize ? "UPtr" : "UInt" , DecLen, UPtr), UPtr) , Ptr, &Dec, UPtr, DecLen)
DllCall("Kernel32.dll\GlobalUnlock", Ptr, hData)
DllCall("Ole32.dll\CreateStreamOnHGlobal", Ptr, hData, "Int", True, Ptr "P", pStream)
DllCall("Gdiplus.dll\GdipCreateBitmapFromStream", Ptr, pStream, Ptr "P", pBitmap)
return pBitmap
}
}
;************
;Vector Class
;**************************************************************************************************************************************************************************
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;**************************************************************************************************************************************************************************
Class Vector {
;Written By: HB
;Date: Sept 23rd, 2022
;Last Edit: Sept 24th, 2022
;Purpose: Vector math class
;Credit: Rohwedder
;Resources:
;Line intercept concepts and code: https://www.autohotkey.com/boards/viewtopic.php?f=76&t=37175
;Create an Arrow: https://www.autohotkey.com/boards/viewtopic.php?f=76&t=92039&p=479129#p478944
;Getting an angle: https://www.autohotkey.com/boards/viewtopic.php?f=76&t=108760&p=483661#p483678
;Setting an Angle: https://www.autohotkey.com/boards/viewtopic.php?f=76&t=108760&p=483786#p483811
;
static RadToDeg := 45 / ATan( 1 )
, DegToRad := ATan( 1 ) / 45
__New( x := 0 , y := 0 , rotate := 0 ){
if( IsObject( x ) ){
if( rotate = 3 ){
This.X := x.X * -1
,This.Y := x.Y * -1
}else if( rotate = 2 ){
This.X := x.Y
,This.Y := x.X * -1
}else if( rotate = 1 ){
This.X := x.Y * -1
,This.Y := x.X
}else{
This.X := x.X
,This.Y := x.Y
}
}else{
if( rotate = 3 ){
This.X := X * -1
,This.Y := Y * -1
}else if( rotate = 2 ){
This.X := Y
,This.Y := X * -1
}else if( rotate = 1 ){
This.X := Y * -1
,This.Y := X
}else{
This.X := X
,This.Y := Y
}
}
}
Add( x , y := "" ){
if( IsObject( x ) ){
This.X += x.X
,This.Y += x.Y
}else if( y = "" ){
This.X += x
,This.Y += x
}else{
This.X += x
,This.Y += y
}
}
Sub( x , y := "" ){
if( IsObject( x ) ){
This.X -= x.X
,This.Y -= x.Y
}else if( y = "" ){
This.X -= X
,This.Y -= X
}else{
This.X -= X
,This.Y -= Y
}
}
Div( x , y := "" ){
if( IsObject( x ) ){
This.X /= x.X
,This.Y /= x.Y
}else if( x && y = "" ){
This.X /= x
,This.Y /= x
}else{
This.X /= X
,This.Y /= Y
}
}
Mult( x , y := "" ){
if( IsObject( x ) ){
This.X *= x.X
,This.Y *= x.Y
}else if( x && y = "" ){
This.X *= x
,This.Y *= x
}else{
This.X *= X
,This.Y *= Y
}
}
Dist( x , y := "" ){
if( IsObject( x ) )
return Sqrt( ( ( This.X - x.X ) **2 ) + ( ( This.Y - x.Y ) **2 ) )
else
return Sqrt( ( ( This.X - X ) **2 ) + ( ( This.Y - Y ) **2 ) )
}
GetMag(){
return Sqrt( This.X * This.X + This.Y * This.Y )
}
SetMag( magnitude ){
local m := This.GetMag()
This.X := This.X * magnitude / m
,This.Y := This.Y * magnitude / m
}
MagSq(){
return This.GetMag()**2
}
Dot( x , y := "" ){
if( IsObject( x ) )
return ( This.X * x.X ) + ( This.Y * x.Y )
else
return ( This.X * X ) + ( This.Y * Y )
}
Cross( x , y := "" ){
if( IsObject( x ) )
return This.X * x.Y - This.Y * x.X
else
return This.X * Y - This.Y * X
}
Norm(){
local m := This.GetMag()
This.X /= m
This.Y /= m
}
GetAngle(){
local angle
( ( angle := Vector.RadToDeg * DllCall( "msvcrt\atan2" , "Double" , This.Y , "Double" , This.X , "CDECL Double" ) ) < 0 ) ? ( angle += 360 )
return angle
}
SetAngle( newAngle := 0 , NewVector := 0 ){
local Angle := This.GetAngle()
, ChangeAngle := newAngle - Angle
, Co := Cos( Vector.DegToRad * ChangeAngle )
, Si := Sin( Vector.DegToRad * ChangeAngle )
, X := This.X
, Y := This.Y
, X2 := X * Co - Y * Si
, Y2 := X * Si + Y * Co
if( !NewVector )
This.X := X2 , This.Y := Y2
else
return New Vector( X2 , Y2 )
}
RotateAngle( rotationAmount := 90 , NewVector := 0 ){
local Co := Cos( Vector.DegToRad * rotationAmount )
, Si := Sin( Vector.DegToRad * rotationAmount )
, X := This.X
, Y := This.Y
, X2 := X * Co - Y * Si
, Y2 := X * Si + Y * Co
if( !NewVector )
This.X := X2 , This.Y := Y2
else
return New Vector( X2 , Y2 )
}
;********************************************
;class methods
TestLineInterceptPoint( interceptPoint , Line1 , Line2 ){ ; Line = { Start: { X: , Y: } , End: { X: , Y: } } , interceptPoint = { X: , Y: }
local
for k , v in [ "X" , "Y" ]
M%v%_Min := min( Line1.Start[ v ] , Line1.End[ v ] )
,M%v%_Max := max( Line1.Start[ v ] , Line1.End[ v ] )
,L%v%_Min := min( Line2.Start[ v ] , Line2.End[ v ] )
,L%v%_Max := max( Line2.Start[ v ] , Line2.End[ v ] )
if( !( interceptPoint.X < Mx_Min || interceptPoint.X > Mx_Max || interceptPoint.X < Lx_Min || interceptPoint.X > Lx_Max ) && !( interceptPoint.Y < My_Min || interceptPoint.Y > My_Max || interceptPoint.Y < Ly_Min || interceptPoint.Y > Ly_Max ) )
return 1
return 0
}
GetLineInterceptPoint( Line1 , Line2 ){ ; Line = { Start: { X: , Y: } , End: { X: , Y: } }
local A1 := Line1.End.Y - Line1.Start.Y
,B1 := Line1.Start.X - Line1.End.X
,C1 := A1 * Line1.Start.X + B1 * Line1.Start.Y
,A2 := Line2.End.Y - Line2.Start.Y
,B2 := Line2.Start.X - Line2.End.X
,C2 := A2 * Line2.Start.X + B2 * Line2.Start.Y
,Denominator := A1 * B2 - A2 * B1
return New Vector( { X: ( ( B2 * C1 - B1 * C2 ) / Denominator ) , Y: ( ( A1 * C2 - A2 * C1 ) / Denominator ) } )
}
;********************************************
}
;**************************************************************************************************************************************************************************
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000 00000 <<<>>> 00000
;**************************************************************************************************************************************************************************
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
class PopUpWindow {
;PopUpWindow v2.2
;Date Written: Oct 28th, 2021
;Last Edit: Feb 7th, 2022 :Changed the trigger method.
;Written By: Hellbent aka CivReborn
;SpcThanks: teadrinker , malcev
static Index := 0 , Windows := [] , Handles := [] , EditHwnd , HelperHwnd
__New( obj := "" ){
This._SetDefaults()
This.UpdateSettings( obj )
This._CreateWindow()
This._CreateWindowGraphics()
if( This.AutoShow )
This.ShowWindow( This.Title )
}
_SetDefaults(){
This.X := 10
This.Y := 10
This.W := 10
This.H := 10
This.Smoothing := 2
This.Options := " -DPIScale +AlwaysOnTop "
This.AutoShow := 0
This.GdipStartUp := 0
This.Title := ""
This.Controls := []
This.Handles := []
This.Index := 0
}
UpdateSettings( obj := "" , UpdateGraphics := 0 ){
local k , v
if( IsObject( obj ) )
for k, v in obj
This[ k ] := obj[ k ]
( This.X = "Center" ) ? ( This.X := ( A_ScreenWidth - This.W ) / 2 )
( This.Y = "Center" ) ? ( This.Y := ( A_ScreenHeight - This.H ) / 2 )
if( UpdateGraphics ){
This._DestroyWindowsGraphics()
This._CreateWindowGraphics()
}
}
_CreateWindow(){
local hwnd
Gui , New, % " +LastFound +E0x80000 hwndhwnd -Caption " This.Options
PopUpWindow.Index++
This.Index := PopUpWindow.Index
PopUpWindow.Windows[ PopUpWindow.Index ] := This
This.Hwnd := hwnd
PopUpWindow.Handles[ hwnd ] := PopUpWindow.Index
if( This.GdipStartUp && !PopUpWindow.pToken )
PopUpWindow.pToken := GDIP_STARTUP()
}
_DestroyWindowsGraphics(){
Gdip_DeleteGraphics( This.G )
SelectObject( This.hdc , This.obm )
DeleteObject( This.hbm )
DeleteDC( This.hdc )
}
_CreateWindowGraphics(){
This.hbm := CreateDIBSection( This.W , This.H )
This.hdc := CreateCompatibleDC()
This.obm := SelectObject( This.hdc , This.hbm )
This.G := Gdip_GraphicsFromHDC( This.hdc )
Gdip_SetSmoothingMode( This.G , This.Smoothing )
}
ShowWindow( Title := "" ){
Gui , % This.Hwnd ":Show", % "x" This.X " y" This.Y " w" This.W " h" This.H " NA", % Title
}
HideWindow(){
Gui , % This.Hwnd ":Hide",
}
UpdateWindow( alpha := 255 ){
UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.W , This.H , alpha )
}
ClearWindow( AutoUpdate := 0 ){
Gdip_GraphicsClear( This.G )
if( Autoupdate )
This.UpdateWindow()
}
DrawBitmap( pBitmap , obj , dispose := 1 , AutoUpdate := 0 ){
Gdip_DrawImage( This.G , pBitmap , obj.X , obj.Y , obj.W , obj.H )
if( dispose )
Gdip_DisposeImage( pBitmap )
if( Autoupdate )
This.UpdateWindow()
}
PaintBackground( color := "0xFF000000" , AutoUpdate := 0 ){
if( isObject( color ) ){
Brush := Gdip_BrushCreateSolid( ( color.HasKey( "Color" ) ) ? ( color.Color ) : ( "0xFF000000" ) )
if( color.Haskey( "Round" ) )
Gdip_FillRoundedRectangle( This.G , Brush , color.X , color.Y , color.W , color.H , color.Round )
else
Gdip_FillRectangle( This.G , Brush , color.X , color.Y , color.W , color.H )
}else{
Brush := Gdip_BrushCreateSolid( color )
Gdip_FillRectangle( This.G , Brush , -1 , -1 , This.W + 2 , This.H + 2 )
}
Gdip_DeleteBrush( Brush )
if( AutoUpdate )
This.UpdateWindow()
}
DeleteWindow( GDIPShutdown := 0 ){
Gui, % This.Hwnd ":Destroy"
SelectObject( This.hdc , This.obm )
DeleteObject( This.hbm )
DeleteDC( This.hdc )
Gdip_DeleteGraphics( This.G )
hwnd := This.Hwnd
for k, v in PopUpWindow.Windows[ Hwnd ]
This[k] := ""
PopUpWindow.Windows[ Hwnd ] := ""
if( GDIPShutdown ){
Gdip_Shutdown( PopUpWindow.pToken )
PopUpWindow.pToken := ""
}
}
}
;**************************************************************************************************
;**************************************************************************************************
;**************************************************************************************************
DrawText( G , x , y , text , color , width , height , options := " Center vCenter Bold s12 " , type := "comic Sans MS" ){
Brush := Gdip_BrushCreateSolid( color ) , Gdip_TextToGraphics( G , text , options " c" brush " x" x " y" y , type , width , height ) , Gdip_DeleteBrush( Brush )
}
FillCircle( G , x , y , color := "0xFFFF0000" , width := 30 , height := "" ){
local Brush
if( !height )
Brush := Gdip_BrushCreateSolid( color ) , Gdip_FillEllipse( G , Brush , x , y , width , width ) , Gdip_DeleteBrush( Brush )
else
Brush := Gdip_BrushCreateSolid( color ) , Gdip_FillEllipse( G , Brush , x , y , width , height ) , Gdip_DeleteBrush( Brush )
}
Random( Min := 0 , Max := 100 ){
local out
Random, out , Min , Max
return out
}
How to add new tabs
Each tab has a number of properties that are customizable by you.
You can set these properties and add a new tab like this, but you can also set the defaults for a number of the values directly in the menu code.
Code: Select all
obj := {}
obj.Position := 1
obj.Color := "0xFF00FF00"
obj.Text := "Tab 1"
obj.FontType := "Segoe UI"
obj.FontSize := 16
obj.FontOptions := "Center vCenter Bold NoWrap Underline"
obj.FontColor := "0xFF000000"
POS_Control.AddNewTab( obj.Position , obj )
Code: Select all
POS_Control.AddNewTab( 1 , { Color: "0xFF00FF00" , Text: "Tab`n1" } ) ;The 1 is the position to put the tab in the grid ( i.e. you can have gaps between tab buttons )
Adding new buttons is pretty much the same as adding a new tab, but when you add a new button you assign it a label to call when it is pressed and tell it which tab you want the new button to be related to.
Here is the longhand way to add a new button.
Code: Select all
obj := {}
obj.Tab := 1 ;The tab to assign this button to
obj.Position := 5 ;The position to place this button in
obj.Label := "TestLabel" ;The label to call when the button is pressed
obj.Color := "0xFF22262a" ;The color of the button in hex ( alpha-red-green-blue / FF-FF-FF-FF )
obj.Text := "Button 5" ;The text to display on the button
obj.FontType := "Segoe UI" ;The font type to use.
obj.FontColor := "0xFFFFFF" ;The color for the text
obj.FontSize := 18 ;The size of the text
obj.FontOptions := "Center vCenter Bold NoWrap Underline" ;The font options to use
POS_Control.AddNewButton( obj.Tab , obj.Position , obj )
Code: Select all
POS_Control.AddNewButton( 1 , 5 , { Color: "0xFF00FF00" , Text: "Tab`n1" , Label: "TestLabel" })
To show the menu you simply call the draw functions for the two windows like this.
Code: Select all
POS_Control.DrawTabWindow() ;Draw the tabs window
POS_Control.DrawButtonWindow() ;Draw the buttons window
Code: Select all
POS_Control.TabWindow.ClearWindow( 1 ) ;Clear the tab window ( hide it )
POS_Control.ButtonWindow.ClearWindow( 1 ) ;Clear the button window ( hide it )
You can set up a simple hotkey to toggle the menu when you want.
Here it is with Shift + RButton to toggle.
Code: Select all
+RButton::
if( !Tog := !Tog ){
POS_Control.DrawTabWindow()
POS_Control.DrawButtonWindow()
}else{
POS_Control.TabWindow.ClearWindow( 1 )
POS_Control.ButtonWindow.ClearWindow( 1 )
}
return
Code: Select all
;****************************************************************************************************************************************************************************
#Include gdip.ahk
#Include Menu Script.ahk
;****************************************************************************************************************************************************************************
#SingleInstance, Force
SetBatchLines, -1
;**************************************************************************************************
;**************************************************************************************************
MyTabs := []
colors := [ "A333AB" , "CF5410" , "96AEFE" , "A8497F" , "3FF668" , "2A1DE1" , "139190" , "DBCE1A" , "673B50" , "B47892" , "6381C2" , "1BDB6F" , "EFA30D" , "796CF5" , "48B1F3" , "D4B410" , "689E55" , "922032" , "A742F0" , "75F944" ]
Loop, 15 {
MyTabs[ A_Index ] := {}
MyTabs[ A_Index ].Position := A_Index
MyTabs[ A_Index ].Color := "0xFF" colors[ Random( 1 , colors.Length() ) ]
MyTabs[ A_Index ].Text := "Tab`n" A_Index
MyTabs[ A_Index ].Fontsize := 18
MyTabs[ A_Index ].Buttons := []
index := A_Index
Loop, 50 {
MyTabs[ index ].Buttons[ A_Index ] := {}
MyTabs[ index ].Buttons[ A_Index ].Position := A_Index
MyTabs[ index ].Buttons[ A_Index ].Color := "0xFF" colors[ Random( 1 , colors.Length() ) ]
MyTabs[ index ].Buttons[ A_Index ].Text := "Tab: " index "`nButton: " A_Index
}
}
;**************************************************************************************************
;**************************************************************************************************
Loop, % MyTabs.Length() {
POS_Control.AddNewTab( MyTabs[ A_Index ].Position , MyTabs[ A_Index ] )
index := A_Index
Loop, % MyTabs[ A_Index ].Buttons.Length(){
POS_Control.AddNewButton( MyTabs[ index ].Position , MyTabs[ index ].Buttons[ A_Index ].Position , MyTabs[ index ].Buttons[ A_Index ] )
}
}
;**************************************************************************************************
;**************************************************************************************************
POS_Control.DrawTabWindow()
POS_Control.DrawButtonWindow()
return
*Esc::ExitApp
+RButton::
if( !Tog := !Tog ){
POS_Control.DrawTabWindow()
POS_Control.DrawButtonWindow()
}else{
POS_Control.TabWindow.ClearWindow( 1 )
POS_Control.ButtonWindow.ClearWindow( 1 )
}
return
When you press your buttons you are going to want something to happen. To make this so you will need to tell your button which label to call
for example: "TextLabel".
You can either have all buttons call the same label and then sort things out by using the tab and button info to direct the output, or you can have each button call up its own label.
This label when called shows the current tab and the button that was pressed.
Code: Select all
TestLabel:
ToolTip, % "Tab: " POS_Control.TabSelectedTab "`nButton: " POS_Control.ButtonActiveTab
return
All the the colors used in the menu are customizable. To edit the colors you will need to go into the POS_Control class and find the Setup() function and find / change these values.
Code: Select all
;Tab window colors.
This.TabBackgroundColor := "0xFF62666a"
This.TabMoveAllButton_Color := "0xFF3399cc"
This.TabMoveButton_Color := This.TabMoveAllButton_Color
This.TabDisplayArea_Color := "0xfff0f0f0"
This.TabUPButton_Color := This.TabMoveAllButton_Color
This.TabDownButton_Color := This.TabMoveAllButton_Color
This.TabResizeButton_Color := "0xFFFFFF00"
This.TabControlBackgroundColor := "0xFF22262a"
;Button window colors
This.ButtonMoveAllButton_Color := "0xFF3377aa"
This.ButtonMoveButton_Color := This.ButtonMoveAllButton_Color
This.ButtonDisplayArea_Color := "0xFF22262a"
This.ButtonUPButton_Color := This.ButtonMoveAllButton_Color
This.ButtonDownButton_Color := This.ButtonMoveAllButton_Color
This.ButtonResizeButton_Color := "0xFFFFFF00"
This.ButtonControlBackgroundColor := "0xFF22262a"
You can change the size of the tabs and the buttons by using this code before you draw the window.
Code: Select all
POS_Control.TabWidth := 180
POS_Control.TabHeight := 60
POS_Control.ButtonWidth := 40
POS_Control.ButtonHeight := 40
.
How to add icons
[/code]
.
You can add icons to the tabs and buttons by either passing a B64 string or a pBitmap when you add the control.
B64 example.
Code: Select all
QuickIcon60x60 := "iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABdaSURBVGhD1VtncFzXeSVFUqzo2AUW2AostmBRF9t7Q++NYO8djVViFU3SalYJJUuyWEFTVLFkmaJV7DjxxI5/OM4kk1+ZlMlM2kzajJNJnEycNifne8AuF9CSoizL5c6cuQ/vvX3vnvv1ex8Wfc6tnIgRB4kvEF8hfmcBZgi5dpyQe43Er1WTAQvBHxL4GfGnxJNEE/Er2QoJkdCfELkIfBb8AyGa8Ssh+RWEEP0XItdgU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v/CWxOJy6cEHxuUQLI0+d8HyckF2SSzycqelqyJy0SJQ8z2vNmQdWWmjmd4/Etvgxyk2FLOgS6ESE0WDHNdywU6pJ8ytl6tra19mH//SjUTB3eekvgrHucc/IOCz/gJJ+b7dIoD/PsXYqeftUkRcoT4kDb3Z8Q9J4Hkfszrf00p/pAmIsV6lPgc2qJF/w/cksUlfRqv8wAAAABJRU5ErkJggg=="
obj := {}
obj.Color := "0xFFFFFF00"
obj.Text := "1"
obj.B64 := QuickIcon60x60
POS_Control.AddNewTab( 1 , obj )
Code: Select all
obj := {}
obj.Color := "0xFFFFFF00"
obj.Text := "1"
obj.pBitmap := GDIP_CreateBitmapFromFile( pathToFile )
POS_Control.AddNewTab( 1 , obj )