Oxygen Basic

Programming => Example Code => User Interface => Topic started by: Aurel on September 12, 2011, 11:32:38 AM

Title: WinH
Post by: Aurel on September 12, 2011, 11:32:38 AM
F

Title: Re: WinH
Post by: Peter on September 12, 2011, 12:07:23 PM
Where is  WINH.inc?   :D
Title: Re: WinH
Post by: kryton9 on September 12, 2011, 01:02:22 PM
Very nice start Aurel. Once you have it finished, we can add it to the help file.
Peter has lots of useful code, it is nice to see you making it usable for the rest of us.

I am thinking of making 3 sections:
1. Core Oxygen
2. Structured Programming
3. Object Oriented Programming

I will add these later today and then you can add your help to it when you have time.
Title: Re: WinH
Post by: Peter on September 12, 2011, 03:20:29 PM
top secret!  I show you  in the mean time a better Font.
Code: [Select]
Include "window.h"

SetWindow("Top Secet",800,600,w_1)
sys_mode=4

cls 0xcf8c8c8
SetFont 14,32,0,"symbol"
SetText "This is proper size of...",20, 20,rgb(0,0,200)
SetText "Courier New font -> 10,400,flag-Italic=0",20, 40,rgb(0,0,200)
SetText "Font size start at 14 which is size 8",20, 60,rgb(0,0,200)

SetFont 12,32,0,"Courier New"
SetText "Courier New standard size -> 8,400,flag-Italic=0",20, 100,rgb(0,0,0)

SetFont 13,32,0,"times"
SetText "Times New standard size -> 9,400,flag-Italic=0",20, 120,rgb(200,0,0)

SetFont 14,32,0,""
SetText "Standard New standard size -> 10,400,flag-Italic=0",20, 140,rgb(0,0,200)

SetFont 15,32,0,"system"
SetText "System New standard size -> 11,400,flag-Italic=1",20, 160,rgb(0,140,0)


DoEvents
SwapBuffers
Pause

WinEnd
Title: Re: WinH
Post by: Peter on September 13, 2011, 05:12:21 AM
Great   :D
Title: Re: WinH
Post by: Peter on September 16, 2011, 10:10:44 AM
WNDCLASSEX seems for some reason not to work.
I had this problem earlier and gave up

Try this,
Code: [Select]
Type WNDCLASSEX
 cbSize        as long
 Style         as long
 lpfnwndproc   as long
 cbClsextra    as long
 cbWndExtra    as long
 hInstance     as long
 hIcon         as long
 hIconSm       as long
 hCursor       as long
 hbrBackground as long
 lpszMenuName  as long
 lpszClassName as long
End Type

Type WNDCLASS
 Style         as sys
 lpfnwndproc   as sys
 cbClsextra    as sys
 cbWndExtra    as sys
 hInstance     as sys
 hIcon         as sys
 hCursor       as sys
 hbrBackground as sys
 lpszMenuName  as sys
 lpszClassName as sys
End Type

Type Point
 x as sys
 y as sys
End Type

Type MSG
 hwnd    as sys
 message as sys
 wParam  as sys
 lParam  as sys
 time    as sys
 pt      as sys
 End Type

Type RECT
 Left   as sys
 Top    as sys
 Right  as sys
 Bottom as sys
End Type

% IDI_APPLICATION= 32512
% CS_DBLCLKS     = 8
% SW_NORMAL      = 1
% SW_SHOWDEFAULT = 10
% SW_SHOW        = 5
% CS_VREDRAW     = 1
% CS_HREDRAW     = 2
% CS_OWNDC       = 32
% SM_CXSCREEN    = 0
% SM_CYSCREEN    = 1
% IDI_WINLOGO    = 32517
% IDC_ARROW      = 32512
% WM_CREATE      = 1
% WM_DESTROY     = 2
% WM_PAINT       = 15
% WM_QUIT        = 18
% WM_SIZE        = 5
% WM_MOVE        = 3
% WM_CHAR        = 258
% WM_KEYDOWN     = 256
% WM_KEYUP       = 257  
% WM_MOUSEMOVE   = 512
% WM_MBUTTONDOWN = 519
% WM_LBUTTONDOWN = 513
% WM_RBUTTONDOWN = 516
% WM_LBUTTONUP   = 514
% WM_RBUTTONUP   = 517
% WM_MBUTTONUP   = 520

% WS_OVERLAPPEDWINDOW  = 0x00cf0000
% WS_SYSMENU     = 524288
% WS_OVERLAPPED  = WS_SYSMENU    
% WS_POPUP       = 0x80000000
% WS_DLGFRAME    = 0x400000

% WHITE_BRUSH    = 0
% BLACK_BRUSH    = 4

Declare Function SetTextColor     Lib "gdi32.dll" (ByVal hdc As Long, ByVal crColor As Long) As Long
Declare Function TextOut          Lib "gdi32.dll" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Declare Function DestroyWindow    Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function GetDC            Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function SetBkColor       Lib "gdi32.dll" (ByVal hdc As Long, ByVal crColor As Long) As Long
Declare Function SetBkMode        Lib "gdi32.dll" (ByVal hdc As Long, ByVal nBkMode As Long) As Long
Declare Function CreateSolidBrush Lib "gdi32.dll" (ByVal crColor As Long) As Long
Declare Function GetStockObject   Lib "gdi32.dll" (ByVal nIndex As Long) As Long
Declare Function ReleaseDC        Lib "user32.dll" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Declare Function GetSystemMetrics Lib "user32.dll" (ByVal nIndex As Long) As Long
Declare Function ValidateRect     Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT) As Long
Declare Function InvalidateRect   Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT, ByVal bErase As Long) As Long
Declare Function DefWindowProc    Lib "user32.dll" Alias "DefWindowProcA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function ShowWindow       Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Declare Function CreateWindowEx   Lib "user32.dll" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, ByRef lpParam As Any) As Long
Declare Function PostMessage      Lib "user32.dll" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function DispatchMessage  Lib "user32.dll" Alias "DispatchMessageA" (ByRef lpMsg As MSG) As Long
Declare Function TranslateMessage Lib "user32.dll" (ByRef lpMsg As MSG) As Long
Declare Function GetMessage       Lib "user32.dll" Alias "GetMessageA" (ByRef lpMsg As MSG, ByVal hwnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
Declare Function SendMessage      Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Declare Function MessageBox       Lib "user32.dll" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Declare Function RegisterClass    Lib "user32.dll" Alias "RegisterClassA" (ByRef Class As WNDCLASS) As Long
Declare Function RegisterClassEx  Lib "user32.dll" Alias "RegisterClassExA" (ByRef pcWndClassEx As WNDCLASSEX) As Long
Declare Function LoadCursor       Lib "user32.dll" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As String) As Long
Declare Function LoadIcon         Lib "user32.dll" Alias "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As String) As Long
Declare Function GetCommandLine   Lib "kernel32.dll" Alias "GetCommandLineA" () As String
Declare Function GetModuleHandle  Lib "kernel32.dll" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Declare Function Beep             Lib "kernel32.dll" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer
Declare Function GetPixel         Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Declare Function SetPixel         Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
Declare Function Rectangle        Lib "gdi32.dll" Alias "Rectangle" (ByVal hdc As Long, ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long) As Long
Declare Sub      ExitProcess      Lib "kernel32.dll" (ByVal uExitCode As Long)
Declare Sub      Sleep            Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Declare Sub      PostQuitMessage  Lib "user32.dll" (ByVal nExitCode As Long)

sys wx, wy, ww, wh, scr, inst, sys_hwnd, sys_hdc, caption, style

Dim wdx as WNDCLASSEX
Dim wm  as MSG
String s = "SIMPLE WINDOW"

Function HiWord(sys high) as sys
shr high,16
Return high
End Function

Function LoWord(sys low) as sys
and low,&hFFFF
Return low
End Function

Function WndProc(sys hWnd, wMsg, wParam, lparam) as long callback
iF wMsg = WM_CREATE
'
ElseiF wMsg = WM_PAINT
SetBkMode sys_hdc,1
SetTextColor sys_hdc,255
TextOut sys_hdc,240,200,s,Len(s)
SetTextColor sys_hdc,0x008000
TextOut sys_hdc,240,212,s,Len(s)
ValidateRect hwnd,  0
'
ElseiF wMsg = WM_DESTROY
PostQuitMessage 0
Else
Function = DefWindowProc hWnd,wMsg,wParam,lParam
End iF
End Function

inst = GetModuleHandle 0
wdx.cbSize = sizeof(WNDCLASSEX)
wdx.style  = CS_DBLCLKS
wdx.lpfnWndProc = &WndProc
wdx.cbClsExtra =0
wdx.cbWndExtra =0
wdx.hInstance  = inst
wdx.hIcon=LoadIcon 0,IDI_APPLICATION
wdcx.hIconSm=LoadIcon 0,IDI_APPLICATION        
wdx.hCursor=LoadCursor 0,IDC_ARROW      
wdx.hbrBackground = 1    
wdx.lpszMenuName  = caption
wdx.lpszClassName ="Winx"
RegisterClassEx (@wdx)
scr = GetSystemMetrics SM_CXSCREEN
wx  = (scr - 640) /2
Scr = GetSystemMetrics SM_CYSCREEN
wy  = (scr - 480) /2
sys_hwnd = CreateWindowEx 0, wdx.lpszClassName, caption, style, wx, wy, ww, wh, 0, 0, inst, 0
ShowWindow sys_hwnd, SW_SHOW
sys_hdc = GetDC(sys_hwnd)

While GetMessage &wm,0,0,0
iF wm.message = Wm_Quit
 ReleaseDC sys_hwnd,sys_hdc
 DestroyWindow sys_hwnd
 ExitProcess 0
End iF
TranslateMessage &wm
DispatchMessage  &wm
Wend
Title: Re: WinH
Post by: Peter on September 16, 2011, 10:35:20 AM
Yes, good!  I need double buffer, then I can throw away OpenGl.
Title: Re: WinH
Post by: Charles Pegge on September 16, 2011, 10:47:16 AM
Hi Aurel,

Correction to structure (moving hIconSmall to the end)

Code: OxygenBasic
  1.  
  2.   type WNDCLASSEX
  3.     cbSize        as long
  4.     Style         as long
  5.     lpfnwndproc   as long
  6.     cbClsextra    as long
  7.     cbWndExtra    as long
  8.     hInstance     as long
  9.     hIcon         as long
  10.     hCursor       as long
  11.     hbrBackground as long
  12.     lpszMenuName  as long
  13.     lpszClassName as long
  14.     hIconSm       as long
  15.   end type
  16.  

Also:

lpszClassName and lpszMenuName have been defined as long rather than zString pointers so you will need pass the string pointer to these variables thus:


string ClassName="Winx", MenuName="Menu"

then


wc.lpszClassName=*ClassName
wc.lpszMenuName=*MenuName


I will add RegisterClassEx to MinWin.inc.

Charles
Title: Re: WinH
Post by: Peter on September 16, 2011, 11:42:00 AM
Not any double Buffer here !
This is what I am doing the whole time.

A double buffer alternates its sides, one for mother, one for father.
Title: Re: WinH
Post by: Charles Pegge on May 02, 2012, 12:30:05 AM

Hi Aurel,

To get your program working with the new Oxygen:

wcx.lpszMenuName  = strptr caption
wcx.lpszClassName = strptr "Winx"

This is because these elements have been defined as long in the header, and strptr ensures that a string pointer is always returned.


Code: [Select]
Function SetWindow (byval caption as string ,byval Wx as int,byval Wy as int, byval Ww as int, byval Wh as int, byval wparent as int, byval style as int) as int
inst = GetModuleHandle 0
'wcx.cbSize = sizeof(WNDCLASSEX)
wcx.style = CS_DBLCLKS
wcx.lpfnWndProc = &WndProc
wcx.cbClsExtra =0
wcx.cbWndExtra =0
wcx.hInstance  = inst
wcx.hIcon=LoadIcon 0,IDI_APPLICATION
'wcx.hIconSm=LoadIcon 0,IDI_APPLICATION         
wcx.hCursor=LoadCursor 0,IDC_ARROW       
wcx.hbrBackground =  1   
wcx.lpszMenuName  = strptr caption
wcx.lpszClassName = strptr "Winx"

RegisterClass &wcx

Charles
Title: Re: WinH
Post by: Charles Pegge on May 30, 2012, 07:46:19 AM
Hi Aurel,

Could you post your latest awinh.inc.
The version I have (2 May 2012) is not compatible.

Charles
Title: Re: WinH
Post by: kryton9 on May 30, 2012, 08:30:35 AM
If you guys want, I can create an FTP account for you guys on my webserver, For Peter, Aurel and Charles, this way you can keep all of the latest code that is yours for Oxygen in one place and then Charles could get the files from there and we won't have to go through all the forum posts to get stuff. That is why I don't reply to lot of Peter's and Aurel's posts as my files are always out of date and things just don't run.
Title: Re: WinH
Post by: kryton9 on May 31, 2012, 03:39:16 PM
Here is a screenshot of how it works on my computer Aurel.
Title: Re: WinH
Post by: Charles Pegge on June 01, 2012, 01:33:24 AM

Thanks Aurel :)
Title: Re: WinH
Post by: kryton9 on June 01, 2012, 04:01:59 PM
Nice artwork on the icons Aurel.
Title: Re: WinH
Post by: Charles Pegge on June 09, 2012, 01:00:42 PM
Yes Aurel, with minor alterations:

There is a problem with '&h', so use '0x' instead. I will fix it.

Code: OxygenBasic
  1.  
  2.  
  3. Enum TVGN_FLAGS
  4.     TVGN_ROOT = 0x0
  5.     TVGN_NEXT = 0x1
  6.     TVGN_PREVIOUS = 0x2
  7.     TVGN_PARENT = 0x3
  8.     TVGN_CHILD = 0x4
  9.     TVGN_FIRSTVISIBLE = 0x5
  10.     TVGN_NEXTVISIBLE = 0x6
  11.     TVGN_PREVIOUSVISIBLE = 0x7
  12.     TVGN_DROPHILITE = 0x8
  13.     TVGN_CARET = 0x9
  14.     TVGN_LASTVISIBLE = 0xA
  15. End Enum
  16.  
  17. TVGN_FLAGS t
  18.  
  19. t=TVGN_PREVIOUS
  20.  
  21. print hex t 'result: 2
  22.  
  23.  

Charles
Title: Re: WinH
Post by: kryton9 on June 09, 2012, 03:28:51 PM
I think 0x5 is so much easier to read than &H5.
Title: Re: WinH
Post by: Charles Pegge on June 21, 2012, 01:17:25 PM
Thanks Aurel, I am learning at lot. Windows controls are still a mystery to me.
Title: Re: WinH
Post by: Charles Pegge on June 24, 2012, 04:50:54 PM
Yes that works nicely Aurel. Oxygen compiles to fairly efficient machine code, there are few wasted cycles, which you tend to get in interpreted languages.

Charles
Title: Re: WinH
Post by: JRS on June 24, 2012, 08:56:45 PM
Charles,

Have you run any speed comparison tests between O2 and PowerBASIC? Zale touts hand crafted code generation which sounds more like a sales pitch then a home cooked meal. I'm sure there would be a lot of interest in O2 if the word got out how far along it has come.

BTW: I think your efforts in the Rosetta Code site will pay off in many ways. (tests your code, exposure, ...)


John
Title: Re: WinH
Post by: Charles Pegge on June 25, 2012, 12:04:06 AM

I have not tested recently, John. but I expect the speed is fairly close. The problem with PowerBasic, I feel is that it is well and truly locked into COM, rather than a more generalised OOP model. I suppose the main reason was to provide compatibility with Visual Basic  and continuity for VB programmers.

The Rosetta wiki is a treasure. There are around 500 tasks to choose from and many challenge the capabilities of a languages. I was particularly interested in the OOP and Functional Programming tasks as these paradigms are quites stretching for Basic dialects.

Charles
Title: Re: WinH
Post by: Aurel on September 20, 2012, 12:08:25 PM
And much simpliest..


Title: Re: WinH
Post by: Aurel on October 09, 2012, 02:21:00 PM
Just one test to control two window in one callback function..
Title: Re: WinH
Post by: Aurel on September 05, 2013, 02:37:31 PM
Here is tooltip attempt...
Title: Re: WinH
Post by: kryton9 on September 20, 2013, 06:30:25 PM
Thanks Aurel, will check this out when have I wine or windows working. Playing with Ubuntu this weekend :)
Title: Re: WinH
Post by: JRS on September 20, 2013, 09:45:07 PM
Ok Kent...
I see ...Ubuntu...ha, i never liked this distro.. ::).
I use SliTaz and Slax. ;D

I apologize Aurel. I was unaware of your Linux interest. What application development are you working on under those OS's? Do you have something we can play with? RubinDevX sort of has a nice ring to it.

Title: Re: WinH
Post by: kryton9 on September 20, 2013, 10:50:06 PM
I got 64bit ubuntu to install from ubuntu 32 bit, but not from windows, so that was strange.
Anyways, got wine setup so installed oxygen and here is a screenshot of your winapi controls demo Aurel.

It works perfectly.

I played with slitaz when you first mentioned it a few years ago Aurel, it is nice and fast, but I must say this version of ubuntu I am enjoying and for the first time the unity interface is appealing to me.



X
Title: Re: WinH
Post by: Aurel on September 20, 2013, 10:53:19 PM
Quote
It works perfectly
Of course ....when is created by native api-s and Vine work ok with native api functions.
Title: Re: WinH
Post by: JRS on September 20, 2013, 11:59:35 PM
Quote
Of course ....when is created by native api-s and Vine work ok with native api functions.

True, but it's not genuine Vindows.
Title: Re: WinH
Post by: JRS on September 21, 2013, 12:31:20 AM
If all gooes well i have in plan to create my own fork of SliTaz,
i have one friend here in Croatia who is interested .

Quote from: Aurel thinBasic forum
This is just proof that Linus is selfish and ignorant freak who don't know how to built GUI subsystem inside kernel.

Duh. I get it now. You're a Linux systems developer. That makes your comment on thinBASIC about Linus Torvalds justifiable. Did you and Linus get in an argument over kernel code direction?

I was wondering if you can give me a hand with a problem I'm having on Android Linux? For some unknown reason I'm getting assert errors with the LD BFD trying to compile the cURL extension module. I have tried multiple gcc switches to try and get around it but no luck so far. Do you think this an issue with the linker or something else?

Title: Re: WinH
Post by: JRS on September 21, 2013, 08:31:43 AM
 ;D

I hear the same thing all the time when some kid learns how to root his phone and thinks he is a Linux guru.

Title: Re: WinH
Post by: JRS on September 21, 2013, 09:41:33 AM
Let's digress.

Kent mentioned that he wouldn't be able to look at your stuff right now as his interests this weekend are on Linux. I took that as he was concerned that without his feedback you may lose interest in your project and make everyone else's life miserable again. You took that as an opportunity to expose your limited knowledge of Linux and make a fool of yourself like you did on the thinBasic forum with Eros scolding you for it.

Just so you know, you don't have to ping each thread with your opinions that offer no value to the subject being discussed. We know you're out there and hope you spend more time with the RubinDev project and the members there that need your assistance.

Title: Re: WinH
Post by: JRS on September 21, 2013, 09:54:08 AM
Thank You!

I'm glad we got that worked out.

Title: Re: WinH
Post by: JRS on September 21, 2013, 10:14:16 AM
Quote
Hmmm...what's left...yeah...Listview..ok

Documentation (http://www.oxygenbasic.org/wiki/)

Title: Re: WinH
Post by: JRS on September 21, 2013, 12:38:54 PM
It would be better if you could provide your help in text or HTML format so that it can be merged in with whatever documentation effort O2 takes.

Title: Re: WinH
Post by: kryton9 on September 21, 2013, 11:41:51 PM
I am still planning a program:

Use sqlite3 as database engine, this will store all help information for documentation.
It will have nice forms you just fill in your information.

Then it will ouput html page for each topic formated according to a master css file for uniform style.
And also make a master index page for all of the help.

I working on making the app cross platform to make it usable for anything.

Just haven't figured out the best compiled cross platform setup yet to make it self contained executable
in the three major OS's. Leaning towards freepascal and lazarus developing in Ubuntu.

I wrote Remmer in windows with lazarus, but for the life of me and other good lazarus users we couldn't get it to compile
in linux or apple. So I think developing in linux should prevent such misfortunes hopefully in the future.
Title: Re: WinH
Post by: Peter on September 24, 2013, 10:43:24 AM
Runs!

But it is not  precise for drawing a master piece.
Child Window is no good idea for a drawing program.   

Title: Re: WinH
Post by: Peter on September 24, 2013, 11:34:49 AM
It runs with pwinh something cleaner.  ;D
Title: Re: WinH
Post by: kryton9 on September 25, 2013, 06:03:08 PM
I like that effect, perfect for the upcoming Halloween here in the United States.
Title: Re: WinH
Post by: JRS on April 03, 2014, 12:28:08 PM
Quote
Using awinh is a piece of cacke to create RichEdit based text editor...

I'm confused.

A. cake
B. crap
C. ?
Title: Re: WinH
Post by: Aurel on October 10, 2015, 02:02:20 PM
Well... inspired by Arnold BCX GUI framework i think that winH or called awinh
or whatever you whish deserve that is presented here on forum because it is
very simple and easy to use for GUI application.
I know that is not the best and need some additions but work  :)

here is the first example which show larger version without one small include
file called miniH.inc which contain few drawing functions / nothing special /..

Code: [Select]
$ Filename "simple.exe" ' Oxygen Basic
Include "RTL32.inc"
Include "awinh.inc"
#lookahead
'GLOBALS for drawing to DC /// also caN BE INSIDE INCLUDE FILE // 
INT hdc, hdcMem, hbmMem,   oldBmp, oldBrush, oldPen, oldFont, fColor,bColor
INT textX,textY,hBrush
INT ww,hh
INT win,x=0,y=0,w=400,h=300,wstyle = WS_MINMAXSIZE,
win=SetWindow("Simple GUI App...",x,y,w,h,0,wstyle)
InitDrawing(win)
TextOn(win,100,100, "Hello World from BCX!")

Wait()  'message loop
Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
Select hwnd
Case win
Select wmsg
CASE WM_PAINT
BitBlt(hDC, 0, 0, ww, hh, hdcMem, 0, 0, SRCCOPY)

Case WM_CLOSE
CloseWindow(win)
EndProgram
End Select
End Select
Return Default
End Function
'====================================================
'== NEXT BLOCK OF CODE YOU CAN PUT IN INCLUDE FILE ==
'====================================================
SUB InitDrawing(byval wnd as INT)
'INT ww,hh
''get current size of window
GetSize(wnd,0,0,ww,hh)
'get window DC
hdc=GetDC(wnd)
hdcMem = CreateCompatibleDC(0)
hbmMem = CreateCompatibleBitmap(hdc, ww, hh)
oldBmp = SelectObject( hdcMem, hbmMem )
oldBrush = SelectObject(hdcMem, CreateSolidBrush( RGB(231,223,231)) )
oldPen = SelectObject(hdcMem, CreatePen(PS_SOLID,1,RGB(231,223,231)))
'fill rectangle memDC with brush color
FillRect ( hdcMem,rc, oldBrush)
SetTextColor( hDC,RGB(0,0,0))
SetBkColor( hDC, RGB(231,223,231))
'blit to memDC
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)

ReleaseDC( wnd, hdc)
End SUB

'=================================================
SUB TextColor (wID as INT,byval frontColor as sys)
hdc = GetDC(wID)
sys bColor
fColor=frontColor
bColor = RGB(231,223,231)
SetTextColor( hDC, frontColor)
SetBkColor( hDC, bColor)

BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)

ReleaseDC( wID, hdc)

End SUB
'=================================================
Sub TextOn( int wnd,sys x, y, string txt)
'INT ww,hh
hdc=GetDC(wnd)
GetSize(wnd,0,0,ww,hh)
TextOut sys_hdc,x,y,txt,Len(txt)
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC(wnd,Hdc)
End Sub

'=================================================
SUB LineXY (wID as INT,Lx as INT,Ly as INT,Lx1 as INT,Ly1 as INT)

hdc = GetDC(wID)
GetSize(wID,0,0,ww,hh)
SelectObject(hdc, CreatePen(PS_SOLID,1,fColor))

MoveToEx hdc,Lx,Ly,Byval 0
LineTo hdc,Lx1,Ly1

BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wID, hdc)
End SUB
'=================================================
SUB Pset (wID as int , px as int ,py as int)
hdc = GetDC(wID)
'GetSize(wID,0,0,ww,hh)
SetPixel ( hdc, px, py, fColor)

BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)

ReleaseDC( wID, hdc)

End SUB
'//////////////////////////////////////////////
SUB CleanUp
DeleteDC(hdcMem)
DeleteObject(SelectObject(hdcMem, oldBrush))
DeleteObject(SelectObject(hdcMem, oldPen))
DeleteObject(SelectObject(hdcMem, oldBmp))
End SUB
Title: Re: WinH
Post by: Aurel on October 10, 2015, 02:07:38 PM
then ...here is a version with minh.inc file...

Code: [Select]
$ Filename "simple2.exe" ' Oxygen Basic
Include "RTL32.inc"
Include "awinh.inc"
Include "minih.inc"
#lookahead
INT win,x=0,y=0,w=400,h=300,wstyle = WS_MINMAXSIZE,
win=SetWindow("Simple GUI App...",x,y,w,h,0,wstyle)
InitDrawing(win)
TextOn(win,100,100, "Hello World from Oxygen!")

Wait()  'message loop
Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
Select hwnd
Case win
Select wmsg
CASE WM_PAINT
BitBlt(hDC, 0, 0, ww, hh, hdcMem, 0, 0, SRCCOPY)

Case WM_CLOSE
CloseWindow(win)
EndProgram
End Select
End Select
Return Default
End Function

..so as you can see  ... SIMPLE ...  :)

[attachment deleted by admin]
Title: Re: WinH
Post by: Aurel on October 10, 2015, 02:11:15 PM
..of course you can add some colors to text..  :D

Code: [Select]
$ Filename "simple2.exe" ' Oxygen Basic
Include "RTL32.inc"
Include "awinh.inc"
Include "minih.inc"
#lookahead
INT win,x=0,y=0,w=400,h=300,wstyle = WS_MINMAXSIZE,
win=SetWindow("Simple GUI App...",x,y,w,h,0,wstyle)
InitDrawing(win)
TextColor (win,RGB(0,120,220))
TextOn(win,100,100, "Hello World from OXYGEN!")

Wait()  'message loop
Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
Select hwnd
Case win
Select wmsg
CASE WM_PAINT
BitBlt(hDC, 0, 0, ww, hh, hdcMem, 0, 0, SRCCOPY)

Case WM_CLOSE
CloseWindow(win)
EndProgram
End Select
End Select
Return Default
End Function
Title: Re: WinH
Post by: Mike Lobanovsky on October 10, 2015, 02:43:04 PM
Aurel,

What you're doing with this long-abandoned thread, on most respectable forums would be called necromancy (https://translate.google.by/?hl=ru&tab=wT#en/hr/necromancy). :)
Title: Re: WinH
Post by: Aurel on October 11, 2015, 08:39:29 AM
Mike

That is my problem NOT your....
Beter look into your FBSL necromancer forum where nobody post for years... :D
Title: Re: WinH
Post by: Mike Lobanovsky on October 12, 2015, 09:54:30 AM
Could you talk yet, Aurel, back at the times when I started to code FBSL and look after its forum? :D
Title: Re: WinH
Post by: Aurel on October 16, 2015, 12:51:50 PM
someting like help...

http://basicprograming.free-forum.net/gui-library-for-oxygen-vt48.html
Title: Re: WinH
Post by: Aurel on January 25, 2016, 09:19:57 AM
Just if someone need quick GUI program here is updated include file:
you can find it here
http://basicprograming.free-forum.net/index.php
 because i don't check this forum i will publish  updated include file only on my
forum..
thanks for understanding!
Title: Re: WinH
Post by: Aurel on January 31, 2016, 05:34:31 AM
.
Title: Re: WinH
Post by: JRS on January 31, 2016, 04:22:11 PM
Aurel,

You could always un-subscribe from the O2 forum to prevent the urge to keep saying good-bye.