Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Quin

#1
User Contributions / Re: Bcx EDitor (BED)
Today at 03:23:09 PM
MrBcx,
Would it be possible to have Control+F being pressed from the main BED window when the dialog is showing but doesn't have the foreground focus set it to the foreground? If I type a search query, press enter, find it, and then want to type another, control+f doesn't work to bring me back to the dialog, I have to use my screen reader's object navigation to navigate the window hierarchy and manually focus it that way.
Thanks!
#2
Cool stuff, MrBcx! this is a super cool looking project.
#3
Today I discovered Minilua, and was curious if I could get it to work in a BCX application. And I did! This code successfully executes the lua code:
print 'Hello, world!'
And it compiles to a standalone executable, around 280 KB with MSVC using the UCRT. Pretty impressive!
$Header
#define LUA_IMPL
#include "minilua.h"
$Header

Dim L As lua_State Ptr
L = luaL_newstate()
If L = NULL Then End
luaL_openlibs(L)
luaL_loadstring(L, "print 'Hello, world!'")
lua_call(L, 0, 0)
lua_close(L)
#4
Robert,
Touche. I admittedly skipped over that comment when I glanced at it. This seems fine as it is :)
Perhaps something could be added to the description as well noting it, but it's stated in the comment so that's not super necessary
#5
Quote from: MrBcx on April 26, 2025, 02:17:39 PMEverything that you sandwich between $HEADER directives must be legal c/c++ or c/c++ pre-processors commands.  You cannot use BCX's BASIC directives, like $PRAGMA.
Gotcha, thanks!
Robert, could we consider noting this in the help?
#6
Kevin,
I got this to work by using #pragma warning(disable: 4244) like you suggested. However, using $Pragma instead of #pragma, even in a $Header block, doesn't work. Why is this?
Thanks!
#7
Works well here, thanks a ton for sharing! :)
#8
Thanks MrBcx, what I was missing was needing to put them in the $Header directive.
#9
User Contributions / Re: Versions of SLEEP
April 25, 2025, 10:26:48 AM
Very cool, thanks for sharing! I knew about timeBeginPeriod and timeEndPeriod, in fact I use them in my MicState application whenever the user presses the hotkey so the sleep is actually only about 50 MS. I don't bother using arguments for mine though, just call timeBeginPeriod(); and timeEndPeriod();.
What have you noticed this screwing up? I ask because in my app I do it only for as long as  needed, but an audiogame engine I work on does this at the start of its AngelScript registration and I wonder if it could actually screw something up?
#10
Kevin,
Fair enough. And warnings are just that, warnings.
Is it possible for me to silence just this warning? It clutters my output. I want most warnings, but this is just annoying, especially when it's in code I didn't write.
I've tried this, putting the $pragma before and after the $Warnings_On line, but it doesn't work.
$Pragma warning(disable: 4244)
$Warnings_On
#11
The title pretty much sums this up. I have a GUI app that uses Bcx_Form, Bcx_Edit, Bcx_Label, and a couple others. When I compile with MSVC (UCRT), it works just fine, but if I use $Warnings_On, I get a lot of warnings, just like this:
QuoteC:\Users\Quin\git\np\np.c(825): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
C:\Users\Quin\git\np\np.c(825): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
C:\Users\Quin\git\np\np.c(824): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
C:\Users\Quin\git\np\np.c(824): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
For reference, lines 824-825 of np.c are:
    HWND A = CreateWindowEx(Exstyle, BCX_ClassName, Caption, Style, X * BCX_ScaleX, Y * BCX_ScaleY,
             BCX_ScaleX * (4 + W), BCX_ScaleY * (12 + H), NULL, (HMENU)(UINT_PTR)NULL, BCX_hInstance, NULL);
inside
HWND BCX_Form (LPCTSTR Caption, int X, int Y, int W, int H, int Style, int Exstyle)
#12
Robert,
It's the H2 under the h1 that says "SSubclassing Windows Controls". Select the text and copy it, you'll see the missing space:
QuoteCALLBACKFUNCTION ... END FUNCTION procedure
Purpose:
#13
Thanks MrBcx, this works like a charm! :)
#14
Pretty pedantic bug report, but I started digging into the code of BCX and couldn't figure it out right away, so am now fascinated and wonder why this is the case.
When I translate a simple GUI test app, like the one I posted in the topic about inserting tabs in an edit control, WinMain is indented by 2 spaces by default, and some of the statements before FormLoad are indented by two spaces more than the rest of the initialization. This is weird, because from looking at the code, you prepend them all with two spaces.
Example:
 
  int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrev,PSTR CmdLine,int CmdShow) {
  MSG  Msg;
    strcpy(BCX_ClassName,"Test");
    BCX_SetMetric("pixels");
    BCX_InitGUI();
    BCX_hInstance       =  hInst;
    BCX_WndClass.hIcon  =  LoadIcon(NULL,IDI_WINLOGO);
    BCX_RegWnd(BCX_ClassName, WndProc);
 
    // ******************************************
                      FormLoad();
    // ******************************************
While we're on the subject, why is FormLoad(); indented like this? Is it a visual alignment thing?
Thanks!
#15
Hi Kevin,
Using the generated C code as a base as well as the subclassing windows controls section of the BCX help, I tried subclassing the edit control myself, like so. However, I still am unable to insert tabs. Am I missing something?
Gui "Test", Pixels

Dim As Control MainForm, Edit

Sub Formload
    MainForm = Bcx_Form("Test")
    Edit = Bcx_Richedit("", MainForm, 101, 5, 5, 600, 400)
    Dim EditBeforeSubclass As WNDPROC
    EditBeforeSubclass = SubclassWindow(Edit, EditFieldProc)
    Center(MainForm)
    Show(MainForm)
    SetFocus(Edit)
End Sub

Begin Events
    Select Case Cbmsg
    Case WM_CLOSE, WM_DESTROY, WM_QUIT
        DestroyWindow(MainForm)
    End Select
End Events

Callback Function EditFieldProc
    If Msg = WM_KEYDOWN And wParam = VK_TAB Then
        SendMessage(hWnd, EM_REPLACESEL, True, (LPARAM)"\t")
        Function = 0
    End If
End Function
Thanks!