in search for a nice GUI libery?

Coding and general discussion relating to user created compiler modules

Moderators: David Barker, Jerry Messina

Post Reply
NielsNL
Posts: 18
Joined: Tue Aug 05, 2008 6:40 pm

in search for a nice GUI libery?

Post by NielsNL » Thu Aug 07, 2008 6:41 am

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

User avatar
Steven
BETA Tester
Posts: 406
Joined: Tue Oct 03, 2006 8:32 pm
Location: Cumbria, UK

Post by Steven » Thu Aug 07, 2008 10:45 am

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.

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
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.

NielsNL
Posts: 18
Joined: Tue Aug 05, 2008 6:40 pm

Post by NielsNL » Thu Aug 07, 2008 9:08 pm

Thank you steven,
I have made some changes so the buttons can now be pressed and hav made them some smaller.

I was wondering what font did you use as fonts.bas?

Later this week i will add my gui file here

normnet
Posts: 55
Joined: Mon Jan 01, 2007 6:32 pm

Post by normnet » Thu Aug 07, 2008 10:44 pm

For a font that has all equal width characters I use Fonts for Programmers

Columns and rows align.

Norm

Post Reply