Recent Posts

Pages: 1 ... 6 7 [8] 9 10
71
EZGUI 5 support forum / Re: Printing Unicode characters
« Last post by Chris Boss 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"

72
EZGUI 5 support forum / Re: Printing Unicode characters
« Last post by Brian Reynolds on April 05, 2022, 08:16:37 pm »
Chris,
I was using the Arial that came with my Windows 10.
However, I have just managed to overcome the problem, using the following:

EZ_DefFont 50, "Broadway", 11, "BV[48#]"

and Printing a capital "I"

Thank you for your trouble

Brian Reynolds.
 
73
EZGUI 5 support forum / Re: Printing Unicode characters
« Last post by Chris Boss 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).
74
EZGUI 5 support forum / Printing Unicode characters
« Last post by Brian Reynolds on April 04, 2022, 09:50:17 pm »
Can anyone help me with printing very high HEX or UNICODE characters?

Using Windows Character Map, I select Arial and scroll down to about four-fifths of the depth and there's a "Full Block" (black block of character with and depth).

It shows at the bottom what I assume to be a Hex num,ber "U+2588"

I normally print these codes (255 and below) by converting them to a ASCII number but I can't figure how I can do this one.

Can anyone help? 
75
EZGUI 5 support forum / Re: Limit of 20 Items in Dropdown Menu?
« Last post by Frank Kelley on March 04, 2022, 02:35:50 pm »
I ended up manually adjusting the ID of last few menu items as other portions of my code depend on the default 5 value increment of controls to hide/display them depending on what is happening elsewhere in the code.

It might have been better to have EZGUI generate the IDs of successive main menu items based on the ID of the last item in the previous main menu, but that's 20/20 hindsight on my part.

Thanks for your response, nonetheless!
76
EZGUI 5 support forum / Re: Limit of 20 Items in Dropdown Menu?
« Last post by Chris Boss 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.



77
EZGUI 5 support forum / Limit of 20 Items in Dropdown Menu?
« Last post by Frank Kelley on March 03, 2022, 04:23:32 pm »
Working on a project that is using a form menu (File, Tools, Help, etc.) across the top of the form. One of the drop downs has grown to 20 items (including separators). It happens that EZGUI gives the last item in the list an ID of 9200...which is also the ID of the first item in the NEXT list. Much confusion when the menu appears to go haywire.

Is there a way to allow 20 full items in a drop down menu without having to edit the EZGUI generated code?
78
EZGUI 5 support forum / Re: Listview problem
« Last post by Chris Boss 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
79
EZGUI 5 support forum / Re: Listview problem
« Last post by Chris Boss 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

' ------------------------------------------------
80
EZGUI 5 support forum / Listview problem
« Last post by Brian Reynolds on February 24, 2022, 09:20:24 pm »
I am using two listviews so that data in Listview1 can be multiplied by data in Listview2 and wish to highlight the items being used in both Listviews.
What I need advice on is how to colour the background on an item when I click on it in Listview1 and again on an item in Listview2.
I am aware that when and item is clicked on it appears in white text with a blue background but immediately the listview loses focus it reverts to its original appearance.
Can this be done?
Pages: 1 ... 6 7 [8] 9 10