Hallo all,
I'm searching for a nice GUI module for my IR Remote Control project.
Or did i have mist something in my search on this forum or wiki?
Does someone has that and already planning to share that with us all?
thanks
in search for a nice GUI libery?
Moderators: David Barker, Jerry Messina
I've started building up my own library for a GUI, but it's not finished and not quite ready for publishing properly yet. However, the very basics of it are here to get you going if nobody else has anything better.
When I develop this further, maybe I'll post it as a finished article on the wiki.
On a more ambitious note, one day I would like to devlop a plugin to help generate the images and code for a GUI - but that's for another day.
Code: Select all
{
********************************************************************************
* Name : GUI.bas *
* Author : S Wright *
* Notice : Copyright (c) 2006 S Wright *
* : All Rights Reserved *
* Date : 31/12/2006 *
* Version : 1.0 *
* Notes : *
* : *
********************************************************************************
}
Module GUI
#option GLCD_MODEL = S1D13700
Include "Images.bas"
Include "GLCD.bas"
Include "Graphics.bas"
Include "Fonts.bas"
{
********************************************************************************
* Name : RectangleR (PRIVATE) *
* Purpose : *
********************************************************************************
}
Public Sub RectangleR(px1, py1, pWidth, pHeight As TXY)
Dim px2, py2 As TXY
px2 = px1 + pWidth - 1
py2 = py1 + pHeight - 1
Line(px1 + 2, py1, px2 - 2, py1)
Line(px2, py1 + 2, px2, py2 - 2)
Line(px1 + 2, py2, px2 - 2, py2)
Line(px1, py1 + 2, px1, py2 - 2)
SetPixel(px1 + 1, py1 + 1)
SetPixel(px2 - 1, py1 + 1)
SetPixel(px1 + 1, py2 - 1)
SetPixel(px2 - 1, py2 - 1)
End Sub
{
********************************************************************************
* Name : Button (PRIVATE) *
* Purpose : *
********************************************************************************
}
Public Sub Button(px1, py1, pWidth As TXY)
Dim px2, py2 As TXY
px2 = px1 + pWidth - 1
py2 = py1 + 32 - 1
RectangleR(px1, py1, pWidth, 32)
Line(px1 + 4, py2 - 2, px2 - 4, py2 - 2)
Line(px2 - 2, py1 + 4, px2 - 2, py2 - 4)
SetPixel(px2 - 2, py2 - 2)
SetPixel(px2 - 3, py2 - 3)
End Sub
{
********************************************************************************
* Name : Button (PRIVATE) *
* Purpose : *
********************************************************************************
}
Public Sub Button(px1, py1, pWidth As TXY, pStr As String)
SetFont(fntSmall)
TextAlign = taCenter
Button(px1, py1, pWidth)
WriteStr((px1 + (pWidth / 2) - 1), py1 + 8, pStr)
End Sub
{
********************************************************************************
* Name : Button (PRIVATE) *
* Purpose : *
********************************************************************************
}
Public Sub Button(px1, py1, pWidth As TXY, pChar As Char)
SetFont(fntLarge)
TextAlign = taCenter
Button(px1, py1, pWidth)
WriteStr((px1 + (pWidth / 2) - 1), py1 + 8, pChar)
End Sub
{
********************************************************************************
* Name : Button (PRIVATE) *
* Purpose : *
********************************************************************************
}
Public Sub Button(px1, py1, pWidth As TXY, ByRefConst pImage() As Byte)
Dim Width As Byte
Button(px1, py1, pWidth)
Width = pImage(1)
GLCD.SetImage((px1 + (pWidth / 2) - (Width / 2) - 1), py1 + 4, pImage)
End Sub
{
********************************************************************************
* Name : ScollBar (PRIVATE) *
* Purpose : *
********************************************************************************
}
Public Sub ScollBar(pValue As Word, pMax As Word)
Dim YPos As Byte
YPos = 97
Repeat
SetImage(283, YPos, ScrollBarRow1)
Inc(YPos)
SetImage(283, YPos, ScrollBarRow2)
Inc(YPos)
Until YPos = 167
SetImage(283, YPos, ScrollBarRow1)
SetPixel(283, 96)
SetPixel(315, 96)
SetPixel(283, 168)
SetPixel(315, 168)
Pen.Mode = pmCopy
SetImage(283, 97 + ((61 * pValue) / pMax), ScrollBarSlider)
End Sub
On a more ambitious note, one day I would like to devlop a plugin to help generate the images and code for a GUI - but that's for another day.
For a font that has all equal width characters I use Fonts for Programmers
Columns and rows align.
Norm
Columns and rows align.
Norm