Requesting platform, mac or windows

Home Forums Problems and solutions in GDL Informations from the environment Requesting platform, mac or windows

This topic contains 10 replies, has 3 voices, and was last updated by  shaun coomber 1 week ago.

  • Author
    Posts
  • #4163

    shaun coomber
    Participant

    Hi,

    Is it possible to request whether the user is on Windows or OS?

    I am looking to customise some parts of the UI where some of the UI_INFIELD options display differently depending on the platform.

    Thanks
    Shaun

  • #4164

    Dominika Bobály
    Keymaster

    Hi Shaun,

    officially any library part is considered platform-independent, so there is no built-in way within GDL to “know” about the platform.
    Could you upload here a win-mac comparison image of the issue you are experiencing with ui_infield? With example code, if possible.
    As far as I know, there should be only very small differences, mostly in connection with the control layouts “borrowed” from the platform’s op. system itself. If you see something very different, maybe it’s a bug so I would like to check.
    Or maybe we can suggest a workaround:).
    Thanks!

    Dominika Bobály
    Library Developer, Library Team
    GRAPHISOFT SE

  • #4165

    shaun coomber
    Participant

    I’ve tried two different methods.

    With ui_infield method 1, the interface leaves more of a space between each option on Windows. Even if I increase the size of the field to accommodate the scroll bar etc. it doesn’t display well. On Mac, it looks fine.

    With ui_infield method 6, I have created a separate ui_infield command for each option. On windows it displays nicely, but on Mac it doesn’t show which is selected.

    Method 1 images are attached…

  • #4168

    shaun coomber
    Participant

    And here are the method 6 images…

  • #4171

    shaun coomber
    Participant

    Here is the code for method 1:

    UI_INFIELD{3} SelectField, xpos, ypos+yspc, useWidth*4+20, useHeight*2,
    1, 25,
    8, 2,
    useWidth, useHeight, useWidth, useHeight,
    1, “”, 1,
    2, “”, 2,
    3, “”, 3,
    4, “”, 4,
    5, “”, 5,
    6, “”, 6,
    7, “”, 7,
    8, “”, 8

    And here is the code for method 6:

    FOR k = 1 TO 4

    UI_INFIELD{3} SelectField, xpos+useWidth*(k-1), ypos+yspc, useWidth, useHeight,
    6, 25,
    8, 2,
    useWidth, useHeight, useWidth, useHeight,
    k, “”, k+10,
    k, “”, k

    NEXT k

    FOR k = 5 TO 8

    UI_INFIELD{3} SelectField, xpos+useWidth*(k-5), ypos+yspc+useHeight, useWidth, useHeight,
    6, 25,
    8, 2,
    useWidth, useHeight, useWidth, useHeight,
    k, “”, k+10,
    k, “”, k

    NEXT k

    With the following trick in the parameter script:

    IF SelectField > 10 THEN
    SelectField = SelectField – 10
    PARAMETERS SelectField = SelectField
    ENDIF

    • #4184

      Dominika Bobály
      Keymaster

      Pressed the wrong reply, see some info below Joachim’s post:)

      Dominika Bobály
      Library Developer, Library Team
      GRAPHISOFT SE

  • #4172

    Joachim Sühlo
    Participant

    Hi,
    there a really a lot of differences, how the UI Elements are shown on Windows and MAC.
    E.G. length and size of text, points of linebrakes, UI_Styles.

    We use in our office the following REQUEST to distinguish between both platforms.

    ! Parameters for ArchiCAD version and Platform
    Dose = 0
    sts = REQUEST(“Name_of_program”, “”,TeX)
    IF STRSTR(TeX,”.EXE”) OR STRSTR(TeX,”.exe”) THEN Dose = 1

    And we always check the UI on both platforms.

    GDL Object Developer
    b-prisma
    MAC OSx 10.11

    • #4181

      Dominika Bobály
      Keymaster

      Shaun,
      thanks for the uploads. We are aware of the issue with ui_infield: before AC 22, there was no correct way to set up a multi-row image control for the same parameter. Viable workaround does not really exist (not even with method 4): ui_infield does not tolerate well if parts of the valid parameter value range are omitted from the UI control.
      Since we also had issues with this, for AC 22 new interface commands were introduced to make the layout possible: UI_PICT_RADIOBUTTON.
      You can create a mosaic-image with pushable parts (note, only one part can be selected in this case).
      If you want multiple parts of the mosaic to be pushable at the same time (booleans), you can use the UI_PICT_PUSHCHECKBUTTON the same way.
      Just ignore the preview overlap warnings if you want to have a continuous mosaic image:).
      Enclosed are the resulting controls on both platforms.
      Is this what you want it to look like? I used this cross image to check on the image edges.

      Dominika Bobály
      Library Developer, Library Team
      GRAPHISOFT SE

  • #4173

    shaun coomber
    Participant

    ! Parameters for ArchiCAD version and Platform
    Dose = 0
    sts = REQUEST(“Name_of_program”, “”,TeX)
    IF STRSTR(TeX,”.EXE”) OR STRSTR(TeX,”.exe”) THEN Dose = 1

    That is brilliant, it works perfectly! Thank you

  • #4174

    Joachim Sühlo
    Participant

    That is brilliant, it works perfectly! Thank you

    Thanks to Frank Beister, who had published this on openegdl.org.

    GDL Object Developer
    b-prisma
    MAC OSx 10.11

  • #4189

    shaun coomber
    Participant

    Hi Dominika,

    Thank you, I will try that too.

    I’ve just found another difference between Mac and Windows interfaces… UI_INFIELD with method 8 can be set with different heights on Windows, but on Mac this setting is ignored and the drop-down list is also displayed with the same height.

    UI_INFIELD{3} “editField”, 75, ypos-3, 313, 22,
    8, “”, 0, 0, 0, 0, 0, 0,
    “”, editType[1], editType[1],
    “”, editType[2], editType[2],
    “”, editType[3], editType[3],
    “”, editType[4], editType[4]

You must be logged in to reply to this topic.