August 22, 2019, 12:08:56 pm

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Recent posts

Pages 1 2 3 4 5 ... 10
21
GUI Central / Re: Tabbing backwards in Dialo...
Last post by billhsln - August 04, 2019, 10:55:59 am
Ok, I screwed up, it is a Window, not Dialog.  I have the logic built in to go forward, just wondering how I can put in logic to go backwards while tabbing.  Working on sample that I can upload, so you can see exactly what I am doing.  Like I said, it works forward, just need an idea how to tell when some one does a shift tab (guessing read keypress)?

New: Tabbing works forwards and backwards, but I would also like the Enter key to move to the next edit field.  Have tried a couple of things, but they don't work.  Prefer to keep tabbing working both directions.

Thanks,
Bill

Added sample, compile as windows.
22
GUI Central / Re: Tabbing backwards in Dialo...
Last post by fasecero - August 03, 2019, 05:09:25 pm
Using @TABSTOP -> default behavior for tabbing backward is SHIFT + tab.
23
GUI Central / Tabbing backwards in Dialog
Last post by billhsln - August 02, 2019, 02:20:43 pm
I have a fairly large program that I control the tabbing going forward.  How would I know that some one tried to do a backward tab.  I can program for it, just don't know how to recognise that the user did a back tab.  For the most part tabbing forward is just adding 1 to a variable that has the current cursor position to get to the next.  I just don't know what to do to figure out what to look for.

Thanks,
Bill
24
Games and Graphics / Re: DevIL image viewer program
Last post by fasecero - July 30, 2019, 12:39:27 pm
QuoteThing is, you can go on the internet and type "image viewers" and take your pick. But there is nothing like the satisfaction of creating something of your own

I can't agree more on that

QuotePlease take a look at my latest offering

this version you posted is fantastic. You really get the hang of those il functions. Well done!
25
Games and Graphics / Re: DevIL image viewer program
Last post by Brian - July 30, 2019, 12:23:21 pm
That's OK - miracles take a bit longer!

Anyway, I have been working on it today, and have come up with a version that works in respect of centring an image that is smaller than the window, and resizing an image if it is larger. It also resizes the image if you resize the program window

Only thing that doesn't work correctly (yet) is the crop function, and zoom. Will take a look at those as time goes on. Also, when it redraws after a window, resizing could be quicker, I reckon

Otherwise, quite happy with this version. Thing is, you can go on the internet and type "image viewers" and take your pick. But there is nothing like the satisfaction of creating something of your own

Many thanks for your help in this. Please take a look at my latest offering

Brian
26
Games and Graphics / Re: DevIL image viewer program
Last post by fasecero - July 30, 2019, 11:46:39 am
Yes, sorry. I give up. I can't solve the issues you posted without modifying the dll source code.
27
Games and Graphics / Re: DevIL image viewer program
Last post by Brian - July 30, 2019, 04:03:40 am
Fasecero,

Thanks for the code. Will have to look later, as I am out most of the day

When I compiled, I noticed straight away that the treeview selection didn't jump to the saved folder. It jumps to the root directory of the folder, but not the saved folder

And using a manifest removes the file icons in the FileListBox. Did you notice this?

Unless the manifest file I am using is the wrong type. I know there are quite a few variations. You could always post it with a .txt extension, instead of .manifest, and point out that it needs renaming

That way, I can be certain that we are the same

Brian
28
Games and Graphics / Re: DevIL image viewer program
Last post by fasecero - July 29, 2019, 04:03:38 pm
I have more or less fixed the first example you posted because that treeview looks much better. I had to change many things, I will try to explain them briefly.

- The handle of the treeview is the handle of the BFF control. Denying this made me waste a lot of time.

- Once the treeview handle is obtained, adding TVS_SHOWSELALWAYS is simple, but it didn't work. The treeview seem to have some customdraw code that I couldn't remove by subclassing it. The only way to achieve this was to use a .manifest file and enabling visual styles.

Code Select
' GET THE TREEVIEW HANDLE
INT tv_hwnd = GetDlgItem(win.hWnd, BFF)

' MODIFY THE TREEVIEW
IF tv_hwnd THEN
' SHOW ALWAYS THE SELECTION ON THE TREEVIEW
LONG lStyle = GetWindowLong(tv_hwnd, GWL_STYLE)
lStyle = lStyle | TVS_SHOWSELALWAYS
' lStyle = lStyle & NOT(TVS_HASLINES) '  <-- if you want to remove the treeview lines uncomment this
SetWindowLong(tv_hwnd, GWL_STYLE, lStyle)

' SET WINDOWS EXPLORER STYLE / YOU MUST USE A .MANIFEST FILE
SetWindowTheme(tv_hwnd, L"explorer", NULL) ' the treeview is unicode!!

' SET INITIAL FOCUS ON THE TREEVIEW
_SetFocus(tv_hwnd)
ENDIF

- To successfully paint listbox background & elements using visual styles it is necessary to subclass win DIALOG, and process the WM_CTLCOLORLISTBOX message.

Code Select
SUB subclassProc(hWnd:INT,uMsg:INT,wParam:INT,lParam:INT,uIdSubclass:UINT_PTR,dwRefData:DWORD_PTR),INT
HDC         hDC
    PAINTSTRUCT Ps
WINRECT rc

SELECT uMsg
CASE WM_CTLCOLORLISTBOX ' PAINT FILELISTBOX
IF lParam = GetDlgItem(win.hWnd, FLB) THEN
HDC hdcStatic = wParam
SetTextColor(hdcStatic, RGB(0,0,0))
SetBkColor(hdcStatic, RGB(240,240,240))
IF hbrBkgnd = NULL THEN hbrBkgnd = CreateSolidBrush(RGB(240,240,240))
RETURN hbrBkgnd
ENDIF

CASE WM_PAINT ' PAINT THE IMAGE
hDC = BeginPaint(hWnd, &Ps)
GetClientRect(hWnd, rc)
OnPaint(hDC, rc)
EndPaint(hWnd, &Ps)

RETURN 0
ENDSELECT

RETURN DefSubclassProc(hWnd, uMsg, wParam, lParam)
ENDSUB

- Finally, I didn't like at all that the application resizes according to the image. I decided to always start the DIALOG maximized and the image is the one that fits the screen size. Unfortunately this was impossible to achieve with SHOWIMAGE, so I had to process the WM_PAINT message and draw the image using double buffer, since for some reason the ILXXX dll functions seem to "modify" the win device context.

Code Select
SUB OnPaint(INT hDC, WINRECT rc)
' start double buffer
INT hdcMem = CreateCompatibleDC(hDC)
HBITMAP memBM = CreateCompatibleBitmap(hDC, rc.right - rc.left, rc.bottom - rc.top)
HBITMAP OldmemBM = SelectObject(hdcMem, memBM)

' paint background color
HBRUSH hbrBkgnd = CreateSolidBrush(RGB(190,190,190))
FillRect(hdcMem, rc, hbrBkgnd)
DeleteObject(hbrBkgnd)

' paint image
PaintImage(hdcMem, rc)

' finish double buffer
BitBlt(hDC, 0, 0, rc.right - rc.left, rc.bottom - rc.top, hdcMem, 0, 0, SRCCOPY)
SelectObject(hdcMem, OldmemBM)
DeleteObject(memBM)
DeleteDC(hdcMem)
ENDSUB

SUB PaintImage(INT hDC, WINRECT rc)
BITMAP bit
INT hdcMem = CreateCompatibleDC(hDC)
INT oldBitmap = SelectObject(hdcMem, bitmap)
GetObject(bitmap, LEN(bit), &bit)

SetStretchBltMode(hDC, HALFTONE)
StretchBlt(hDC, splitWidth + paddingX, paddingY, w, h, hdcMem, 0, 0, bit.bmWidth, bit.bmHeight, SRCCOPY)
SelectObject(hdcMem, oldBitmap)
DeleteDC(hdcMem)
ENDSUB

Complete code and .manifest file below. EDIT: .manifest file not allowed as attachments. But make sure to use a .manifest file or some code will not work.
29
Games and Graphics / Re: DevIL image viewer program
Last post by Brian - July 28, 2019, 08:39:00 am
Help! If anyone can help with this problem, I would be very grateful. I am banging my head over this one

When the program starts up, the window is 1024 x 768. If you click on a graphic that is smaller than the client window (the grey area), the image fits perfectly in the centre

I am calculating if the image width or height is greater than the client area, and using iluScale to resize the image to fit, but obviously it is not working like I think it should be

Any ideas?

Brian
30
Games and Graphics / Re: DevIL image viewer program
Last post by Brian - July 26, 2019, 08:39:56 am
Update: Now populates the file list box faster; added keyboard shortcuts, and various other tweaks

Brian
Pages 1 2 3 4 5 ... 10