I want to learn control programming from [Ground-UP]
-
- Posts: 27
- Joined: Jun 17, 2012 10:16
I want to learn control programming from [Ground-UP]
I wanna learn control programming like buttons,txtbox,combobox,progressbar,etc... from ground-up without using any lib,etc.....So can anyone guide me where to go.......please help me..
-
- Posts: 3955
- Joined: Jan 01, 2009 7:03
- Location: Australia
Re: I want to learn control programming from [Ground-UP]
Professional programmers don't waste time reinventing the wheel. Is it just a case of academic curiosity that you wish to understand how they work?HACK3R ADI wrote:I wanna learn control programming like buttons,txtbox,combobox,progressbar,etc... from ground-up without using any lib,etc.....So can anyone guide me where to go.......please help me..
A GUI is a MAJOR project which is the reason programmers use the libraries used by the operating system's Graphic User Interface. Everything has to work together and it is perfect for object orientated programming techniques. If I wanted, needed, a GUI environment for a project I would use a library or another language like Java, Visual Basic etc.
A simple example might be implementing a button but it is not part of a proper GUI environment.
Code: Select all
screenres 640,480,32
dim as integer mx,my,mb,ox,oy 'mouse variables
dim shared as uinteger ink,paper
ink = rgb(0,0,0) 'black ink
paper = rgb(255,255,255) 'white paper
dim as integer exitFlag 'flag to end program loop set by exit button
type BUTTON
as integer x
as integer y
as integer w
as integer h
as uinteger fg 'forground color
as uinteger bg 'background color
as string t
end type
dim shared as BUTTON btnExit
'initialize button data
btnExit.x = 320
btnExit.y = 240
btnExit.w = 71
btnExit.h = 31
btnExit.fg = rgb(10,10,10)
btnExit.bg = rgb(255,255,0) 'yellow
btnExit.t = " EXIT "
sub drawButtons()
line (btnExit.x,btnExit.y)-(btnExit.x+btnExit.w,btnExit.y+btnExit.h),btnExit.bg,bf
line (btnExit.x,btnExit.y)-(btnExit.x+btnExit.w,btnExit.y+btnExit.h),btnExit.fg,b
draw string (btnExit.x+12,btnExit.y+13),btnExit.t
end sub
sub update()
color ink,paper 'black ink, white paper
screenlock
cls 'implement colors clear screen
drawButtons()
screenunlock
end sub
'initialize
exitFlag = 0
'wait for button event
do
update() 'update display
getmouse mx,my,,mb
ox = mx
oy = my
if mb = 1 then
'check for mouse down over something event
if mx>btnExit.x and my>btnExit.y and mx<btnExit.x+btnExit.w and my<btnExit.y+btnExit.h then
exitFlag = 1
end if
end if
loop until exitFlag = 1
Re: I want to learn control programming from [Ground-UP]
I’m assuming that you mean API controls in an API window, and that “from ground-up” means creating everything at run time with CreateWindowEX. A very simple example:
Sorry, no time to comment the code.
Code: Select all
''=============================================================================
#define WIN_INCLUDEALL
#include "windows.bi"
#define IDC_BUTTON 101
''=============================================================================
function WindowProc( byval hWnd as HWND,_
byval uMsg as uint,_
byval wParam as WPARAM,_
byval lParam as LPARAM ) as LRESULT
static as HWND hwndButton
dim as PAINTSTRUCT ps
dim as integer style
#define BASE_STYLE WS_CHILD or WS_VISIBLE
select case uMsg
case WM_CREATE
style = BASE_STYLE or WS_TABSTOP or BS_PUSHBUTTON
hwndButton = CreateWindowEx( 0, _
"BUTTON", _
"OK", _
style, _
58, _
70, _
80, _
30, _
hWnd, _
cast(HMENU,IDC_BUTTON), _
0, _
0 )
case WM_COMMAND
select case loword(wParam)
case IDCANCEL
PostQuitMessage( null )
case IDC_BUTTON
PostQuitMessage( null )
end select
case WM_PAINT
BeginPaint( hWnd, @ps )
EndPaint( hWnd, @ps )
case WM_CLOSE
PostQuitMessage( null )
case WM_DESTROY
DestroyWindow( hWnd )
case else
return DefWindowProc( hWnd, uMsg, wParam, lParam )
end select
return 0
end function
''=============================================================================
'' Start of implicit main.
''=============================================================================
dim as HWND hWnd
dim as MSG wMsg
dim as integer wx, wy, nWidth, nHeight
dim as WNDCLASSEX wcx
dim as string className = "test_class"
with wcx
.cbSize = sizeof( WNDCLASSEX )
.style = CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNWINDOW
.lpfnWndProc = cast(WNDPROC,@WindowProc)
.cbClsExtra = null
.cbWndExtra = null
.hInstance = GetModuleHandle( null )
.hbrBackground = cast(HBRUSH,COLOR_WINDOW + 1)
.lpszMenuName = null
.lpszClassName = strptr( className )
.hIcon = LoadIcon( null, IDI_APPLICATION )
.hCursor = LoadCursor ( null, IDC_ARROW )
.hIconSm = 0
end with
RegisterClassEx( @wcx )
nWidth = 200
nHeight = 150
wx = (GetSystemMetrics( SM_CXSCREEN ) / 2) - nWidth / 2
wy = (GetSystemMetrics( SM_CYSCREEN ) / 2) - nHeight / 2
hWnd = CreateWindowEx( WS_EX_OVERLAPPEDWINDOW,_
strptr( className ),_
"Test",_
WS_OVERLAPPED or WS_SYSMENU,_
wx, wy, nWidth, nHeight,_
null, null,_
GetModuleHandle( null ), null )
ShowWindow( hWnd, SW_SHOWNORMAL )
UpdateWindow( hWnd )
do until( GetMessage( @wMsg, null, 0, 0 ) <= 0 )
if IsDialogMessage( hWnd, @wMsg ) = 0 then
TranslateMessage( @wMsg )
DispatchMessage( @wMsg )
end if
loop
''=============================================================================
-
- Posts: 27
- Joined: Jun 17, 2012 10:16
Re: I want to learn control programming from [Ground-UP]
Sir,I prefer to do everything from scratch and I also wanted to learn How/How To/WHY I always wanted to learn new thing and I wanted ti do it from extreme ground-up even without using line() of FB
And Thank you to all for giving your precious time to my post
And Thank you to all for giving your precious time to my post
Re: I want to learn control programming from [Ground-UP]
A GUI from the ground up will take you about 10 years. Rather than starting with FB you should consider beginning with assembler. FB is really a runtime library, so assembler is much more fundamental than FB.HACK3R ADI wrote:So can anyone guide me where to go.......please help me..
There are many people who can help you use FB, but you can only be helped if you can ask a specific question.
-
- Posts: 27
- Joined: Jun 17, 2012 10:16
Re: I want to learn control programming from [Ground-UP]
@Richard
Sir I asked It as a curiosity of Mie and I can spend 10 years to learn it to clear my curiosity
A quote:
"Easy way is easy but it will mislead you in your way and difficult way is full of thorn but it will get you to your destination"
Sir I asked It as a curiosity of Mie and I can spend 10 years to learn it to clear my curiosity
A quote:
"Easy way is easy but it will mislead you in your way and difficult way is full of thorn but it will get you to your destination"
Re: I want to learn control programming from [Ground-UP]
Start by reading MSDN? IIRC for the core sets there used to be CHMs available, that makes it easy to read (and reread) everything in order.HACK3R ADI wrote:Sir,I prefer to do everything from scratch and I also wanted to learn How/How To/WHY I always wanted to learn new thing and I wanted ti do it from extreme ground-up even without using line() of FB
-
- Posts: 27
- Joined: Jun 17, 2012 10:16
Re: I want to learn control programming from [Ground-UP]
MSDN have nothing of my interest and it's win32 based
Re: I want to learn control programming from [Ground-UP]
if you want to write a GUI system yourself then:
1. learn to code
2. write code, games, programs
3. learn about UIs, systems and managing projects
4. write GUI system
or.. since you're just going to skip to 4 anyway
just write your GUI with whatever tools you feel like
it doesnt look like anyone here can help you with that, except to start with a rectangle and some user input
get fonts working... all that jazz
im sure googling for "graphical user interfaces" can tell you all about what you want to do
1. learn to code
2. write code, games, programs
3. learn about UIs, systems and managing projects
4. write GUI system
or.. since you're just going to skip to 4 anyway
just write your GUI with whatever tools you feel like
it doesnt look like anyone here can help you with that, except to start with a rectangle and some user input
get fonts working... all that jazz
im sure googling for "graphical user interfaces" can tell you all about what you want to do
Re: I want to learn control programming from [Ground-UP]
@ HACK3R ADI
Do you have a question about FreeBASIC ?
Do you have a question about FreeBASIC ?
-
- Posts: 165
- Joined: Oct 16, 2009 14:44
- Location: Jodhpur, Rajputana, Empire of Aryavart
- Contact:
Re: I want to learn control programming from [Ground-UP]
Want to learn how to drive before you can speak or even walk? Just imagine what would happen if a baby is given Ferrari in mid road.
Everything have steps. You are targeting one thing -"I want to make my own!" and this shows your impatience. I have never seen such a person with any success(even a near success) in anything.
lol. Just imagine what what have happened if your teacher tried to teach you how to write a great book before you can even write 'A' properly. You have to be the master of C(well if you can do this, assembler like FASM would be best). Have to master win32. Learn the internals of you OS well.
And I have no aim to just condemn you. You are just at a wrong place. FASM forum would be a better place- http://board.flatassembler.net/
Everything have steps. You are targeting one thing -"I want to make my own!" and this shows your impatience. I have never seen such a person with any success(even a near success) in anything.
lol. Just imagine what what have happened if your teacher tried to teach you how to write a great book before you can even write 'A' properly. You have to be the master of C(well if you can do this, assembler like FASM would be best). Have to master win32. Learn the internals of you OS well.
And I have no aim to just condemn you. You are just at a wrong place. FASM forum would be a better place- http://board.flatassembler.net/
Re: I want to learn control programming from [Ground-UP]
You can find many examples here:
Code: Select all
http://qbasicgui.datacomponents.net/
-
- Posts: 8642
- Joined: May 28, 2005 3:28
- Contact:
Re: I want to learn control programming from [Ground-UP]
Hello kot,Kot wrote:http://qbasicgui.datacomponents.net/
I never saw this big collection of home made text and gfx gui's before.
After viewing 50+ screen's feeling like in the 80th's year. :-)
Thanks for sharing.
Joshy
Re: I want to learn control programming from [Ground-UP]
The best way to go , is start from scratch and invent your own API..
Windows API uses tons of builtin variables and function calls , that you have to learn about..
And then when you look on the Microsoft MSDN Library web-site, it leads you round in circles without explaining what you entered as a question.
Microsoft doesn't want anyone programming, unless they first went to a multi-thousand dollar Micorosoft programming course.
According to Borland each control needs to be self aware and know how to draw itself and return a click or keypress to the parent and then the parent decides what to do with the message.( from the Borland turbo C++ 3.0 manual )
Good luck !!!
I'm also working on developing a full-blown API..
If you want to make games:
http://www.toymaker.info/Games/html/windows_api.html
Otherwise:
http://www.relisoft.com/win32/index.htm
There are still a lot of unanswered questions , and you have to port the examples to FB from C or C++ or VB
Windows API uses tons of builtin variables and function calls , that you have to learn about..
And then when you look on the Microsoft MSDN Library web-site, it leads you round in circles without explaining what you entered as a question.
Microsoft doesn't want anyone programming, unless they first went to a multi-thousand dollar Micorosoft programming course.
According to Borland each control needs to be self aware and know how to draw itself and return a click or keypress to the parent and then the parent decides what to do with the message.( from the Borland turbo C++ 3.0 manual )
Good luck !!!
I'm also working on developing a full-blown API..
If you want to make games:
http://www.toymaker.info/Games/html/windows_api.html
Otherwise:
http://www.relisoft.com/win32/index.htm
There are still a lot of unanswered questions , and you have to port the examples to FB from C or C++ or VB
Re: I want to learn control programming from [Ground-UP]
If you want to start writing Windows apps, here is a link to the SDK for windows 8
http://msdn.microsoft.com/en-us/windows ... p/hh852363
I think the headers would need to be converted to FreeBasic..
The Software Developers Kit (SDK) should have all the help files you need..
http://msdn.microsoft.com/en-us/windows ... p/hh852363
I think the headers would need to be converted to FreeBasic..
The Software Developers Kit (SDK) should have all the help files you need..