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.


Messages - Chris Boss

Pages: 1 [2] 3 4
16
EZGUI 5 support forum / Re: Sprite Problem
« on: December 19, 2022, 12:30:39 pm »
No, you can get a sprite click. It is demonstrated in the sprite example in the codeclips folder.

Here is the code from that sample app:

Code: [Select]
SUB FORM1_CANVAS1_Click()
     LOCAL X&,Y&
     EZ_GetCanvasXY  "{ME}",  %FORM1_CANVAS1, X&, Y&, 0,0
     MSGBOX "You clicked me:"+STR$(X&)+STR$(Y&)+" "+EZ_TestSpriteClick("{ME}", %FORM1_CANVAS1, X&,Y&)
END SUB


17
EZGUI 5 support forum / Re: Sprite Problem
« on: December 16, 2022, 10:00:22 pm »
EZ_TestSpriteClick does not work the way you think.

The X& and Y& parameters are not return values, but are passed BYVAL telling the function where the coordinates to test are.

In the Canvas control's %EZ_Click event you have to call first:

EZ_GetCanvasXY

to get the coordinates for the last mouse click.

Then you can pass them to EZ_TestSpriteClick to see if the click occurred on a sprite.


18
EZGUI 5 support forum / Re: DateTime control
« on: August 27, 2022, 11:49:44 am »
The %EZ_Loading event occurs just "before" the control is created, so you can't use any commands which expect the control to exist in this event.

EZ_DefCalendarExColors

will fail in %EZ_Loading because the control does not exist yet.

The event %EZ_Loaded (ends in ed rather than ing) occurs right after the control is created, but before it is visible, so you can make calls to commands
which expect the control to exist in this event.

EZ_DefCalendarExColors should work fine in the %EZ_Loaded event !

Any command which has parameters for the form name and control ID, must be called only after the control is created and exists.

%EZ_Loading serves the purpose of changing control creation parameters for a control before it is created and for calls to EZGUI commands which have to be called before a control is create (ie. EZ_Color, EZ_UseFont).

Internally in all control creation commands it works this way:

{Control Creation Command}
  • Generate %EZ_Loading event if flagged to do so by a previous EZ_AllowLoadingEvent command
  • Modify any control creation parameters if changing in %EZ_Loading event using EZ_SetLoadStr or EZ_SetLoadVal commands
  • Create Control
  • Generate %EZ_Loaded event

By understand the sequence EZGUI uses when creating controls you will know what you can do in each of the events, %EZ_Loading and %EZ_Loaded

Forms work the same way, but also have a third event called:

%EZ_Started

which occurs after the form is created, all the controls are created and the form is now visible





19
EZGUI 5 support forum / Re: DateTime control
« on: August 26, 2022, 09:32:07 pm »
The Visual Designer does not allow you to select colors for the Date Time control.

The reason I made it that way is likely because the control does not support defining colors.

You can select the option:  "Allow %EZ_Loading Event"

and the control will get the %EZ_Loading event just before EZGUI creates the control.

You can define different colors in this event using EZ_Color, but if it does not chnage color it is because Windows Themes does not allow the control to use colors.

This may though call EZ_DefCalendarExColors in this event to set the colors for the Calendar part of the DateTime control.

EZ_SetAttr (attributes:  BColor and TColor) can be called at any time but again I believe it only sets the colors for the drop down calendar part of the DateTime control.



 

20
EZGUI 5 support forum / Re: Strange event
« on: June 20, 2022, 03:07:32 pm »
Don't assume it is a Windows 10 problem. I have been using PB 10 on Windows 10 for some time without problems.
Make sure you log into Windows using an account with administrator rights. Windows gets weird about working with folders which are not in the user area when not in admin mode.

Consider that  anything may be the cause, not simply Windows or even PB 10 at that. Things like antivirus software and anti-malware software can do strange things.

Don't assume the obvious things.

Yours is not a typical problem experienced by PB users.


21
EZGUI 5 support forum / Re: EZ_FListBox
« on: June 03, 2022, 10:44:18 pm »
The Designer generates the ID constant based on the user defined control name you define in the property dialog.

The codeclips were not generated by the designer and the name is what I wrote it to be.

22
EZGUI 5 support forum / Re: EZ_GetImageSize
« on: May 29, 2022, 08:57:18 pm »
EZGUI can not load image files other than Bitmaps (and icons, cursors).

The code you are referring to was based on code posted by Dan Ginzel which uses GDI+ API's to load JPG, PNG, etc and then return an EZGUI Picture string.

The code was on the forum, but I lost all the forum posts when upgrading the forum and have yet been bale to restore any of the old posts.


23
EZGUI 5 support forum / Re: EZ_GetImageSize
« on: May 29, 2022, 05:58:31 pm »
No such command in EZGUI.

Likely you may have used a function wrapper for other commands which you found on the forum.

Often when i write such a wrapper function I name it with the EZ_ prefix.

The command you need is:

 EZ_GetBitmapInfo hBmp&, W&, H&, PixelBits&, DIBPtr&

This will require calling the EZ_ImageHandle function to get an actual Bitmap handle from an EZGUI Picture name string (ie. EZ_LoadImage returns an internal name EZGUI uses to track a bitmap).


24
EZGUI 5 support forum / Re: Strange event
« on: May 26, 2022, 08:57:16 pm »
That is not normal and surely not a problem with EZGUI.

Maybe a problem with the PB IDE, possibly some system corruption (ie. memory).

I would reboot your PC and try again. If it is temporary because of some kind of memory corrupt that should fix it.


25
EZGUI 5 support forum / Re: Printing Unicode characters
« on: April 06, 2022, 10:07:49 pm »
If the character set you require fits in 256 characters then EZGUI's ascii based fonts are   fine.

I would suggest though using the Windows utility "Character Map" to browse the fonts and their character sets.
Very useful tool.

You will find it on the Windows menu under "Windows Accessories"


26
EZGUI 5 support forum / Re: Printing Unicode characters
« on: April 05, 2022, 03:35:15 pm »
When you say printing do you mean to a printer or simply to the screen ?

Unicode characters require a unicode capable font and must be drawn using an API which supports unicode.

EZGUI is ASCI only.

That said, I current have two projects I am working on (one finished) which needs to display text in languages like Japanese which require Unicode and it was not that difficult to implement using the WIN32 API and integrate into an EZGUI app.

First I had to create my fonts using the CreateFontW API function.

Then I was able to draw the text using either the TextOutW or DrawtextW API functions.

The same API's can be used either the screen or a printer. You simply select the font handle into the DC you are drawing into and then select the previous one back in when done.

Both when drawing to the screen or printer EZGUI provides you with the DC handle (device context).

27
EZGUI 5 support forum / Re: Limit of 20 Items in Dropdown Menu?
« on: March 04, 2022, 01:10:07 am »
You may have to hand code the menus rather than have the Visual Designer do it for you, if you have a conflict.

There is another option where you can change the control (and menus also) increment value in the project property dialog:

The property:

"Increment Control ID's by"

defaults to a value of 5 (20 menu items per range of 100 per drop down).

Change this value to something smaller and you will get more ID's per drop down list (each new drop down list increments by 100).

so 100/5 means 20 menu items

change to 2 and 100/2 means 50 menu items per drop down list.


See picture.




28
EZGUI 5 support forum / Re: Listview problem
« on: February 25, 2022, 12:05:46 am »
A more complex approach is to use OnwerDraw.

From an example in the codeclips folder (cdrawlv.bas):

Code: [Select]
' *************************************************************************************
'                    Portions: Copyright Christoper R. Boss, 2003 to 2011
'                                    All Rights Reserved !
'                 Registered EZGUI 5.0 users may use this code Royalty Free !
' *************************************************************************************
#COMPILE EXE
#DIM ALL
' --------------------
#INCLUDE "..\includes\ezgui50.inc"
' --------------------

DECLARE SUB Form1_Display(BYVAL Parent$)
DECLARE SUB Form1_Design()
DECLARE SUB Form1_Events(CID&, CMsg&, CVal&, Cancel&)
' ------------------------------------------------
%FORM1_LISTVIEW1          = 105
' ------------------------------------------------
DECLARE SUB FORM1_LISTVIEW1_Fill(BYVAL Mode&)
DECLARE SUB FORM1_LISTVIEW1_Change(BYVAL CVal&)
DECLARE SUB FORM1_LISTVIEW1_Select(BYVAL CVal&)

' --------------------
#INCLUDE "..\includes\ezwmain50.inc"
' --------------------

SUB EZ_Main(VerNum&)
    EZ_DefFont 6, "Arial", 14, "BVA"
    EZ_DefFont 7, "Arial", 10, "VA"
    EZ_DefFont 8, "Arial", 10, "BVA"
    EZ_DefFont 9, "Arial", 10, "IVA"
    EZ_LoadPatternLib "", ""
    Form1_Display ""
END SUB

SUB EZ_DesignWindow(FormName$)
    SELECT CASE FormName$
        CASE "FORM1"
            Form1_Design
        CASE ELSE
    END SELECT
END SUB

SUB EZ_Events(FormName$, CID&, CMsg&, CVal&, Cancel&)
    SELECT CASE FormName$
        CASE "FORM1"
            Form1_Events CID&, CMsg&, CVal&, Cancel&
        CASE ELSE
    END SELECT
END SUB

SUB Form1_Display(BYVAL Parent$)
    EZ_Color -1, -1
    EZ_Form "FORM1", Parent$, "OwnerDraw Listview", 0, 0, 67, 25, "C"
END SUB

GLOBAL Form1_FF&

SUB Form1_Design()
    LOCAL FF&
    '---------------------------------------------------------------
    FF& =  9              '          -  Offset for Font Numbers
    Form1_FF& = FF&          ' Global for ODButtons Draw code
    '---------------------------------------------------------------
    EZ_UseFont 7
    EZ_Color 0,15
    EZ_ListView %FORM1_LISTVIEW1, 3, 2, 60, 20, "Column 1{12}|Column 2{12}{C}|Column 3{12}{C}|", "SV-O?"
    FORM1_LISTVIEW1_Fill -1
    ' --------------------------------------------------------------
END SUB
'
SUB SizeListViewItem(BYVAL CID&, BYVAL CVal&)
LOCAL W&, H&, Item1&, Item2&, NW!, NH!
IF EZ_StartOwnerSize(CVal&, W&, H&, Item1&, Item2&) THEN
    EZ_GetTextSize 7, "XXX", NW!, NH!,0
    H&=INT(NH!*1.5*2)
    EZ_EndOwnerSize CVal&, W&, H&
END IF
END SUB
'
SUB DrawListviewItem(BYVAL CID&, BYVAL CVal&)
LOCAL hMyDC&, X2&, Y2&, IsSel&, IsGry&, IsDis&, IsChk&, IsFoc&, IsDef&
LOCAL X1&, Y1&, Item1&, IsEdit&, SubItem&, SubItem2&, CP$
LOCAL SX1&, SY1&, SX2&, SY2&, CW&, AW!, AH!
LOCAL IText$, IPictNum&, LVProp$
IF EZ_StartOwnerDraw(CVal&, hMyDC&, X2&, Y2&, IsSel&, IsGry&, IsDis&, IsChk&, IsFoc&, IsDef&) THEN
    EZ_GetODItem CVal&, X1&, Y1&, Item1&, IsEdit&
    CP$=EZ_GetLVColOrder("Form1", CID&,3)
    IF Item1&>=0 THEN
        SX1&=0
        EZ_SaveState
        FOR SubItem&=0 TO 2
            CW&=EZ_GetLVColWidth("Form1", CID&, SubItem&)
            SX2&=SX1&+CW&-1
            IF IsSel& THEN
                EZ_Color 15, 9
            ELSE
                IF (SubItem& MOD 2)=1 THEN
                    EZ_Color 0, 31
                ELSE
                    EZ_Color 0, 23
                END IF
            END IF
            IF SubItem&=1 THEN
                ' draw as a button
                EZ_DCDraw  hMyDC&, %EZ_FILL, SX1&, Y1&, SX2&, Y2&, 1, 1
'                EZ_DCDraw  hMyDC&, %EZ_EDGE_R, SX1&, Y1&, SX2&, Y2&, 1, 1
            ELSE
                EZ_DCDraw  hMyDC&, %EZ_FILL, SX1&, Y1&, SX2&, Y2&, 1, 1
            END IF
            EZ_SaveState
            IF IsSel& THEN EZ_Color 0,0
            EZ_DCDraw  hMyDC&, %EZ_LINE, SX2&, Y1&, SX2&, Y2&, 1, 0
            EZ_DCDraw  hMyDC&, %EZ_LINE, SX1&, Y2&, SX2&, Y2&, 1, 0
            EZ_RestoreState
            EZ_UseFont 7+SubItem&     ' use different fonts
            SubItem2&=VAL(PARSE$(CP$,"|",SubItem&+1))   ' get actual column
            IF EZ_GetLVItem("Form1", CID&, IText$, IPictNum&, Item1&, SubItem2&, LVProp$ ) THEN
                EZ_GetTextSize 7+SubItem2&, IText$, AW!,AH!,0
                IF AW!>CW& THEN
                    EZ_SetPrintFormat 2, SX2&, Y2&, %EZ_LEFT OR %EZ_VCenter, 0
                ELSE
                    EZ_SetPrintFormat 2, SX2&, Y2&, %EZ_CENTER OR %EZ_VCenter, 0
                END IF
                EZ_DCPrint hMyDC&, SX1&,Y1&, IText$
            END IF
            SX1&=SX2&+1
        NEXT SubItem&
        EZ_RestoreState
        EZ_SetPrintFormat 0,0,0,0,0
    END IF
    EZ_EndOwnerDraw
END IF
END SUB
'
SUB Form1_Events(CID&, CMsg&, CVal&, Cancel&)
    SELECT CASE CID&
        CASE %EZ_Window
            IF CMsg&=%EZ_Close THEN
            END IF
        CASE  %FORM1_LISTVIEW1
            IF CMsg&=%EZ_Change THEN
                FORM1_LISTVIEW1_Change CVal&
            END IF
            IF CMsg&=%EZ_Selected THEN
                FORM1_LISTVIEW1_Select CVal&
            END IF
            IF CMsg&=%EZ_OwnerSize THEN
                SizeListViewItem CID&, CVal&
            END IF
            IF CMsg&=%EZ_OwnerDraw THEN
                DrawListviewItem CID&, CVal&
            END IF
        CASE ELSE
    END SELECT
END SUB

SUB FORM1_LISTVIEW1_Fill(BYVAL Mode&)
    LOCAL R&, C&, Tmp$
    IF Mode&=-1 THEN    ' Initial Data
        FOR R&=0 TO 50    ' Rows
            FOR C&=0 TO 5    ' Columns
                Tmp$="Item "+RIGHT$("00"+LTRIM$(STR$(R&)),2)+","+STR$(C&)+CHR$(13)+CHR$(10)+"OK -"+STR$(R&)
                EZ_AddLVItem "Form1", %FORM1_LISTVIEW1, Tmp$, 0, R&, C&, ""
            NEXT C&
        NEXT R&
    END IF
END SUB

SUB FORM1_LISTVIEW1_Change(BYVAL CVal&)
END SUB

SUB FORM1_LISTVIEW1_Select(BYVAL CVal&)
END SUB

29
EZGUI 5 support forum / Re: Listview problem
« on: February 25, 2022, 12:03:24 am »
The easiest approach is to use CustomDraw !

In the codeclips folder is an example using a Listview (custdrw1.bas) :

Here is the code:

Code: [Select]
' *************************************************************************************
'                    Portions: Copyright Christoper R. Boss, 2003 to 2011
'                                    All Rights Reserved !
'                 Registered EZGUI 5.0 users may use this code Royalty Free !
' *************************************************************************************
#COMPILE EXE
#DIM ALL        '   This is helpful to prevent errors in coding
' --------------------
#INCLUDE "..\includes\ezgui50.inc"                          ' EZGUI Include file for Declares

' --------------------
' *************************************************************************************



' *************************************************************************************
'                         Application Constants and Declares
' *************************************************************************************
DECLARE SUB Form1_Display(BYVAL Parent$)
DECLARE SUB Form1_Design()
DECLARE SUB Form1_Events(CID&, CMsg&, CVal&, Cancel&)
' ------------------------------------------------

%FORM1_LISTVIEW1          = 100
' ------------------------------------------------

DECLARE SUB FORM1_LISTVIEW1_Fill(BYVAL Mode&)

' *************************************************************************************
'                         Application Global Variables and Types
' *************************************************************************************



'    Note:     Do NOT change the names of the EZGUI Callback Procedures !

' --------------------
#INCLUDE "..\includes\ezwmain50.inc"                          ' EZGUI Include file for WinMain
' --------------------
' *************************************************************************************
'                               EZGUI Program Control Functions
' *************************************************************************************

SUB EZ_Main(VerNum&)
    EZ_DefFont 6, "Arial", 12, "BIV"
    EZ_DefFont 7, "Arial", 12, "BV"
    EZ_DefFont 8, "Arial", 12, "V"
    EZ_DefFont 9, "Arial", 12, "IV"
    Form1_Display ""
END SUB

' -------------------------------------------------------------------------------------

SUB EZ_DesignWindow(FormName$)
    '      - NOTE:   EZGUI passes back Form Name in uppercase letters
    SELECT CASE FormName$
        CASE "FORM1"
            Form1_Design
        CASE ELSE
    END SELECT
END SUB

' -------------------------------------------------------------------------------------

SUB EZ_Events(FormName$, CID&, CMsg&, CVal&, Cancel&)
    '      - NOTE:   EZGUI passes back Form Name in uppercase letters
    SELECT CASE FormName$
        CASE "FORM1"
            Form1_Events CID&, CMsg&, CVal&, Cancel&
        CASE ELSE
    END SELECT
END SUB

' -------------------------------------------------------------------------------------






' *************************************************************************************
'                                 Put Your Code Here
' *************************************************************************************

SUB Form1_Display(BYVAL Parent$)
    EZ_Color -1, -1
    EZ_Form "FORM1", Parent$, "Your Dialog", 0, 0, 50, 18, "CK"
END SUB
' ------------------------------------------------

GLOBAL Form1_FF&

SUB Form1_Design()
    LOCAL FF&
    '---------------------------------------------------------------
    FF& =  9              '          -  Offset for Font Numbers
    Form1_FF& = FF&          ' Global for ODButtons Draw code
    '---------------------------------------------------------------
    EZ_Color-1,-1
    EZ_UseFont -1
    EZ_UseFont 6
    EZ_ListView %FORM1_LISTVIEW1, 1, 1, 48, 15, "Column 1{15}|Column 2{15}{C}|Column 3{15}{R}|", "SVT-#"
    FORM1_LISTVIEW1_Fill -1
    ' --------------------------------------------------------------
END SUB
' ------------------------------------------------

SUB Form1_Events(CID&, CMsg&, CVal&, Cancel&)
    LOCAL SI&, I&
    SELECT CASE CID&
        CASE %EZ_Window
            IF CMsg&=%EZ_Close THEN
            END IF
        CASE  %FORM1_LISTVIEW1
            IF CMsg&=%EZ_NoCustomDraw THEN Cancel&=1
            IF CMsg&=%EZ_CustomDraw THEN
                I&=EZ_GetCDrawItem(CVal&, SI&)
                SELECT CASE SI&
                    CASE 0
                        EZ_SetCDrawItem CVal&, 7, 4,-1
                    CASE 1
                        EZ_SetCDrawItem CVal&, 8, 2,-1
                    CASE 2
                        EZ_SetCDrawItem CVal&, 9, 1,-1
                    CASE ELSE
                        EZ_SetCDrawItem CVal&, 6, 0,-1
                END SELECT
            END IF
        CASE ELSE
    END SELECT
END SUB
' ------------------------------------------------


' ------------------------------------------------

SUB FORM1_LISTVIEW1_Fill(BYVAL Mode&)
    LOCAL R&, C&, Tmp$
    IF Mode&=-1 THEN    ' Initial Data
        FOR R&=0 TO 50    ' Rows
            FOR C&=0 TO 5    ' Columns
                Tmp$="Item "+RIGHT$("00"+LTRIM$(STR$(R&)),2)+","+STR$(C&)
                EZ_AddLVItem "Form1", %FORM1_LISTVIEW1, Tmp$, 0, R&, C&, ""
            NEXT C&
        NEXT R&
    END IF
END SUB

' ------------------------------------------------

30
EZGUI 5 support forum / Re: Mask problem with EZ_Text
« on: January 18, 2022, 11:04:51 am »
If you want to define the current date as the default then  set the option (in designer) to generate the %EZ_Loading event. Then in the %EZ_Loading event you can swap in a string for the current date by using the EZ_SetLoadStr command.

This way the control when first created would have the current date and then the user can change that to a different date manually.


Pages: 1 [2] 3 4