April 26, 2025, 12:06:00 am
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
Forever
Login with username, password and session length
News
: Want to see a specific Tutorial? ASK!
Home
Help
Search
Arcade
Links
Staff List
Login
Register
Minifly
Weekly Qbasic and Qb64 Lesson Topics
>
Forum
>
DEMOS
>
QB64 Programs You Are Proud Of.
>
Minifly
Pages: [
1
]
« previous
next »
Print
Author
Topic: Minifly (Read 822 times)
659_minifly
Guest
Minifly
«
on:
June 05, 2011, 01:21:00 pm »
FIRST PART
Sub can be use in the user part of the programme.
Elements cannot have the same Number
EditBox
EditBox Number_editbox,Xstart,Ystart,Lenght,Height
EditBox 15,40,20,100,20
Text
Text in the editBox,Button,Grid
Text Element_Number,"String",Font,Caracter Heigh
Text is trucated automaticly to be include of the size of the element
Color_Bckg background color of the element
Color_Bckg Element_Number,Red color,Green color,Blue color
Color_Bckg 15,51,204,255
Bouton 'Button
Bouton Element_Number,Xstart,Ystart,Lenght,Height
Bouton 20,440,50,15,20
Text 20,chr$(215),"lucon.ttf",12
Grid
Grid Element_Number,Number of column,Number of line,Cell length,Cell Height,Column header 1=yes 0=no, Line header 1=yes 0=no,
X pos of the grid,Y pos of the grid
Grid 100,4,6,100,25,1,1,45,130
It is possible to make a selection for each element with the mouse
in the near futur will be
Color_text
Combo_list
Include text with mouse selection of the element
and possibility to make calculation from cells(spread sheet)
Please could you tel me if something going wrong .Thanks you by advance
Register this file as "Declare.bi"
Code:
Defint i,j,k,m
Dim Shared Screenmode As Integer
Dim Shared x As Integer
Dim Shared Y As Integer
Dim Shared depx As Integer
Dim Shared depy As Integer
Dim Shared Num_Grid As Integer
Dim Shared Nombre_Colonne As Integer
Dim Shared Nombre_Ligne As Integer
Dim Shared Longueur As Integer
Dim Shared Hauteur As Integer
Dim Shared Redimen As Integer
Dim Shared Entete_Colonne As Integer
Dim Shared Entete_Ligne As Integer
Dim Shared Position_X As Integer
Dim Shared Position_Y As Integer
Dim Shared EditB_Numero As Integer
Dim Shared EditB_X_Pos As Integer
Dim Shared EditB_Y_Pos As Integer
Dim Shared EditB_Longueur As Integer
Dim Shared EditB_Hauteur As Integer
Dim Shared EditB_Chaine As String
Dim Shared Last_Indice As Integer
Dim Shared Numero_Element As Integer
Dim Shared Flag_DefGrid As Integer
Dim Shared Flag_Element As Integer
Dim Shared B_Type As Integer
Dim Shared B_Num As Integer
Dim Shared X_Deb As Integer
Dim Shared X_Fin As Integer
Dim Shared Y_Deb As Integer
Dim Shared Y_Fin As Integer
Dim Shared Sauve_Indice As Integer
Dim Shared Flag_end_Loop As Integer
Dim Shared Text_Edit As String
DIM SHARED KeyDown(127) AS LONG
DIM SHARED Redt As Integer
Dim SHARED Redb As Integer
Dim SHARED Greent As Integer
Dim SHARED Greenb As Integer
DIM SHARED Bluet As Integer
Dim SHARED Blueb As Integer
DiM SHARED Flag_color As Integer
Dim SHARED Flag_Focus As Integer
DiM SHARED Previous_Bnum As Integer
DIM SHARED Save_bnum As INTEGER
DIM SHARED scrn AS LONG, px AS INTEGER, py AS INTEGER, pflag AS INTEGER
'----------------------- Array declaration ------------------------------'
'' Dim Shared Tbl_Grid(900,10) As Integer
Redim _Preserve Shared Tbl_Consult(500,5) As Integer
Redim _Preserve Shared Tbl_Attrib(500,11) As string
Last_indice=0
Flag_Element=0
Flag_end_Loop=0
Flag_color=0
Previous_Bnum=0
Flag_Focus=0
Declare Sub curseur()
Declare Sub Leftmouse()
Declare Sub Rightmouse()
Declare Sub Grid(Num_Grid,Nombre_Colonne,Nombre_Ligne,Longueur,Hauteur,Entete_Colonne,Entete_Ligne,Position_X,Position_Y)
Declare Sub Panneau ()
Declare Sub EditBox(EditB_Numero,EditB_Longueur,EditB_Hauteur,EditB_X_Pos,EditB_Y_Pos)
Declare Sub Bouton (Bouton_Numero,Bouton_Longueur,Bouton_Hauteur,Bouton_X_Pos,Bouton_Y_Pos)
Declare Sub Bouton_click (Bouton_Numero,Bouton_Longueur,Bouton_Hauteur,Bouton_X_Pos,Bouton_Y_Pos)
Declare Sub Bouton_inactif (Bouton_Numero,Bouton_Longueur,Bouton_Hauteur,Bouton_X_Pos,Bouton_Y_Pos)
Declare Sub Element_Position ()
Declare Sub Focus_Element()
Declare Sub Focus_EditBox (B_num As Integer)
Declare Sub Press_Bouton ()
Declare Sub Text (B_num As Integer,Text_edit As String,Fonte As string,Hauteur As integer)
Declare Sub Get_Tbl_Position(B_Num)
Declare Sub Draw_EditBox (EditB_Numero,EditB_Longueur,EditB_Hauteur,EditB_X_Pos,EditB_Y_Pos)
Declare Sub Draw_Bouton (Bouton_Numero As Integer,Bouton_X_Pos As Integer,Bouton_Y_Pos As Integer,Bouton_Longueur As Integer,Bouton_Hauteur As Integer)
Declare Sub Draw_Bouton_inactif (Bouton_Numero As Integer,Bouton_X_Pos As Integer,Bouton_Y_Pos As Integer,Bouton_Longueur As Integer,Bouton_Hauteur As Integer)
Declare Sub Horiz_Scroll_TxT(B_Num As Integer,Text_edit As String)
Declare Sub Color_Text (B_num As Integer, Redt As Integer,Greent As Integer,Bluet As Integer)
Declare Sub Color_Bckg (B_num As Integer, Redb As Integer,Greenb As Integer,Blueb As Integer)
Declare Sub ColorBckg (B_num As Integer, Redb As Integer,Greenb As Integer,Blueb As Integer)
Declare Sub Bnum_Coord(B_num as integer)
Declare Sub choice_key (B_num)
DECLARE FUNCTION ScanKey%(code%)
Screenmode = 13 'Screenmode to be used
CustomWindow = _NEWIMAGE(960, 600, 256)
SCREEN Screenmode
SCREEN CustomWindow
' SCREEN _NEWIMAGE(960, 600, 32)
_TITLE "My first program"
COLOR 7,15
cls
Position_X= Position_X+40
Position_Y= Position_Y+90
Cls
Line (0,0) - (960,600),_RGB(220, 220, 220),Bf ' Full Screen in light Grey
Register this file as what name you want i took "Grid_user.bas"
Code:
'$INCLUDE:'Declare.bi'
'================================= User Programm Definition ============================'
'========================================================================================'
'' Sub can be use
' EditBox Number = 15'
' X position of the edit box = 40'
' Y position of the edit box = 20'
' Lengh of the edit box = 100'
' Hieght of the edit box = 20'
EditBox 15,40,20,100,20
' Editbox Number = 15'
' String to be writte in the editBox'
' Font for the string = Cour.ttf'
' Height of the caracter = 12'
Text 15,"The red duck in the tree is not a duck he is a cherry","Cour.ttf",12
EditBox 24,40,50,400,20
Text 24,"Numero","Cour.TTF",12
Color_Bckg 15,51,204,255
Color_Bckg 24,51,255,50
' Bouton number = 20'
' X position of the Bouton = 440
' Y position of the Bouton = 50'
' Lenght of the Bouton = 15'
' Hieght of the Bouton = 20'
Bouton 20,440,50,15,20
text 20,chr$(215),"lucon.ttf",12
Bouton 21,550,50,16,16
Text 21,"G","lucon.ttf",12
Bouton 22,580,50,16,16
Text 22,"/","Cour.TTF",12
Bouton 23,610,50,110,20
Text 23," Cancel","Cour.TTF",12
' Grid Number = 100'
' Number of column = 4'
' Number of lines = 6'
' Lengh of the Cell = 100'
' High of the Cell = 25'
' Column header 0 = none 1= yes'
' Line header 0 = none 1 = yes'
' X position of the grig'
' Y position of the grid'
Grid 100,4,6,100,25,1,1,45,130
Grid 200,1,6,100,25,1,0,500,130
Grid 300,2,6,100,25,0,1,645,130
Grid 400,8,6,100,25,0,0,45,300
Text 114," TOTAL","Cour.TTF",12
sleep 1
for i%=124 to 164 step 10
Color_Bckg i%,255,0,0
sleep 1
next i%
Text 154,"125.25","Cour.TTF",12
Text 164,"125.25","Cour.TTF",10
Text 144,"99.99","Cour.TTF",12
'================================= Programm Definition =================================='
'========================================================================================'
Do
curseur
LOOP
system
End
'$INCLUDE:'SubRoutines.bi'
«
Last Edit: June 28, 2011, 09:19:15 am by 659_minifly
»
Report Spam
Logged
Unknown
Guest
Re: Minifly grid editbox button
«
Reply #1
on:
June 05, 2011, 05:00:47 pm »
NEXT PART
this one as "SubRoutines.bi"
Code:
'=============================================================================
' Sub for selecting the cels
'=============================================================================
Sub curseur ()
tm$ = " Column = ### Row = ### Valeur X = ### Valeur Y = ### Button1 = ## Button2 = ## Button3 = ##"
Do WHILE _MOUSEINPUT
X = _MOUSEX: Y = _MOUSEY
Element_Position
' ----- These doenst' Work for the moment ---------------'
'' If _MOUSEBUTTON(1) Then Leftmouse
'' If _MOUSEBUTTON(1) Then Element_Position
If _MOUSEBUTTON(2) Then rightmouse
color _rgb(0,0,0),_rgb(127,127,127)
Locate 43, 11
_printmode _FILLBACKGROUND
Print USING tm$;depx;depY;X;Y; _MOUSEBUTTON(1); _MOUSEBUTTON(2); _MOUSEBUTTON(3)
Loop
End Sub
'=============================================================================
' Activ cells with mouse button left
'=============================================================================
Sub Leftmouse()
If X >Position_X And X < (Nombre_Colonne*Longueur+Position_x) and Y > Position_Y And Y<(Nombre_Ligne*Hauteur+Position_Y) Then
depx=int((X-Position_X)/longueur)
depY=int((Y-position_y)/hauteur)
' Entete colonne ligne et colonne
If Entete_Colonne=1 And Entete_Ligne=1 Then
If depx>0 And depy>0 Then
line ((depx*Longueur+Position_x)+1,(depy*hauteur+position_y)+1)- (((depx+1)*Longueur+Position_x)-4,((depy+1)*hauteur+position_y)-4),1,bf
_delay .09
line ((depx*Longueur+Position_x)+1,(depy*hauteur+position_y)+1)- (((depx+1)*Longueur+Position_x)-4,((depy+1)*hauteur+position_y)-4),15,bf
end If
end If
' Entete colonne uniquement'
If Entete_Colonne=1 And Entete_Ligne=0 Then
' Remise a l origine couleur 0
If depY>0 Then
line ((depx*Longueur+Position_x)+2,(depy*hauteur+position_y)+2)- (((depx+1)*Longueur+Position_x)-2,((depy+1)*hauteur+position_y)-2),1,bf
_delay .09
line ((depx*Longueur+Position_x)+2,(depy*hauteur+position_y)+2)- (((depx+1)*Longueur+Position_x)-2,((depy+1)*hauteur+position_y)-2),15,bf
end If
end If
' Entete ligne uniquement'
If Entete_Colonne=0 And Entete_Ligne=1 Then
If depX>0 Then
line ((depx*Longueur+Position_x)+1,(depy*hauteur+position_y)+1)- (((depx+1)*Longueur+Position_x)-2,((depy+1)*hauteur+position_y)-2),1,bf
_delay .09
line ((depx*Longueur+Position_x)+1,(depy*hauteur+position_y)+1)- (((depx+1)*Longueur+Position_x)-2,((depy+1)*hauteur+position_y)-2),15,bf
end If
end If
' Aucune entete
If Entete_Colonne=0 And Entete_Ligne=0 Then
line ((depx*Longueur+Position_x)+1,(depy*hauteur+position_y)+1)- (((depx+1)*Longueur+Position_x)-3,((depy+1)*hauteur+position_y)-3),1,bf
_delay .09
line ((depx*Longueur+Position_x)+1,(depy*hauteur+position_y)+1)- (((depx+1)*Longueur+Position_x)-3,((depy+1)*hauteur+position_y)-3),15,bf
end If
end If
' -------------------------------- Header column And Row ------------------------------'
If Entete_Colonne=1 And Entete_Ligne=1 Then
If depy=0 And depx>0 Then
line ((depx*Longueur+Position_x),((depy+1)*hauteur+position_y))- (((depx+1)*Longueur+Position_x),(Nombre_Ligne*hauteur+position_y)),1,bf
_delay .09
line ((depx*Longueur+Position_x),((depy+1)*hauteur+position_y))- (((depx+1)*Longueur+Position_x),(Nombre_Ligne*hauteur+position_y)),15,bf
end If
end If
If Entete_Colonne=1 And Entete_Ligne=1 Then
If depx=0 And depy>0 Then
line ((longueur+Position_x),(depy*hauteur+position_y))- ((Nombre_Colonne*Longueur+Position_x),((depy+1)*Hauteur+position_y)),1,bf
_delay .09
line ((Longueur+Position_x),(depy*hauteur+position_y))- ((Nombre_Colonne*Longueur+Position_x),((depy+1)*Hauteur+position_y)),15,bf
end If
end If
' Entete Ligne'
If Entete_Colonne=0 And Entete_Ligne=1 Then
If depX=0 Then
line ((longueur+Position_x),(depy*hauteur+position_y))- ((Nombre_Colonne*Longueur+Position_x),((depy+1)*Hauteur+position_y)),1,bf
_delay .09
line ((Longueur+Position_x),(depy*hauteur+position_y))- ((Nombre_Colonne*Longueur+Position_x),((depy+1)*Hauteur+position_y)),15,bf
end If
end If
' Entete colonne'
If Entete_Colonne=1 And Entete_Ligne=0 Then
If depY=0 Then
line ((depx*Longueur+Position_x),((depy+1)*hauteur+position_y))- (((depx+1)*Longueur+Position_x),(Nombre_Ligne*hauteur+position_y)),1,bf
_delay .09
line ((depx*Longueur+Position_x),((depy+1)*hauteur+position_y))- (((depx+1)*Longueur+Position_x),(Nombre_Ligne*hauteur+position_y)),15,bf
end If
end If
End Sub
'=============================================================================
' Activ popup Menu with mouse button right
'=============================================================================
Sub rightmouse()
Line (X,Y)-(x+125,(y+155)),8,BF
Line (X,Y)-(x+120,(y+150)),7,BF
Color 0,7
_PRINTSTRING (x+5,y+10),"Height"
_PRINTSTRING (x+5,y+30),"Lenght"
_PRINTSTRING (x+5,y+50),"Delet"
_PRINTSTRING (x+5,y+70),"Insert"
_PRINTSTRING (x+5,y+90),"Move"
End Sub
' ============================================================================
' Sub for drawing the grid
'=============================================================================
Sub Grid(Num_Grid As Integer,Nombre_Colonne As Integer,Nombre_Ligne As Integer,Longueur As Integer,Hauteur As Integer,Entete_Colonne As Integer,Entete_Ligne As Integer,Position_X As Integer,Position_Y As Integer)
Flag_DefGrid=1
COLOR 15,7
Defint i,j
PositionX=Position_X
PositionY=Position_Y
Num_Grid=Num_Grid+10
For I=1 To Nombre_Ligne Step 1
For J=1 To Nombre_Colonne Step 1
If Entete_Colonne=0 And Entete_Ligne=1 And J=1 Then
bouton Num_Grid+j ,PositionX,PositionY,Longueur-3,Hauteur-3
Else
If Entete_Colonne=1 And Entete_Ligne=0 And I=1 Then
bouton Num_Grid+j ,PositionX,PositionY,Longueur-3,Hauteur-3
Else
If Entete_Colonne=1 And Entete_Ligne=1 Then
If I=1 And J>=1 Then
bouton Num_Grid+j ,PositionX,PositionY,Longueur-3,Hauteur-3
End If
If I>1 And J=1 Then
bouton Num_Grid+j ,PositionX,PositionY,Longueur-3,Hauteur-3
End If
If I>1 And j>1 Then
editBox Num_Grid+j ,PositionX,PositionY,Longueur-3,Hauteur-3
End If
Else
editBox Num_Grid+j ,PositionX,PositionY,Longueur-3,Hauteur-3
End If
End If
End If
Positionx=Positionx+Longueur
num_grid=Num_grid
Next J
Positionx=Position_X
Positiony=Positiony+Hauteur
num_grid=Num_grid+10
Next I
Flag_DefGrid=0
Num_Grid=0
End Sub
'' ---------------------------------- EditBOX -------------------------------
Sub EditBox (B_Num As Integer,EditB_X_Pos As Integer,EditB_Y_Pos As Integer,EditB_Longueur As Integer,EditB_Hauteur As Integer)
Last_Indice=Last_Indice+1
If Flag_DefGrid=1 Then
Tbl_Consult(Last_Indice,0) = 0
Else
Tbl_Consult(Last_Indice,0) = 1
End If
Tbl_Consult(Last_Indice,1) = B_Num
Tbl_Consult(Last_Indice,2) = EditB_X_Pos
Tbl_Consult(Last_Indice,3) = EditB_Y_Pos
Tbl_Consult(Last_Indice,4) = EditB_X_Pos+EditB_Longueur
Tbl_Consult(Last_Indice,5) = EditB_Hauteur+EditB_Y_Pos
Tbl_Attrib(B_Num,0)=""
Tbl_Attrib(B_Num,1)=""
Tbl_Attrib(B_Num,2)=""
Tbl_Attrib(B_Num,3)=""
Tbl_Attrib(B_Num,4)=""
Tbl_Attrib(B_Num,5)=str$(255)
Tbl_Attrib(B_Num,6)=str$(255)
Tbl_Attrib(B_Num,7)=str$(255)
Tbl_Attrib(B_Num,8)=str$(0)
Tbl_Attrib(B_Num,9)=str$(0)
Tbl_Attrib(B_Num,10)=str$(0)
redb=255
greenb=255
blueb=255
Draw_editbox B_Num,EditB_X_Pos ,EditB_Y_Pos ,EditB_X_Pos+EditB_Longueur,EditB_Y_Pos+EditB_Hauteur
end sub
'---------------------------------- Record Normal Button ------------------
Sub Bouton (Bouton_Numero As Integer,Bouton_X_Pos As Integer,Bouton_Y_Pos As Integer,Bouton_Longueur As Integer,Bouton_Hauteur As Integer)
Last_Indice=Last_Indice+1
If Flag_defGrid=1 Then
Tbl_Consult(Last_Indice,0) = 0
Else
Tbl_Consult(Last_Indice,0) = 2
end If
Tbl_Consult(Last_Indice,1) = Bouton_Numero
Tbl_Consult(Last_Indice,2) = Bouton_X_Pos
Tbl_Consult(Last_Indice,3) = Bouton_Y_Pos
Tbl_Consult(Last_Indice,4) = Bouton_X_Pos+Bouton_Longueur
Tbl_Consult(Last_Indice,5) = Bouton_Hauteur+Bouton_Y_Pos
Draw_Bouton Bouton_Numero, Bouton_X_Pos, Bouton_Y_Pos, Bouton_Longueur, Bouton_Hauteur
end sub
'---------------------------------- Button Click -----------------------------
Sub Bouton_inactif (Bouton_Numero As Integer,Bouton_X_Pos As Integer,Bouton_Y_Pos As Integer,Bouton_Longueur As Integer,Bouton_Hauteur As Integer)
Last_Indice=Last_Indice+1
Tbl_Consult(Last_Indice,0) = 3
Tbl_Consult(Last_Indice,1) = Bouton_Numero
Tbl_Consult(Last_Indice,2) = Bouton_X_Pos
Tbl_Consult(Last_Indice,3) = Bouton_Y_Pos
Tbl_Consult(Last_Indice,4) = Bouton_X_Pos+Bouton_Longueur
Tbl_Consult(Last_Indice,5) = Bouton_Hauteur+Bouton_Y_Pos
Draw_Bouton_inactif Bouton_Numero, Bouton_X_Pos, Bouton_Y_Pos, Bouton_Longueur, Bouton_Hauteur
End Sub
'------------------------------------------------------------------------------
Sub get_tbl_position(B_Num As Integer)
For j=1 To Last_Indice
B_Type=Tbl_Consult(j,0)
Numero_element=Tbl_Consult(j,1)
X_deb=Tbl_Consult(j,2)
X_fin=Tbl_Consult(j,4)
Y_deb=Tbl_Consult(j,3)
Y_Fin=Tbl_Consult(j,5)
If Numero_Element=B_Num Then Exit Sub
Next j
End Sub
'-------------------------------Draw elements ---------------------------------
Sub Draw_EditBox (B_Num As Integer,EditB_X_Pos As Integer,EditB_Y_Pos As Integer,EditB_Longueur As Integer,EditB_Hauteur As Integer)
if flag_focus=1 then
String_View$=Tbl_Attrib(B_Num,2)
_PRINTMODE _KEEPBACKGROUND
_printstring (X_Deb,Y_Fin-15),String_View$
Line (EditB_X_Pos,EditB_Y_Pos) - (EditB_Longueur,EditB_Hauteur),_RGB(255, 255, 210),Bf
ELSE
R%=val(Tbl_Attrib(B_Num,5))
G%=Val(Tbl_Attrib(B_Num,6))
B%=Val(Tbl_Attrib(B_Num,7))
Line (EditB_X_Pos,EditB_Y_Pos) - (EditB_Longueur,EditB_Hauteur),_RGB(R%, G%, B%),Bf
String_View$=Tbl_Attrib(B_Num,2)
_PRINTMODE _KEEPBACKGROUND
_printstring (X_Deb,Y_Fin-15),String_View$
end if
Line (EditB_X_Pos-2,EditB_Y_Pos-2) - (EditB_X_Pos-2,EditB_Hauteur+2), _RGB(127, 127, 127)
Line (EditB_X_Pos-2,EditB_Y_Pos-2) - (EditB_Longueur+2,EditB_Y_Pos-2), _RGB(127, 127, 127)
Line (EditB_Longueur+2,EditB_Y_Pos-2) - (EditB_Longueur+2,EditB_Hauteur+2), _RGB(255,255,255)
Line (EditB_X_Pos-2,EditB_Hauteur+2) - (EditB_Longueur+2,EditB_Hauteur+2), _RGB(255, 255, 255)
Flag_color=0
End Sub
Sub Draw_Bouton (Bouton_Numero As Integer,Bouton_X_Pos As Integer,Bouton_Y_Pos As Integer,Bouton_Longueur As Integer,Bouton_Hauteur As Integer)
Line (Bouton_X_Pos,Bouton_Y_Pos) - (Bouton_X_Pos+Bouton_Longueur,Bouton_Hauteur+Bouton_Y_Pos),_RGB(200,200,200),Bf
Line (Bouton_X_Pos-2,Bouton_Y_Pos-2) - (Bouton_X_Pos+Bouton_Longueur+2,Bouton_Y_Pos-2), _RGB(255, 255, 255)
Line (Bouton_X_Pos-2,Bouton_Hauteur+Bouton_Y_Pos+2) - (Bouton_X_Pos-2,Bouton_Y_Pos-2), _RGB(255, 255, 255)
Line (Bouton_X_Pos-2,Bouton_Y_Pos+Bouton_Hauteur+2) - (Bouton_X_Pos+Bouton_Longueur+2,Bouton_Y_Pos+Bouton_Hauteur+2), _RGB(127,127,127)
Line (Bouton_X_Pos+Bouton_Longueur+2,Bouton_Hauteur+Bouton_Y_Pos+2) - (Bouton_X_Pos+Bouton_Longueur+2,Bouton_Y_Pos-2), _RGB(127, 127, 127)
End Sub
Sub Draw_Bouton_inactif (Bouton_Numero As Integer,Bouton_X_Pos As Integer,Bouton_Y_Pos As Integer,Bouton_Longueur As Integer,Bouton_Hauteur As Integer)
Line (Bouton_X_Pos,Bouton_Y_Pos) - (Bouton_X_Pos+Bouton_Longueur,Bouton_Hauteur+Bouton_Y_Pos),_RGB(150,150,150),Bf
Line (Bouton_X_Pos-2,Bouton_Y_Pos-2) - (Bouton_X_Pos+Bouton_Longueur+2,Bouton_Y_Pos-2), _RGB(127, 127, 127)
Line (Bouton_X_Pos-2,Bouton_Hauteur+Bouton_Y_Pos+2) - (Bouton_X_Pos-2,Bouton_Y_Pos-2), _RGB(127, 127, 127)
Line (Bouton_X_Pos-2,Bouton_Y_Pos+Bouton_Hauteur+2) - (Bouton_X_Pos+Bouton_Longueur+2,Bouton_Y_Pos+Bouton_Hauteur+2), _RGB(255,255,255)
Line (Bouton_X_Pos+Bouton_Longueur+2,Bouton_Hauteur+Bouton_Y_Pos+2) - (Bouton_X_Pos+Bouton_Longueur+2,Bouton_Y_Pos-2), _RGB(255,255,255)
End Sub
Sub Bouton_click (Bouton_Numero As Integer,Bouton_X_Pos As Integer,Bouton_Y_Pos As Integer,Bouton_Longueur As Integer,Bouton_Hauteur As Integer)
Line (Bouton_X_Pos,Bouton_Y_Pos) - (Bouton_Longueur,Bouton_Hauteur),_RGB(150,150,150),Bf
Line (Bouton_X_Pos,Bouton_Y_Pos) - (Bouton_Longueur,Bouton_Y_Pos), _RGB(127, 127, 127)
Line (Bouton_X_Pos,Bouton_Y_Pos) - (Bouton_X_Pos,Bouton_Hauteur), _RGB(127, 127, 127)
Line (Bouton_X_Pos,Bouton_Hauteur) - (Bouton_Longueur,Bouton_Hauteur), _RGB(255,255,255)
Line (Bouton_Longueur,Bouton_Hauteur) - (Bouton_Longueur,Bouton_Y_Pos), _RGB(255,255,255)
End Sub
'---------------------------- Find Element position -------------------------
sub Element_Position ()
For i=1 To Last_Indice
B_Type=Tbl_Consult(i,0)
B_num=Tbl_Consult(i,1)
X_deb=Tbl_Consult(i,2)
X_fin=Tbl_Consult(i,4)
Y_deb=Tbl_Consult(i,3)
Y_Fin=Tbl_Consult(i,5)
If X>X_deb And x<X_fin And Y>Y_deb And Y<Y_Fin Then
Sauve_Indice%=i%
If _MOUSEBUTTON(1) Then Focus_Element
'' Focus_Element
Locate 45,11
Print B_Type,b_num,X_deb,Y_deb,X_fin,Y_Fin
End If
Next i
End Sub
Sub Bnum_Coord(B_num as integer)
For i=1 To Last_Indice
if Tbl_Consult(i,1) =B_num then
'' B_Type=Tbl_Consult(i,0)
X_deb=Tbl_Consult(i,2)
X_fin=Tbl_Consult(i,4)
Y_deb=Tbl_Consult(i,3)
Y_Fin=Tbl_Consult(i,5)
exit sub
end if
Next i
end sub
' ----------------------------- Focus on an element ---------------------------
sub Focus_Element()
If B_Type=0 Then Focus_EditBox b_num
If B_Type=1 Then Focus_EditBox b_num
If B_Type=2 Then Press_Bouton
End Sub
«
Last Edit: December 08, 2011, 06:26:04 pm by GarrisonRicketson
»
Report Spam
Logged
Unknown
Guest
Re: Minifly grid editbox button
«
Reply #2
on:
June 05, 2011, 05:02:08 pm »
LAST PART
Include this part at the bottom of the previous one
Code:
'----------------------------- Focus Editbox ------------------------------------'
sub Focus_editBox(B_Num As Integer)
Save_bnum=B_num
if Flag_Focus=0 then
Flag_Focus=1
Draw_editbox B_num,X_deb+2,Y_deb+2,X_fin-3,Y_Fin-2
String_View$=Tbl_Attrib(B_Num,2)
_PRINTMODE _KEEPBACKGROUND
_printstring (X_Deb,Y_Fin-15),String_View$
choice_key B_num
end if
if Flag_Focus=1 and Previous_Bnum<>0 then
Flag_Focus=0
B_num = Previous_Bnum
Bnum_Coord B_Num
Draw_editbox B_num,X_deb+2,Y_deb+2,X_fin-3,Y_Fin-2
end if
Previous_Bnum=Save_bnum
Flag_Focus=0
End Sub
'------------------------------------------------------------------------------'
Sub choice_key (B_num)
keycode& = _KEYHIT
print keycode&
'' i% = INP(&H60) 'read keyboard states
' DO
' IF ScanKey%(75) THEN scroll_Left
' IF ScanKey%(77) THEN scroll_Right
' POKE 1050, PEEK(1052) 'clear keyboard buffer
' 'LOOP UNTIL ScanKey%(1)
' LOOP UNTIL Flag_end_Loop=1
' 'zerocodes% = ScanKey%(0) 'reset all array values to zero for next part of program
end sub
Sub ColorBckg (B_num As Integer, Redb As Integer,Greenb As Integer,Blueb As Integer)
String_View$=Tbl_Attrib(B_Num,2)
Draw_editbox B_num,X_deb+2,Y_deb+2,X_fin-3,Y_Fin-5
_PRINTMODE _KEEPBACKGROUND
_printstring (X_Deb,Y_Fin-15),String_View$
End Sub
'------------------------------ Click a button ------------------------------
sub Press_Bouton()
bouton_click B_Num,X_deb,Y_deb,X_fin,Y_Fin
'' run "grid_user.exe"
End Sub
'-----------------------------------Manage Horizontal scroll in EditBox--------------------------------------'
Sub Horiz_Scroll_TxT(B_Num as integer,Text_edit as string)
pixel_width% = _FONTWIDTH
Numb_Caracteres% = Len(Text_edit$)
Wide% = X_fin-X_Deb
Num_Carac_Visible% = Wide%/pixel_width%
String_View$ = LEFT$(Text_edit$, Num_Carac_Visible%)
String_Right$ = Right$(Text_edit$,Numb_Caracteres%-Len(String_View$))
String_Left$ = ""
_PRINTMODE _KEEPBACKGROUND
_printstring (X_Deb,Y_Fin-15),String_View$
'Tbl_Attrib(B_Num,0)=Text_edit$
Tbl_Attrib(B_Num,1)=String_Right$
Tbl_Attrib(B_Num,2)=String_View$
Tbl_Attrib(B_Num,3)=String_Left$
End Sub
Sub scroll_Left()
DO: LOOP UNTIL INKEY$ = "" 'flush INKEY$ buffer
LOCATE X_Deb,Y_Fin-15,1,0,8
LOCATE 15, 30
print "fin Loop gauche";
Flag_end_Loop=1
End Sub
Sub scroll_Right()
DO: LOOP UNTIL INKEY$ = "" 'flush INKEY$ buffer
LOCATE 15, 30
print "fin Loop droite";
Flag_end_Loop=1
' sleep 1
' LOCATE 15, 30
' print "---------------"
End Sub
' ----------------------------- Text In EditBox ------------------------------
Sub Text (B_num As Integer,Text_edit As String,Fonte As string,Hauteur As integer)
get_tbl_position(B_Num)
Tbl_Attrib(B_Num,0)=Text_edit
Tbl_Attrib(B_Num,4)=Fonte$
_Font _LOADFONT("C:\windows\fonts\"+Fonte, Hauteur,"MONOSPACE")
pixel_width_String% = _PRINTWIDTH(Text_edit$)
If pixel_width_String%>(X_fin-X_Deb) then
Horiz_Scroll_TxT B_num,Text_edit$
exit sub
end if
status% = _PRINTMODE
_PRINTMODE _KEEPBACKGROUND
_printstring (X_Deb,Y_Fin-15),Text_edit$
Tbl_Attrib(B_Num,2)=Text_edit$
End Sub
Sub Color_Text (B_num As Integer, Redt As Integer,Greent As Integer,Bluet As Integer)
Tbl_Attrib(B_Num,8)=str$(Redt)
Tbl_Attrib(B_Num,9)=str$(Greent)
Tbl_Attrib(B_Num,10)=str$(Bluet)
End Sub
Sub Color_Bckg (B_num As Integer, Redb As Integer,Greenb As Integer,Blueb As Integer)
flag_focus=0
String_View$=Tbl_Attrib(B_Num,2)
Tbl_Attrib(B_Num,5)=STR$(Redb)
Tbl_Attrib(B_Num,6)=STR$(Greenb)
Tbl_Attrib(B_Num,7)=STR$(Blueb)
'' Flag_color=1
Bnum_Coord B_Num
Draw_editbox B_num,X_deb,Y_deb,X_fin,Y_Fin
_PRINTMODE _KEEPBACKGROUND
_printstring (X_Deb,Y_Fin-15),String_View$
End Sub
FUNCTION ScanKey% (scancode%)
STATIC Ready%, keyflags%()
IF NOT Ready% THEN REDIM keyflags%(0 TO 127): Ready% = -1
i% = INP(&H60) 'read keyboard states
IF (i% AND 128) THEN keyflags%(i% XOR 128) = 0
IF (i% AND 128) = 0 THEN keyflags%(i%) = -1
K$ = INKEY$
ScanKey% = keyflags%(scancode%)
IF scancode% = 0 THEN Ready% = 0 'allows program to reset all values to 0 with a REDIM
END FUNCTION
There are 3 files because i use Pspad for editor. I can use simultanously use 3 windows for making the program.
Color syntax and autocompletion i like it.
Some Sub are not in use for the moment ( Under construction )
The RMB give a floating menu but is not install yet.
«
Last Edit: December 08, 2011, 06:26:47 pm by GarrisonRicketson
»
Report Spam
Logged
659_minifly
Guest
Re: Minifly grid editbox button
«
Reply #3
on:
June 05, 2011, 07:24:23 pm »
Understood thanks next i'll will use the drop box
Report Spam
Logged
659_minifly
Guest
Re: Minifly grid editbox button
«
Reply #4
on:
June 12, 2011, 03:38:40 am »
Hi garry
You have some explanations at the begining of the thred.
and you can make your own program after the "user program definition". I put some sample at the begining in that part.
I still working on it. In fact it is a program for creating grid, edit box ,button and make a program for example a record of your telephon's friend. or calculate your daily expens etc...
Report Spam
Logged
659_minifly
Guest
Re: New version
«
Reply #5
on:
June 26, 2011, 02:24:05 pm »
FIRST PART
Sub can be use in the user part of the programme.
Elements cannot have the same Number
Set_EditBox
Set_EditBox Number_editbox,Xstart,Ystart,Lenght,Height
Set_EditBox 15,40,20,100,20
Text
Set_Text in the editBox,Button,Grid
Set_Text Element_Number,"String",Font,Caracter Heigh
Set_Text is trucated automaticly to be include of the size of the element
Set_Color_Bckg background color of the element
Set_Color_Bckg Element_Number,Red color,Green color,Blue color
Set_Color_Bckg 15,51,204,255
Set_color_Text Element_Number,Red color,Green color,Blue color
Bouton 'Button
Set_Bouton Element_Number,Xstart,Ystart,Lenght,Height
Set_Bouton 20,440,50,15,20
Set_Text 20,chr$(215),"lucon.ttf",12
Grid
Set_Grid Element_Number,Number of column,Number of line,Cell length,Cell Height,Column header 1=yes 0=no, Line header 1=yes 0=no,
X pos of the grid,Y pos of the grid
Set_Grid 100,4,6,100,25,1,1,45,130
It is possible to highlight a selection for each element with the mouse with one click, a second click will go into edit mode,
you can input any text inti the cell Key "Enter" to finish.
in the near futur will be
Combo_list
Possibility to make calculation from cells(spread sheet)
Get.... to get information of the componant config
Small problem to insert text into cells with mouse( caret)
Please could you tel me if something going wrong or you want something in it..Thanks you by advance
http://dl.dropbox.com/u/13815488/grid-26-06-2011.bas
Report Spam
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> Useful Information ,Rules,FAQs,LINKS,etc.
===> INTRODUCE Yourself
=> General QB64 Forum
=> MS DOS, FREE DOS, ANY DOS
-----------------------------
QB64 lessons and tutorials,Games
-----------------------------
=> Lesson Disussion
=> Weekly Lesson
=> Games
-----------------------------
TUTORIALS
-----------------------------
=> QB64 Tutorials
=> Text Adventure
=> QBasic Tutorials
=> Other Tutorials
-----------------------------
UNSEENS GDK+SFML Librarys
-----------------------------
=> Discussions on GDK+SFML
=> GDK+SFML Demos, and projects
-----------------------------
DEMOS
-----------------------------
=> Working QB64 Demos
=> QB64 Games
=> QB64 Programs You Are Proud Of.
=> Function + SUB Club
-----------------------------
OFF TOPIC,and Off The wall
-----------------------------
=> OffTopic and Off the Wall
Powered by
EzPortal
Loading...