PDA

View Full Version : myfundialog test



largo_winch
21-11-2011, 22:07
I will check another approach to create a test-dialog with an own control. my first post I've deleted.

largo_winch
23-11-2011, 12:31
I have an idea to create an own "control", but how to translate or parse this one to thinbasic is still a problem, but I will find a way to manage after having done some experiments ;)

fundialog test example:


' Empty GUI script created on 11-21-2011, 11-22-2011 11:07.13, 16:58:26 by largo_winch (ThinAIR)

Module "myfundialog2"
Uses "console"

%btn = 1001

Dim res As Long
Dim abc, test As Long, hDlgs as long
DIM lstyle as long, lexstyle as long
Dim strx as string


PrintL "test myfundialog"

PrintL "test"

test = MsgBox 0, "fundialog: " + fundialog("simple test dialog",10,10,300,400)

ButtonControl(hDlgs, 100, "testME", 50,50,120,40,100)

PrintL "waitkey"

WaitKey



this example works for an own "dialog" with having new title and size for dialog window frame. "fundialog2.dll" I include in zip file too.

I will explore more about this topic, even there is no feedback or interest for that, but I can imagine why there isn't big interests ;)

bye largo

largo_winch
23-11-2011, 12:35
next one. this could be the idea of a background to create a control. the "control" must be defined with own function and "add" and "button" function separately too. I will see if there's a change to make it as a chapter for learning about module handling and parsing. it's not very important to get feedback anymore here for this topic, as there wasn't any answer about this interesting stuff ;)


' Empty GUI script created on 11-23-2011 11:07:42 by (ThinAIR)

Uses "console", "UI"

Function TBMain () As Long
Local hDlg As Long
Local mystyle As Long
Local mytest As Long
Local strx As String

strx = "my push Button!"
mytest = pushButton(hDlg,100,100,250,350,strx, mystyle)

End Function

Sub PushButton( ByVal cid As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByRef caption As String, _
ByVal styles As Long )
styles = 0
MsgBox 0, "test my pushbutton"

'Controls( cid, x, y, cx, cy, caption, 0, "BUTTON", _
' %BS_PUSHBUTTON Or styles )
End Sub



after that it may be possible to create command something like "newControl" with fictive (pseudo code) code :


'Declaration
SUB NewCONTROL ( _
parent AS CONTROL, _
text AS STRING, _
left AS INTEGER, _
top AS INTEGER, _
width AS INTEGER, _
height AS INTEGER _
)

END SUB


addendum:

1) Controls are basic building blocks of a windows application.


CreateWindow(TEXT("STATIC"), lyrics,
WS_CHILD | WS_VISIBLE | SS_LEFT,
20, 20, 300, 230,
hwnd, (HMENU) 1, NULL, NULL)

Here we create the static control. We display text. It is aligned to the left.

2) Static control:
"Button"

A button is a simple control. It has a text label. It is used to trigger an action.

bye, largo

zak
23-11-2011, 16:04
Hi Largo
have you seen the Eros post and example thinBasic_FreePascalExample.zip‎ here:
http://www.thinbasic.com/community/showthread.php?11479-It-works-for-me.
about making modules in freepascal/Lazarus/delphi
i think you are using powerbasic in making the dll.
i will use Lazarus to make something simple.

regards

largo_winch
23-11-2011, 19:15
may be I have constructed a "control", thinbasic gives value "1" as return value, so that's good I am thinking.


' Empty GUI script created on 11-21-2011, 11-22-2011 11:07.13, 16:58:26 by largo_winch (ThinAIR)

Module "myfundialog2c"
Uses "console"

#INCLUDE "equates.inc"

%btn = 101
%IDBUTTON = 102

Dim res As Long
Dim abc, test As Long, hDlg As Long
Dim lstyle As Long, lexstyle As Long, myInst As Long
Dim strx As String, b As Long

PrintL "test myfundialog"

PrintL "test"
lstyle = %WS_CHILD Or %WS_VISIBLE Or %WS_TABSTOP Or %BS_FLAT Or %BS_PUSHBUTTON

test = MsgBox 0, "fundialog: " + fundialog("simple test dialog",10,10,300,400)

abc = MsgBox 0, "myControl: " + myControl(0, "BUTTON","", lstyle, 40,40,60,24, _
hDlg,%IDBUTTON,myInst )

MsgBox 0, "control: " + Str$(abc) 'ok = "1"
PrintL "control: " + Str$(abc) 'ok = "1"

PrintL "waitkey"

WaitKey



I only have to pack the "control" and the dialog together to show the button on dialog example. that's perhaps the task for next days.

in this example I am only using "console" and "myfundialog2c", there's no "UI" to see

@zak, thanks for feedback and your link, no I didn't have a look at this topic yet, I don't know freepascal or lazarus. wish you good luck for building your own module and if eros has done a lot of important and basically work for embedding that into thinbasic, I am sure that this is a lot of fun for you to program your own example in future days.

bye, largo